Re: [Pyobjc-dev] UI bindings no longer work for me
Brought to you by:
ronaldoussoren
From: Jason F. <ja...@th...> - 2009-09-01 04:50:15
|
On Aug 31, 2009, at 10:12 PM, Mani Ghasemlou wrote: > I have an NSImageView, whose Hidden state is bound to a variable of my > app delegate. Clicking the "Show" button sets this value to False, and > "Hide" sets this value to True. > > Using Snow Leopard, the NSImageView's Hidden state does not change > when clicking these buttons. Using Leopard, the image shows and hides > itself depending on the button pressed. > > Can someone help me understand what I might be doing wrong? I'm sure someone with more PyObjC experience can give you a better answer, but here's my findings: There seems to be an issue with the way you initialize your app delegate and KVC/KVO. If you change your calls like "self.hideComputer = False" to "self.setValue_forKey_(False, 'hideComputer')" it starts working. Similarly, you can override the app delegate's init method, and this seems to setup KVC correctly for the hideComputer field: class BindingsUITestAppDelegate(NSObject): # hideComputer = ivar('hideComputer') def init(self): self.hideComputer = False return self .... etc I don't have any idea why this is, and am anxious myself to hear an explanation from the gurus. But in the meantime this might be a suitable workaround for you. Jason |