From c6b9adec25a13f769013df5bd57326bba69e7632 Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Thu, 9 Apr 2020 15:53:30 -0500 Subject: [PATCH] Path: GUI improvement - swap setEnabled() for show() and hide() Improve GUI usability by using hide() and show(). Apply hide() and show() to labels as well. Fix visibility update issue on loading task window for editing of existing operation. --- src/Mod/Path/PathScripts/PathSurfaceGui.py | 34 +++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathSurfaceGui.py b/src/Mod/Path/PathScripts/PathSurfaceGui.py index 41f11f6007..7ff1342360 100644 --- a/src/Mod/Path/PathScripts/PathSurfaceGui.py +++ b/src/Mod/Path/PathScripts/PathSurfaceGui.py @@ -41,7 +41,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def initPage(self, obj): self.setTitle("3D Surface") - self.updateVisibility() + # self.updateVisibility() def getForm(self): '''getForm() ... returns UI''' @@ -118,6 +118,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): else: self.form.optimizeStepOverTransitions.setCheckState(QtCore.Qt.Unchecked) + self.updateVisibility() + def getSignalsForUpdate(self, obj): '''getSignalsForUpdate(obj) ... return list of signals for updating obj''' signals = [] @@ -140,16 +142,26 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): return signals def updateVisibility(self): - if self.form.scanType.currentText() == "Planar": - self.form.cutPattern.setEnabled(True) - self.form.boundBoxExtraOffsetX.setEnabled(False) - self.form.boundBoxExtraOffsetY.setEnabled(False) - self.form.dropCutterDirSelect.setEnabled(False) - else: - self.form.cutPattern.setEnabled(False) - self.form.boundBoxExtraOffsetX.setEnabled(True) - self.form.boundBoxExtraOffsetY.setEnabled(True) - self.form.dropCutterDirSelect.setEnabled(True) + if self.form.scanType.currentText() == 'Planar': + self.form.cutPattern.show() + self.form.cutPattern_label.show() + self.form.optimizeStepOverTransitions.show() + + self.form.boundBoxExtraOffsetX.hide() + self.form.boundBoxExtraOffsetY.hide() + self.form.boundBoxExtraOffset_label.hide() + self.form.dropCutterDirSelect.hide() + self.form.dropCutterDirSelect_label.hide() + elif self.form.scanType.currentText() == 'Rotational': + self.form.cutPattern.hide() + self.form.cutPattern_label.hide() + self.form.optimizeStepOverTransitions.hide() + + self.form.boundBoxExtraOffsetX.show() + self.form.boundBoxExtraOffsetY.show() + self.form.boundBoxExtraOffset_label.show() + self.form.dropCutterDirSelect.show() + self.form.dropCutterDirSelect_label.show() def registerSignalHandlers(self, obj): self.form.scanType.currentIndexChanged.connect(self.updateVisibility)