Esempio n. 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
Esempio n. 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)
Esempio n. 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
Esempio n. 4
0
File: window.py Progetto: pybee/toga
 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
Esempio n. 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)
Esempio n. 6
0
File: app.py Progetto: 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)
Esempio n. 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
Esempio n. 8
0
File: window.py Progetto: pybee/toga
 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