Improved default behaviour and removed output-policy from job settings.

This commit is contained in:
Markus Lampert
2016-10-27 17:48:29 -07:00
committed by wmayer
parent 33ca2275e7
commit 4b67af15fe
3 changed files with 19 additions and 83 deletions

View File

@@ -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 @@ class CommandPathPost:
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)):