Can't override event handler in class derived from ItemSimple

Bug #85588 reported by Dominique Würtz
2
Affects Status Importance Assigned to Milestone
pygoocanvas
Invalid
Undecided
Unassigned

Bug Description

I'm currently working on a custom goocanvas.SimpleItem in Python:

class MyItem(goocanvas.SimpleItem):

 def do_update(...):
  ...

 ...

 def do_button_press_event(self, target, event):
  print "Hello!"

The problem is that my overridden do_button_press_event() never gets
called. I tried modifying the class declaration like this

class MyItem(goocanvas.SimpleItem, goocanvas.Item):
 ...

but then the do_update() of SimpleItem gets replaced by the one of
goocanvas.Item. Changing the order of the two base classes in the
declaration results in some method resolution conflict.

Revision history for this message
Dominique Würtz (housirer) wrote :

Here is a python script which demonstrates the problem.

Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote :

modify your class like this and it will work

class MyItem(goocanvas.ItemSimple):

   __gsignals__ = {'button-press-event' : 'override'}

Changed in pygoocanvas:
status: Unconfirmed → Rejected
Revision history for this message
Gustavo Carneiro (gjc) wrote :

"class MyItem(goocanvas.SimpleItem, goocanvas.Item)" also works (I tried), instead of signal overriding.

It didn't work for you either because of the conflict between different virtuals with the same name in goocanvas.Item and goocanvas.ItemSimple, which was just resolved, or else you have a too old PyGObject version.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.