python - Problem With openPanelDidEnd in PyObjC in 10.6 -


The following code, which works fine under OS X 10.5, has failed on 10.6:

 < Code> @ IBAction def addButton_ (self, sender): panel = NSOpenPanel.openPanel () panel.setCanChooseDirectories_ (yes) try panel.setAllowsMultipleSelection_ (yes): panel.beginSheetForDirectory_file_modalForWindow_modalDelegate_didEndSelector_contextInfo_ (self.directory, none, NSApp (). MainWindow Exclude: AppHelper.endSheetMethod def openPanelDidEnd_panel_returnCode_contextInfo_ (auto, panel, returnCode, contextInfo) except: (), itself, 'OpenPanelDidEnd: panel: returnCode: contextInfo:', none):  

The error is found:

  Objc.BadPrototypeError: Python Signature with the objective-sign sign & lt; Unbound selector openPanelDidEnd: panel: returnCode: contextInfo: 0x6166a70 at the controller's & gt;    

beginSheetFor directory: file: modalForWindow: modalDelegate: didEndSelector: contextInfo: demoted to 10.6 :

There is no blog signing for PyObjC to start with the same problemsetModelForward: Full handler: and you can only use the RunModel

My solutions:

  panel = NSOpenPanel.openPanel () panel.setCanChooseDirectories_ (NO) panel.setAllowsMultipleSelection_ (NO) panel.setAllowedFileTypes_ (self.filetypes) panel.setDirectoryURL_ (os.getcwd ()) Ret = panel.runModal () if rate: Rint panel URL ()  

panel. URL () gives user selection.


Comments