Пример #1
0
    def make_array(self, contents=None):
        a = NSMutableArray.alloc().init()
        if contents is not None:
            for value in contents:
                a.addObject(value)

        return a
Пример #2
0
    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)
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
    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)
Пример #6
0
Файл: app.py Проект: pybee/toga
    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)
Пример #7
0
 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
Пример #8
0
 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