Code review comment for lp:~mcfletch/simplegc/suggestions

Revision history for this message
Sam Bull (dreamsorcerer) wrote :

Yes, so I'm suggesting moving some of that code into the widget. So, something like:

class Simple(object):
  def __setattr__(self, atr, val):
    if atr.startswith("on_"):
      val = lambda: val(self)
    object.__setattr__(self, atr, val)

That should work in making sure callbacks get the widget passed in. Then something slightly more complex might be needed to get the EventSlot thing working in a similar way.

This means in your 'helloworldeventcallback.py' experiment, you would receive the widget as an argument in new() with no code change, solving the issue of not being able to access event properties.

« Back to merge proposal