def _askOpen(_suffixes):
        if schematics:
            _suffixes.append("schematic")
            _suffixes.append("schematic.gz")
            _suffixes.append("zip")

            _suffixes.append("inv")

            # BO support
            _suffixes.append("bo2")
            _suffixes.append("bo3")

        if sys.platform == "win32":  #!#
            if suffixesChanged:
                sendSuffixes = _suffixes
            else:
                sendSuffixes = None
            return askOpenFileWin32(title, schematics, initialDir,
                                    sendSuffixes)

        elif hasGtk and not platChooser:  #!# #Linux (When GTK 2.4 or newer is installed)
            return askOpenFileGtk(title, _suffixes, initialDir)

        else:
            log.debug("Calling internal file chooser.")
            log.debug("'initialDir' is %s (%s)" %
                      (repr(initialDir), type(initialDir)))
            try:
                iDir = initialDir.encode(enc)
            except Exception, e:
                iDir = initialDir
                log.debug("Could not encode 'initialDir' %s" %
                          repr(initialDir))
                log.debug("Encode function returned: %s" % e)
            return request_old_filename(suffixes=_suffixes, directory=iDir)
Beispiel #2
0
    def _askOpen(_suffixes):
        if schematics:
            _suffixes.append("schematic")
            _suffixes.append("schematic.gz")
            _suffixes.append("zip")

            _suffixes.append("inv")

        if sys.platform == "win32":
            return askOpenFileWin32(title, schematics, initialDir)
        elif sys.platform == "darwin" and AppKit is not None:
            print "Open File"
            op = AppKit.NSOpenPanel.openPanel()
            op.setTitle_(title)
            op.setAllowedFileTypes_(_suffixes)
            op.setAllowsOtherFileTypes_(True)

            op.setDirectory_(initialDir)
            if op.runModal() == 0:
                return  # pressed cancel

            AppKit.NSApp.mainWindow().makeKeyWindow()

            return op.filename()

        elif hasGtk: #Linux (When GTK 2.4 or newer is installed)
            return askOpenFileGtk(title, _suffixes, initialDir)

        else:
            return request_old_filename(suffixes=_suffixes, directory=initialDir)
Beispiel #3
0
    def _askOpen():
        suffixes = ["mclevel", "dat", "mine", "mine.gz"]
        if schematics:
            suffixes.append("schematic")
            suffixes.append("schematic.gz")
            suffixes.append("zip")

            suffixes.append("inv")

        if sys.platform == "win32":
            return askOpenFileWin32(title, schematics, initialDir)
        elif sys.platform == "darwin" and AppKit is not None:
            print "Open File"
            op = AppKit.NSOpenPanel.openPanel()
            op.setTitle_(title)
            op.setAllowedFileTypes_(suffixes)
            op.setAllowsOtherFileTypes_(True)

            op.setDirectory_(initialDir)
            if op.runModal() == 0:
                return  # pressed cancel

            AppKit.NSApp.mainWindow().makeKeyWindow()

            return op.filename()

        else:  # linux
            return request_old_filename(suffixes=suffixes,
                                        directory=initialDir)
Beispiel #4
0
    def _askOpen():
        suffixes = ["mclevel", "dat", "mine", "mine.gz"]
        if schematics:
            suffixes.append("schematic")
            suffixes.append("schematic.gz")
            suffixes.append("zip")

            suffixes.append("inv")

        if sys.platform == "win32":
            return askOpenFileWin32(title, schematics, initialDir)
        elif sys.platform == "darwin" and AppKit is not None and not Lion():

            op = AppKit.NSOpenPanel.openPanel()
            op.setPrompt_(title)
            op.setAllowedFileTypes_(suffixes)
            op.setAllowsOtherFileTypes_(True)

            op.setDirectory_(initialDir)
            if op.runModal() == 0:
                return  # pressed cancel

            AppKit.NSApp.mainWindow().makeKeyWindow()

            return op.filename()

        else:  # linux

            return request_old_filename(suffixes=suffixes, directory=initialDir)
    def _askOpen(_suffixes):
        if schematics:
            _suffixes.append("schematic")
            _suffixes.append("schematic.gz")
            _suffixes.append("zip")

            _suffixes.append("inv")

            # BO support
            _suffixes.append("bo2")
            _suffixes.append("bo3")

        if sys.platform == "win32": #!#
            if suffixesChanged:
                sendSuffixes = _suffixes
            else:
                sendSuffixes = None
            return askOpenFileWin32(title, schematics, initialDir, sendSuffixes)

        elif hasGtk and not platChooser: #!# #Linux (When GTK 2.4 or newer is installed)
            return askOpenFileGtk(title, _suffixes, initialDir)

        else:
            log.debug("Calling internal file chooser.")
            log.debug("'initialDir' is %s (%s)"%(repr(initialDir), type(initialDir)))
            try:
                iDir = initialDir.encode(enc)
            except Exception, e:
                iDir = initialDir
                log.debug("Could not encode 'initialDir' %s"%repr(initialDir))
                log.debug("Encode function returned: %s"%e)
            return request_old_filename(suffixes=_suffixes, directory=iDir)
    def _askOpen():
        suffixes = ["mclevel", "dat", "mine", "mine.gz"]
        if schematics:
            suffixes.append("schematic")
            suffixes.append("schematic.gz")
            suffixes.append("zip")

            suffixes.append("inv")

        if sys.platform == "win32":
            return askOpenFileWin32(title, schematics, initialDir)
        elif sys.platform == "darwin" and AppKit is not None:
            print "Open File"
            op = AppKit.NSOpenPanel.openPanel()
            op.setTitle_(title)
            op.setAllowedFileTypes_(suffixes)
            op.setAllowsOtherFileTypes_(True)

            op.setDirectory_(initialDir)
            if op.runModal() == 0:
                return  # pressed cancel

            AppKit.NSApp.mainWindow().makeKeyWindow()

            return op.filename()

        elif hasGtk: #Linux (When GTK 2.4 or newer is installed)
            return askOpenFileGtk(title, suffixes, initialDir)

        else:
            return request_old_filename(suffixes=suffixes, directory=initialDir)
    def _askOpen(_suffixes):
        if schematics:
            _suffixes.append("schematic")
            _suffixes.append("schematic.gz")
            _suffixes.append("zip")

            _suffixes.append("inv")

        if sys.platform == "win32": #!#
            return askOpenFileWin32(title, schematics, initialDir)

        elif hasGtk and not platChooser: #!# #Linux (When GTK 2.4 or newer is installed)
            return askOpenFileGtk(title, _suffixes, initialDir)

        else:
            return request_old_filename(suffixes=_suffixes, directory=initialDir)
    def _askOpen(_suffixes):
        if schematics:
            _suffixes.append("schematic")
            _suffixes.append("schematic.gz")
            _suffixes.append("zip")

            _suffixes.append("inv")

        if sys.platform == "win32":  #!#
            return askOpenFileWin32(title, schematics, initialDir)

        elif hasGtk and not platChooser:  #!# #Linux (When GTK 2.4 or newer is installed)
            return askOpenFileGtk(title, _suffixes, initialDir)

        else:
            return request_old_filename(suffixes=_suffixes,
                                        directory=initialDir)