diff --git a/src/Mod/Path/Gui/Resources/panels/JobEdit.ui b/src/Mod/Path/Gui/Resources/panels/JobEdit.ui
index 8184d3b1e01c..64ab814cd1ba 100644
--- a/src/Mod/Path/Gui/Resources/panels/JobEdit.ui
+++ b/src/Mod/Path/Gui/Resources/panels/JobEdit.ui
@@ -145,8 +145,8 @@
0
0
- 378
- 391
+ 353
+ 173
@@ -215,8 +215,8 @@
0
0
- 424
- 376
+ 378
+ 391
@@ -263,51 +263,6 @@
- -
-
-
- File Save Policy
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- <html><head/><body><p>Choose how to deal with potential file name conflicts. Always open a dialog, only open a dialog if the output file already exists, overwrite any existing file or add a unique (3 digit) sequential ID to the file name.</p></body></html>
-
-
-
-
-
-
-
- -
-
- Open File Dialog
-
-
- -
-
- Open File Dialog on conflict
-
-
- -
-
- Overwrite existing file
-
-
- -
-
- Append Unique ID on conflict
-
-
-
-
diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py
index 9bb5458e09d8..ca84dfcf61de 100644
--- a/src/Mod/Path/PathScripts/PathJob.py
+++ b/src/Mod/Path/PathScripts/PathJob.py
@@ -48,31 +48,20 @@ def translate(context, text, disambig=None):
def translate(context, text, disambig=None):
return QtGui.QApplication.translate(context, text, disambig)
-class OutputPolicy:
- Default = ''
- Dialog = 'Open File Dialog'
- DialogOnConflict = 'Open File Dialog on conflict'
- Overwrite = 'Overwrite existing file'
- AppendID = 'Append Unique ID on conflict'
- All = [Default, Dialog, DialogOnConflict, Overwrite, AppendID]
-
class ObjectPathJob:
def __init__(self, obj):
# obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this project")
obj.addProperty("App::PropertyFile", "OutputFile", "CodeOutput", QtCore.QT_TRANSLATE_NOOP("App::Property","The NC output file for this project"))
- obj.OutputFile = ''
+ obj.OutputFile = PathPreferences.defaultOutputFile()
obj.setEditorMode("OutputFile", 0) # set to default mode
- obj.addProperty("App::PropertyEnumeration", "OutputPolicy", "CodeOutput", QtCore.QT_TRANSLATE_NOOP("App::Property","The policy on how to save output files and resolve name conflicts"))
- obj.OutputPolicy = OutputPolicy.All
- obj.OutputPolicy = OutputPolicy.Default
obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property","An optional description for this job"))
obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Select the Post Processor"))
obj.PostProcessor = PathPreferences.allEnabledPostProcessors([''])
- obj.PostProcessor = ''
+ obj.PostProcessor = PathPreferences.defaultPostProcessor()
obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property", "Arguments for the Post Processor (specific to the script)"))
- obj.PostProcessorArgs = ''
+ obj.PostProcessorArgs = PathPreferences.defaultPostProcessorArgs()
obj.addProperty("App::PropertyString", "MachineName", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Name of the Machine that will use the CNC program"))
obj.addProperty("Path::PropertyTooltable", "Tooltable", "Base", QtCore.QT_TRANSLATE_NOOP("App::Property","The tooltable used for this CNC program"))
@@ -270,16 +259,10 @@ def updateTooltips(self):
def getFields(self):
'''sets properties in the object to match the form'''
if self.obj:
- if hasattr(self.obj, "PostProcessor"):
- self.obj.PostProcessor = str(self.form.cboPostProcessor.currentText())
- if hasattr(self.obj, "PostProcessorArgs"):
- self.obj.PostProcessorArgs = str(self.form.cboPostProcessorArgs.displayText())
- if hasattr(self.obj, "Label"):
- self.obj.Label = str(self.form.leLabel.text())
- if hasattr(self.obj, "OutputFile"):
- self.obj.OutputFile = str(self.form.leOutputFile.text())
- if hasattr(self.obj, "OutputPolicy"):
- self.obj.OutputPolicy = str(self.form.cboOutputPolicy.currentText())
+ self.obj.PostProcessor = str(self.form.cboPostProcessor.currentText())
+ self.obj.PostProcessorArgs = str(self.form.cboPostProcessorArgs.displayText())
+ self.obj.Label = str(self.form.leLabel.text())
+ self.obj.OutputFile = str(self.form.leOutputFile.text())
oldlist = self.obj.Group
newlist = []
@@ -313,7 +296,6 @@ def setFields(self):
self.form.leLabel.setText(self.obj.Label)
self.form.leOutputFile.setText(self.obj.OutputFile)
- self.selectComboBoxText(self.form.cboOutputPolicy, self.obj.OutputPolicy)
self.selectComboBoxText(self.form.cboPostProcessor, self.obj.PostProcessor)
self.obj.Proxy.onChanged(self.obj, "PostProcessor")
@@ -347,7 +329,6 @@ def setupUi(self):
# Connect Signals and Slots
self.form.cboPostProcessor.currentIndexChanged.connect(self.getFields)
self.form.leOutputFile.editingFinished.connect(self.getFields)
- self.form.cboOutputPolicy.currentIndexChanged.connect(self.getFields)
self.form.leLabel.editingFinished.connect(self.getFields)
self.form.btnSelectFile.clicked.connect(self.setFile)
self.form.PathsList.indexesMoved.connect(self.getFields)
diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py
index 6faf8bf714eb..9b7cd71fdb98 100644
--- a/src/Mod/Path/PathScripts/PathPost.py
+++ b/src/Mod/Path/PathScripts/PathPost.py
@@ -45,20 +45,22 @@ class DlgSelectPostProcessor:
def __init__(self, parent=None):
self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgSelectPostProcessor.ui")
+ firstItem = None
for post in PathPreferences.allEnabledPostProcessors():
item = QtGui.QListWidgetItem(post)
item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
self.dialog.lwPostProcessor.addItem(item)
+ if not firstItem:
+ firstItem = item
+ if firstItem:
+ self.dialog.lwPostProcessor.setCurrentItem(firstItem)
+ else:
+ self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
self.tooltips = {}
- self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
self.dialog.lwPostProcessor.itemDoubleClicked.connect(self.dialog.accept)
- self.dialog.lwPostProcessor.itemSelectionChanged.connect(self.enableOkButton)
self.dialog.lwPostProcessor.setMouseTracking(True)
self.dialog.lwPostProcessor.itemEntered.connect(self.updateTooltip)
- def enableOkButton(self):
- self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
-
def updateTooltip(self, item):
if item.text() in self.tooltips.keys():
tooltip = self.tooltips[item.text()]
@@ -104,9 +106,7 @@ def resolveFileName(self, job):
M = pref.GetString("MacroPath", FreeCAD.getUserAppDataDir())
filename = filename.replace('%M', M)
- policy = job.OutputPolicy
- if not policy or policy == '':
- policy = PathPreferences.defaultOutputPolicy()
+ policy = PathPreferences.defaultOutputPolicy()
openDialog = policy == 'Open File Dialog'
if os.path.isdir(filename) or not os.path.isdir(os.path.dirname(filename)):