Dom, 2004-10-31 �s 18:28 -0700, Robert Uhl escreveu:
> I'm trying to subclass GnomeCanvas and defined my own signal, but for
> some my new signal is unrecognised.  This is (a reduced version of) my
> code:
> 
>   import pygtk
>   pygtk.require('2.0')
>   import gobject, gnome, gnome.canvas, gtk
>   
>   class SystemCanvas(gnome.canvas.Canvas):
>       __gsignals__ = {
>           'changed2' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
>                             (gobject.TYPE_STRING,)),
>           }
>       def __init__(self, aa=gtk.TRUE):
>           gnome.canvas.Canvas.__init__(self, aa=aa)
>           self.res = 1
>           print gobject.signal_list_names(SystemCanvas)
>           self.connect('changed2', self.void)
>           return
>       def void(self, canvas, arg1, data=None):
>           return gtk.FALSE
>   
>   gobject.type_register(SystemCanvas)
>   
>   if __name__ == "__main__":
>       s = SystemCanvas()
> 
> The error I get is:
> 
>   [EMAIL PROTECTED] src]$ python SystemCanvas2.py
>   ('changed2',)
>   Traceback (most recent call last):
>     File "SystemCanvas2.py", line 22, in ?
>       s = SystemCanvas()
>     File "SystemCanvas2.py", line 14, in __init__
>       self.connect('changed2', self.void)
>   TypeError: unknown signal name
>   [EMAIL PROTECTED] src]$
> 
> The signal is obviously registered, but for some reason I can neither
> connect to nor emit it.  Any ideas?

  Yes.  I am a bad gnome-python maintainer and forgot to migrate some
gnome-python classes to the new property-based constructors, which allow
transparent __init__ parent chaining.  gnome.Canvas is still using old
constructor system, therefore you must replace this:
          gnome.canvas.Canvas.__init__(self, aa=aa)
with this:
          self.__gobject_init__(aa=aa)
(or something like that)

  Regards.

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to