def selectShape(self): path = self.tool.BitShape if not path: path = PathPreferences.lastPathToolShape() foo = QtGui.QFileDialog.getOpenFileName(self.form, "Path - Tool Shape", path, "*.fcstd") if foo and foo[0]: PathPreferences.setLastPathToolShape(os.path.dirname(foo[0])) self.form.shapePath.setText(foo[0]) self.updateShape()
def GetToolShapeFile(parent=None): if parent is None: parent = QtGui.QApplication.activeWindow() location = PathPreferences.lastPathToolShape() if os.path.isfile(location): location = os.path.split(location)[0] elif not os.path.isdir(location): location = PathPreferences.filePath() fname = QtGui.QFileDialog.getOpenFileName(parent, 'Select Tool Shape', location, '*.fcstd') if fname and fname[0]: if fname != location: PathPreferences.setLastPathToolShape(location) return fname[0] else: return None