Re: [pygtk] CellRenderToggle, ListStore and tri-state

2008-04-26 Thread Facundo Batista
2008/4/26, Alessandro Dentella <[EMAIL PROTECTED]>:

>   i want to improve an editor of database tables I'm working on.  When
>   editing tables I use a TreeView with a ListStore and I use agboolean> to store the data.
>
>   I'd like to add capability to handle IS NULL beside True and False ad that
>   is a different valuable choiche.

See, you need to define two bools in the TreeStore, one for thre real
True/False state, other for the Inconsistant state (I'm copying this
from an example, the complete code is here [1]).

treestore = gtk.TreeStore(str, gobject.TYPE_BOOLEAN,
gobject.TYPE_BOOLEAN, str, gtk.gdk.Pixbuf)

Then, when you define the column:

# create a TreeViewColumn for the checkbox
tvcolumn = gtk.TreeViewColumn('Active')
cell = gtk.CellRendererToggle()
cell.set_property('activatable', True)
cell.connect('toggled', self.activatePlugin)
tvcolumn.pack_start(cell, False)
tvcolumn.add_attribute(cell, 'active', 1)
tvcolumn.add_attribute(cell, 'inconsistent', 2)
self.append_column(tvcolumn)

Regards,

[1] 
http://w3af.svn.sourceforge.net/viewvc/w3af/branches/sasha/core/ui/gtkUi/pluginconfig.py

-- 
.Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] CellRenderToggle, ListStore and tri-state

2008-04-26 Thread Alessandro Dentella
Hi,

  i want to improve an editor of database tables I'm working on.  When
  editing tables I use a TreeView with a ListStore and I use a  to store the data. 

  I'd like to add capability to handle IS NULL beside True and False ad that
  is a different valuable choiche.

1.st question
-

  If I'm not wrong GTupe Boolean only stores True/False (maps None to
  False), so I guess I should use another Type but I can't figure out which
  one... 

2.nd question
-

  I'd like to use CellRendererToggle with the inconsistent
  property/appearance to signify no value has been set. Is there a better
  way? Any suggestion as how to proceed (But it may depends on the solution
  of qeustion n.1...)


Thanks in advance

sandro
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/