[Pyobjc-dev] NSBundle doesn't set attributes with loadNibNamed_owner_
Brought to you by:
ronaldoussoren
From: Frederik De B. <fre...@pa...> - 2004-01-22 14:51:52
|
Hi, I wanted to add some additional options to the save panel in PyObjC. I discovered that I should use setAccessoryView_ on a NSSavePanel. The TextEdit sources show how to do that: you load an NSBundle, and then set a certain box to the accessorryView of the save panel. The file's owner of the NIB is changed to my own subclass of NSDocument, and I added two additionational outlets: pageCount (an NSTextField) and pageCountAccessory (an NSBox). The problem I have is that NSBundle.loadNibNamed_owner_ doesn't seem to set the attributes I defined on the file's owner ("self"). Therefore, I'm not able to access any of the outlets. Here's the code. Python gives an error the moment I try to access self.pageCount ("object has no attribute pageCount") def saveMultipleDocumentsAsPDF_(self): savePanel = NSSavePanel.savePanel() if not NSBundle.loadNibNamed_owner_("PageCounterAccessory", self): NSLog("Error -- could not load PageCounterAccessory.") self.pageCount.setIntValue_(1) savePanel.setAccessoryView_(self.pageCountAccessory) Any help on how this problem might be solved is appreciated. Regards, Frederik De Bleser <fre...@pa...> |