Re: [Pyobjc-dev] NibLoader.py: parsing nibs at runtime
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2002-11-16 22:19:54
|
bb...@ma... wrote: [ great explanation snipped ] > For Outlets, the connection process simply sets the instance variable > directly, if possible. However, before doing so, it checks to see if > the object contains the method setOutletName: and, if so, calls that > method instead, passing the object that it will be connected to as the > first argument (i.e. if ExampleObject implemented -setRandomObject: it > would be called instead of just making a direct connection). Ok, so the _runtime_ will add instance variables? > Hope that helps (and looking at NibLoader, I'm not at all certain how > the outlets are working... but they do seem to be working fine!)... Have a look at this snippet from Todo's nibwrapper.py: class ToDoDocumentBase (NSDocument): "Base class for class 'ToDoDocument'" calendar = IBOutlet("calendar") itemList = IBOutlet("itemList") dayLabel = IBOutlet("dayLabel") statusList = IBOutlet("statusList") The outlets are class attributes, and will be shared by all instances. Whether this is correct or not, it is exactly what NibLoader.py mimics. Do I understand correctly that these (Python) class attributes are more or less "declarations" for the (Cocoa) runtime? Just PS: should we rename NibLoader.py to something more appropriate, too? |