[PEAK] Trellis-ified wx Dialog

Phillip J. Eby pje at telecommunity.com
Thu Jul 19 17:09:55 EDT 2007

At 01:37 PM 7/19/2007 -0700, Grant Baillie wrote:

>On 19 Jul, 2007, at 13:05, Phillip J. Eby wrote:
>>At 12:46 PM 7/19/2007 -0700, Grant Baillie wrote:
>>>On 19 Jul, 2007, at 11:55, Phillip J. Eby wrote:
>>>>By the way, another way to do the above would be:
>>>>     class EditBridge(trellis.Component):
>>>>         trellis.values(
>>>>             widget = None,
>>>>             cell = None,
>>>>         )
>>>>         trellis.rules(
>>>>             setup = lambda self: self.widget.Bind
>>>>(wx.EVT_KILL_FOCUS, self.write),
>>>>             read = lambda self: self.widget.SetValue(self.cell),
>>>>         )
>>>>         def write(self, event):
>>>>             self.cell = self.widget.GetValue()
>>>Hmmm ... if I do that, then the read rule gets called with a widget
>>>of None.
>>Eh?  That shouldn't be possible -- isn't the code passing in a
>>widget in the kwargs to EditBridge?  The setting of 'widget' should
>>be happening before *any* rules are called.  Can you check to make
>>sure that you are passing a non-None widget to EditBridge()?
>I am, but it looks as if the read rule is called before widget is
> > 
> /Users/grant/work/chandler-1.0/samples/wxTemp/wxTemperature.py(29) __init__()
>-> super(EditBridge, self).__init__(*args, **kw)

That's the problem right there: my 2nd draft of EditBridge didn't 
*have* an __init__() method; getting rid of it was in fact the point 
of the 2nd draft.  See the code quoted above - no __init__ method is there.

More information about the PEAK mailing list