Added suppor for default OutputFile with templates and a policy on how to deal with file name conflicts.
This commit is contained in:
@@ -26,6 +26,7 @@ import FreeCAD
|
||||
import FreeCADGui
|
||||
from PySide import QtCore, QtGui
|
||||
from PathScripts.PathPostProcessor import PostProcessor
|
||||
from PathScripts.PathPost import CommandPathPost as PathPost
|
||||
|
||||
|
||||
class Page:
|
||||
@@ -46,6 +47,17 @@ class Page:
|
||||
blacklist.append(item.text())
|
||||
PostProcessor.saveDefaults(processor, args, blacklist)
|
||||
|
||||
path = str(self.form.leOutputFile.text())
|
||||
policy = str(self.form.cboOutputPolicy.currentText())
|
||||
PathPost.saveDefaults(path, policy)
|
||||
|
||||
def selectComboEntry(self, widget, text):
|
||||
index = widget.findText(text, QtCore.Qt.MatchFixedString)
|
||||
if index >= 0:
|
||||
widget.blockSignals(True)
|
||||
widget.setCurrentIndex(index)
|
||||
widget.blockSignals(False)
|
||||
|
||||
def loadSettings(self):
|
||||
self.form.defaultPostProcessor.addItem("")
|
||||
blacklist = PostProcessor.blacklist()
|
||||
@@ -58,18 +70,15 @@ class Page:
|
||||
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)
|
||||
|
||||
postindex = self.form.defaultPostProcessor.findText(PostProcessor.default(), QtCore.Qt.MatchFixedString)
|
||||
|
||||
if postindex >= 0:
|
||||
self.form.defaultPostProcessor.blockSignals(True)
|
||||
self.form.defaultPostProcessor.setCurrentIndex(postindex)
|
||||
self.form.defaultPostProcessor.blockSignals(False)
|
||||
self.selectComboEntry(self.form.defaultPostProcessor, PostProcessor.default())
|
||||
|
||||
self.form.defaultPostProcessorArgs.setText(PostProcessor.defaultArgs())
|
||||
self.form.leOutputFile.setText(PathPost.defaultOutputFile())
|
||||
self.selectComboEntry(self.form.cboOutputPolicy, PathPost.defaultOutputPolicy())
|
||||
|
||||
self.form.postProcessorList.itemEntered.connect(self.setProcessorListTooltip)
|
||||
self.form.defaultPostProcessor.currentIndexChanged.connect(self.updateDefaultPostProcessorToolTip)
|
||||
self.form.browseFileSystem.clicked.connect(self.browseFileSystem)
|
||||
|
||||
def getPostProcessor(self, name):
|
||||
if not name in self.processor.keys():
|
||||
@@ -100,3 +109,8 @@ class Page:
|
||||
else:
|
||||
self.form.defaultPostProcessor.setToolTip(self.postProcessorDefaultTooltip)
|
||||
self.form.defaultPostProcessorArgs.setToolTip(self.postProcessorArgsDefaultTooltip)
|
||||
|
||||
def browseFileSystem(self):
|
||||
foo = QtGui.QFileDialog.getExistingDirectory(QtGui.qApp.activeWindow(), "Path - Output File/Directory", self.form.defaultOutputPath.text())
|
||||
if foo:
|
||||
self.form.defaultOutputPath.setText(foo)
|
||||
|
||||
Reference in New Issue
Block a user