Archive for the ‘Workshop’ Category

New custom timeline widget

Tired of looking for a timeline widget in PyGTK for Vazaar I’ve decided to develop it  by myself. It’s very simple: 1 calendar and 3 treeviews. The user clicks a day in the calendar and with the selected date Vazaar asks to the database for those resources created that day, the day before and the [...]

How to fix your sqlite database after corruption

If you get something like this: Traceback (most recent call last): File “./bin/vazaar”, line 79, in Vazaar(options, args) File “/home/t00m/dev/trunk/vazaarlib/main.py”, line 61, in __init__ self.store = StoreManager(self) File “/home/t00m/dev/trunk/vazaarlib/store.py”, line 54, in __init__ self.__get_graph() File “/home/t00m/dev/trunk/vazaarlib/store.py”, line 85, in __get_graph self.graph.store.open(self.options) File “/usr/lib/pymodules/python2.6/rdflib/store/Sleepycat.py”, line 77, in open index.open(index_name, dbname, dbtype, dbopenflags|db.DB_CREATE, dbmode) MemoryError: (12, ‘Cannot [...]

PyGTK XDot Widget

XDot es un magnífico componente para representar grafos interactivos con Python, Graphviz y GTK. De la web del autor: xdot.py is an interactive viewer for graphs written in Graphviz’s dot language. It uses internally the graphviz’s xdot output format as an intermediate format, and PyGTK and Cairo for rendering. xdot.py can be used either as [...]

Question about UTF-8

Sometimes, I’ve noticed that my application doesn’t deal very well with UTF-8 input/output. UTF-8 is mandatory but it’s a headache when you have to spend your time guessing what is wrong and how display the right characteres. I’ve found this function to force encode any text into UTF-8. keydict = {     ‘zwnj’: ”, [...]

Reports with Cheetah templates

I’ve found Cheetah template engine very useful to build custom reports. With a very small set of syntactic rules you can mix html and python to generate dynamic content. This is a small example extracted from my project: filename default.html: #import time #from vazaarlib.i18n import _ #from vazaarlib.utils import fuzzy_date, str2utf8, get_resource_contents #from vazaarlib.utils import [...]