def make_array(self, contents=None): a = NSMutableArray.alloc().init() if contents is not None: for value in contents: a.addObject(value) return a
def make_array(self, contents=None): a = NSMutableArray.alloc().init() if contents is not None: for value in contents: a.addObject(value) return NSArray.arrayWithArray(a)
def toolbarAllowedItemIdentifiers_(self, toolbar): "Determine the list of available toolbar items" # This method is required by the Cocoa API, but isn't actually invoked, # because customizable toolbars are no longer a thing. allowed = NSMutableArray.alloc().init() for item in self.interface.toolbar: allowed.addObject_(toolbar_identifier(item)) return allowed
def toolbarAllowedItemIdentifiers_(self, toolbar): "Determine the list of available toolbar items" # This method is required by the Cocoa API, but isn't actually invoked, # because customizable toolbars are no longer a thing. allowed = NSMutableArray.alloc().init() for item in self.interface.toolbar: allowed.addObject_(toolbar_identifier(item)) return allowed
def select_file(self, **kwargs): # FIXME This should be all we need; but for some reason, application types # aren't being registered correctly.. # NSDocumentController.sharedDocumentController().openDocument_(None) # ...so we do this instead. panel = NSOpenPanel.openPanel() # print("Open documents of type", NSDocumentController.sharedDocumentController().defaultType) fileTypes = NSMutableArray.alloc().init() for filetype in self.interface.document_types: fileTypes.addObject(filetype) NSDocumentController.sharedDocumentController.runModalOpenPanel(panel, forTypes=fileTypes) # print("Untitled File opened?", panel.URLs) self.appDelegate.application_openFiles_(None, panel.URLs)
def select_file(self, **kwargs): # FIXME This should be all we need; but for some reason, application types # aren't being registered correctly.. # NSDocumentController.sharedDocumentController().openDocument_(None) # ...so we do this instead. panel = NSOpenPanel.openPanel() # print("Open documents of type", NSDocumentController.sharedDocumentController().defaultType) fileTypes = NSMutableArray.alloc().init() for filetype in self.interface.document_types: fileTypes.addObject(filetype) NSDocumentController.sharedDocumentController.runModalOpenPanel(panel, forTypes=fileTypes) # print("Untitled File opened?", panel.URLs) self.appDelegate.application_openFiles_(None, panel.URLs)
def toolbarDefaultItemIdentifiers_(self, toolbar): "Determine the list of toolbar items that will display by default" default = NSMutableArray.alloc().init() for item in self.interface.toolbar: default.addObject_(toolbar_identifier(item)) return default
def toolbarDefaultItemIdentifiers_(self, toolbar): "Determine the list of toolbar items that will display by default" default = NSMutableArray.alloc().init() for item in self.interface.toolbar: default.addObject_(toolbar_identifier(item)) return default