[pygtk] Custom cell renderers

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Fri Apr 8 18:40:21 WST 2005


On Fri, 2005-04-08 at 11:19 +0100, Gustavo J. A. M. Carneiro wrote:
> On Fri, 2005-04-08 at 02:21 +0300, Osmo Salomaa wrote:
> > I've been reading some old posts on the list about problems with 
> > creating custom cell renderers.
> > 
> > After those posts has happened the following:
> > 
> > "ANNOUNCE: PyGTK 2.6.0
> > ...
> > GInterfaces can now be implemented.
> > Overriding GTK+ virtual methods is now supported."
> > 
> > If I understood correctly these two were the reasons why one couldn't 
> > subclass CellRendererText and override the 'start_editing' method or use 
> > a TextView that implements CellEditable as the editing widget in a 
> > custom cell renderer? Can these tasks now be done?
> 
>   It depends. The two statements are a bit optimistic :-)
> 
>   It means the infrastructure is there to implement interfaces and
> override gtk+ virtual methods.  However, some interface and virtual
> method "proxies" cannot be automatically generated (yet) and need manual
> coding, thus not all proxies have been implemented, which means you have
> to check, case by case, if what you want to do is possible.
> 
>   In your specific case, yes, you can implement GtkEditable interface.

  Correction.   Except the following methods:

Could not write interface proxy GtkEditable.insert_text: No ArgType for
'gint*'
Could not write interface proxy GtkEditable.do_insert_text: No ArgType
for 'gint*'
Could not write interface proxy GtkEditable.get_selection_bounds: No
ArgType for 'gint*'

  But insert_text is also a signal, so you can override the signal.  But
I'm afraid get_selection_bounds can not be implemented.

> To do so, you have to add gtk.Editable to base classes, and implement
> the interface methods.  For each interface method <foo>, you have to
> implement a corresponding method do_<foo> in your class.  Then call
> gobject.type_register(MyClass).
> 
>   Regards.
> 
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3086 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20050408/0a6323d8/smime.bin


More information about the pygtk mailing list