Ejemplo 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
Ejemplo 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)
Ejemplo 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
Ejemplo n.º 4
0
Archivo: window.py Proyecto: 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
Ejemplo 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)
Ejemplo n.º 6
0
Archivo: app.py Proyecto: 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)
Ejemplo 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
Ejemplo n.º 8
0
Archivo: window.py Proyecto: 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