Part of pida.utils.rat.util View In Hierarchy
This class is used to help the manipulation of C{gtk.ListStore}s. Here's an example on how to create one:
my_spec = ListSpec( ("STATE", gobject.TYPE_INT), ("FILENAME", gobject.TYPE_STRING), )
To create a ListStore, just do the following:
store = my_spec.create_list_store()
To add data to a store you can access it directly:
store.append((1, "fooo"))
Or by creating a dict object and converting it:
row = { my_spec.STATE: 2, my_spec.FILENAME: "bar" } store.append(my_spec.to_tree_row(row))
To access a column on a given row:
for row in store: print "State:", row[my_spec.STATE] print "Filename:", row[my_spec.FILENAME]
Line # | Kind | Name | Docs |
---|---|---|---|
52 | Method | __init__ | Undocumented |
64 | Method | create_list_store | Creates a new C{gtk.ListStore} |
70 | Method | to_tree_row | Converts a L{dict} like object to a list suitable for adding to a |