Beispiel #1
0
    def _fileDialog(self, message = None):
        
        panel = NSOpenPanel.openPanel()
        panel.setCanCreateDirectories_(False)
        panel.setCanChooseDirectories_(False)
        panel.setCanChooseFiles_(True)
        panel.setAllowsMultipleSelection_(True)

        if panel.runModal() == NSOKButton:
            for item in panel.URLs():
                print item
        return panel.URLs()
Beispiel #2
0
    def openYaybufile_(self, notification):
        panel = NSOpenPanel.openPanel()
        panel.setAllowsMultipleSelection_(False)
        panel.setCanCreateDirectories_(False)
        panel.setCanChooseDirectories_(False)
        panel.setCanChooseFiles_(True)

        yaybufile = None
        while not yaybufile or os.path.basename(yaybufile) != "Yaybufile":
            if panel.runModal() != NSOKButton:
                return
            yaybufile = panel.filename()

        self.application_openFile_(None, yaybufile)
Beispiel #3
0
def get_directory_dialog():
    """
    Cocoa Open Directory Dialog box
    :return:
    """
    panel = NSOpenPanel.openPanel()
    panel.setCanCreateDirectories_(True)
    panel.setCanChooseDirectories_(True)
    panel.setCanChooseFiles_(False)

    app = NSRunningApplication.runningApplicationWithProcessIdentifier_(os.getpid())
    app.activateWithOptions_(NSApplicationActivateIgnoringOtherApps)

    if panel.runModal() == NSOKButton:
        return panel.directory()
    else:
        return None
Beispiel #4
0
 def __init__(self):
     self.panel = NSOpenPanel.openPanel()
     self.panel.setCanCreateDirectories_(True)
     self.panel.setCanChooseDirectories_(True)
     self.panel.setCanChooseFiles_(True)