Package vwidget :: Module util
[hide private]
[frames] | no frames]

Source Code for Module vwidget.util

 1  """ 
 2  Just a place to house some universalish utilities 
 3  """ 
 4   
 5  import gtk 
 6   
7 -def makeColumn(name, index, onedit=None, cell=None, links=None):
8 """ 9 Return a default "TreeViewColumn" of name "name" 10 whose TreeModel index for the renderer is "index" 11 """ 12 if cell == None: 13 cell = gtk.CellRendererText() 14 if links == None: 15 links = {"text":index} 16 if onedit: 17 cell.set_property("editable", True) 18 cell.connect("edited", onedit) 19 col = gtk.TreeViewColumn(name,cell,**links) 20 col.set_property("clickable", True) 21 col.set_property("reorderable", True) 22 col.set_property("resizable",True) 23 col.set_property("sizing",1) 24 col.set_property("sort-indicator", True) 25 col.set_sort_column_id(index) 26 return col
27
28 -def getTreeSelected(treeview, colnum):
29 """ 30 Return the object in column *colnum* from the currently 31 selected row in the given treeview... 32 """ 33 ret = None 34 path,view = treeview.get_cursor() 35 model = treeview.get_model() 36 if path: 37 iter = model.get_iter(path) 38 ret = model.get_value(iter, colnum) 39 return ret
40