def GetToolFiles(parent = None): if parent is None: parent = QtGui.QApplication.activeWindow() foo = QtGui.QFileDialog.getOpenFileNames(parent, 'Tool', PathPreferences.lastPathToolBit(), '*.fctb') if foo and foo[0]: PathPreferences.setLastPathToolBit(os.path.dirname(foo[0][0])) return foo[0] return []
def GetNewToolFile(parent=None): if parent is None: parent = QtGui.QApplication.activeWindow() foo = QtGui.QFileDialog.getSaveFileName(parent, 'Tool', PathPreferences.lastPathToolBit(), '*.fctb') if foo and foo[0]: if not isValidFileName(foo[0]): msgBox = QtGui.QMessageBox() msg = translate("Path", "Invalid Filename", None) msgBox.setText(msg) msgBox.exec_() else: PathPreferences.setLastPathToolBit(os.path.dirname(foo[0])) return foo[0] return None