def loadSettings(self): self.form.leDefaultFilePath.setText(PathPreferences.defaultFilePath()) self.form.leDefaultJobTemplate.setText(PathPreferences.defaultJobTemplate()) blacklist = PathPreferences.postProcessorBlacklist() for processor in PathPreferences.allAvailablePostProcessors(): item = QtGui.QListWidgetItem(processor) if processor in blacklist: item.setCheckState(QtCore.Qt.CheckState.Unchecked) else: item.setCheckState(QtCore.Qt.CheckState.Checked) item.setFlags( QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsUserCheckable) self.form.postProcessorList.addItem(item) self.verifyAndUpdateDefaultPostProcessorWith(PathPreferences.defaultPostProcessor()) self.form.defaultPostProcessorArgs.setText(PathPreferences.defaultPostProcessorArgs()) geomTol = Units.Quantity(PathPreferences.defaultGeometryTolerance(), Units.Length) self.form.geometryTolerance.setText(geomTol.UserString) self.form.leOutputFile.setText(PathPreferences.defaultOutputFile()) self.selectComboEntry(self.form.cboOutputPolicy, PathPreferences.defaultOutputPolicy()) self.form.tbDefaultFilePath.clicked.connect(self.browseDefaultFilePath) self.form.tbDefaultJobTemplate.clicked.connect(self.browseDefaultJobTemplate) self.form.postProcessorList.itemEntered.connect(self.setProcessorListTooltip) self.form.postProcessorList.itemChanged.connect(self.verifyAndUpdateDefaultPostProcessor) self.form.defaultPostProcessor.currentIndexChanged.connect(self.updateDefaultPostProcessorToolTip) self.form.tbOutputFile.clicked.connect(self.browseOutputFile) self.loadStockSettings()
def loadSettings(self): self.form.leDefaultFilePath.setText(PathPreferences.defaultFilePath()) self.form.leDefaultJobTemplate.setText(PathPreferences.defaultJobTemplate()) blacklist = PathPreferences.postProcessorBlacklist() for processor in PathPreferences.allAvailablePostProcessors(): item = QtGui.QListWidgetItem(processor) if processor in blacklist: item.setCheckState(QtCore.Qt.CheckState.Unchecked) else: item.setCheckState(QtCore.Qt.CheckState.Checked) item.setFlags( QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsUserCheckable) self.form.postProcessorList.addItem(item) self.verifyAndUpdateDefaultPostProcessorWith(PathPreferences.defaultPostProcessor()) self.form.defaultPostProcessorArgs.setText(PathPreferences.defaultPostProcessorArgs()) geomTol = Units.Quantity(PathPreferences.defaultGeometryTolerance(), Units.Length) self.form.geometryTolerance.setText(geomTol.UserString) self.form.curveAccuracy.setText(Units.Quantity(PathPreferences.defaultLibAreaCurveAccuracy(), Units.Length).UserString) self.form.leOutputFile.setText(PathPreferences.defaultOutputFile()) self.selectComboEntry(self.form.cboOutputPolicy, PathPreferences.defaultOutputPolicy()) self.form.tbDefaultFilePath.clicked.connect(self.browseDefaultFilePath) self.form.tbDefaultJobTemplate.clicked.connect(self.browseDefaultJobTemplate) self.form.postProcessorList.itemEntered.connect(self.setProcessorListTooltip) self.form.postProcessorList.itemChanged.connect(self.verifyAndUpdateDefaultPostProcessor) self.form.defaultPostProcessor.currentIndexChanged.connect(self.updateDefaultPostProcessorToolTip) self.form.tbOutputFile.clicked.connect(self.browseOutputFile) self.loadStockSettings()
def __init__(self, parent=None): self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgJobCreate.ui") sel = FreeCADGui.Selection.getSelection() if sel: selected = sel[0].Label else: selected = None index = 0 for base in PathJob.ObjectJob.baseCandidates(): if base.Label == selected: index = self.dialog.cbModel.count() self.dialog.cbModel.addItem(base.Label) self.dialog.cbModel.setCurrentIndex(index) templateFiles = [] for path in PathPreferences.searchPaths(): templateFiles.extend(self.templateFilesIn(path)) template = {} for tFile in templateFiles: name = os.path.split(os.path.splitext(tFile)[0])[1][4:] if name in template: basename = name i = 0 while name in template: i = i + 1 name = basename + " (%s)" % i PathLog.track(name, tFile) template[name] = tFile selectTemplate = PathPreferences.defaultJobTemplate() index = 0 self.dialog.cbTemplate.addItem('<none>', '') for name in sorted(template.keys()): if template[name] == selectTemplate: index = self.dialog.cbTemplate.count() self.dialog.cbTemplate.addItem(name, template[name]) self.dialog.cbTemplate.setCurrentIndex(index)