From ff54af4e9b55073864ea0b60b5df3da184910fa1 Mon Sep 17 00:00:00 2001 From: markus Date: Thu, 30 Aug 2018 11:50:39 -0700 Subject: [PATCH] Redesigned ops defaults to use combo box for op selection and only have one editor visibile at the time. --- src/Mod/Path/Gui/Resources/panels/PathEdit.ui | 11 +++++--- src/Mod/Path/PathScripts/PathJobGui.py | 2 +- src/Mod/Path/PathScripts/PathSetupSheetGui.py | 26 ++++++++++++++----- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/panels/PathEdit.ui b/src/Mod/Path/Gui/Resources/panels/PathEdit.ui index 19f4482cd5..cb2ca81a9b 100644 --- a/src/Mod/Path/Gui/Resources/panels/PathEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/PathEdit.ui @@ -31,8 +31,8 @@ 0 0 - 412 - 549 + 410 + 572 @@ -949,7 +949,11 @@ Op Defaults - + + + + + @@ -972,6 +976,7 @@ postProcessorSetOutputFile postProcessor postProcessorArguments + stock stockExisting stockExtXneg stockExtXpos diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index 2d03e731ab..30424126e1 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -491,7 +491,7 @@ class TaskPanel: self.stockEdit = None self.setupGlobal = PathSetupSheetGui.GlobalEditor(self.obj.SetupSheet, self.form) - self.setupOps = PathSetupSheetGui.OpsDefaultEditor(self.obj.SetupSheet, self.form.tabOpDefaults) + self.setupOps = PathSetupSheetGui.OpsDefaultEditor(self.obj.SetupSheet, self.form) def preCleanup(self): PathLog.track() diff --git a/src/Mod/Path/PathScripts/PathSetupSheetGui.py b/src/Mod/Path/PathScripts/PathSetupSheetGui.py index 7cda923cdc..7e20d80059 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheetGui.py +++ b/src/Mod/Path/PathScripts/PathSetupSheetGui.py @@ -202,15 +202,18 @@ class OpTaskPanel: class OpsDefaultEditor: - def __init__(self, obj, parent): + def __init__(self, obj, form): + self.form = form self.obj = obj self.ops = sorted([OpTaskPanel(self.obj, name, op) for name, op in PathUtil.keyValueIter(PathSetupSheet._RegisteredOps)], key = lambda op: op.name) - if parent: - self.toolbox = QtGui.QToolBox(parent) + if form: + parent = form.tabOpDefaults for op in self.ops: - self.toolbox.addItem(op.form, op.form.windowTitle()) - self.toolbox.setParent(parent) - parent.layout().addWidget(self.toolbox) + form.opDefaultOp.addItem(op.form.windowTitle(), op) + op.form.setParent(parent) + parent.layout().addWidget(op.form) + op.form.hide() + self.currentOp = None def reject(self): pass @@ -227,7 +230,14 @@ class OpsDefaultEditor: pass def updateUI(self): - pass + if self.currentOp: + self.currentOp.form.hide() + self.currentOp = None + current = self.form.opDefaultOp.currentIndex() + if current < 0: + current = 0 + self.currentOp = self.form.opDefaultOp.itemData(current) + self.currentOp.form.show() def updateModel(self, recomp = True): PathLog.track() @@ -242,6 +252,8 @@ class OpsDefaultEditor: def setupUi(self): for op in self.ops: op.setupUi() + self.updateUI() + self.form.opDefaultOp.currentIndexChanged.connect(self.updateUI) class GlobalEditor(object):