From 27ab0b8f326b85b204ac954572c51e713ab5d2fe Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Thu, 18 Jun 2020 20:13:41 -0500 Subject: [PATCH] Path: Format and add DocStrings and comments --- src/Mod/Path/PathScripts/PathOpGui.py | 30 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py index 0b695b667899..8ff48ade2dad 100644 --- a/src/Mod/Path/PathScripts/PathOpGui.py +++ b/src/Mod/Path/PathScripts/PathOpGui.py @@ -342,14 +342,16 @@ def updateData(self, obj, prop): pass # pylint: disable=unnecessary-pass def updateSelection(self, obj, sel): - '''updateSelection(obj, sel) ... overwrite to customize UI depending on current selection. + '''updateSelection(obj, sel) ... + overwrite to customize UI depending on current selection. Can safely be overwritten by subclasses.''' # pylint: disable=unused-argument pass # pylint: disable=unnecessary-pass # helpers def selectInComboBox(self, name, combo): - '''selectInComboBox(name, combo) ... helper function to select a specific value in a combo box.''' + '''selectInComboBox(name, combo) ... + helper function to select a specific value in a combo box.''' index = combo.findText(name, QtCore.Qt.MatchFixedString) if index >= 0: combo.blockSignals(True) @@ -357,7 +359,9 @@ def selectInComboBox(self, name, combo): combo.blockSignals(False) def setupToolController(self, obj, combo): - '''setupToolController(obj, combo) ... helper function to setup obj's ToolController in the given combo box.''' + '''setupToolController(obj, combo) ... + helper function to setup obj's ToolController + in the given combo box.''' controllers = PathUtils.getToolControllers(self.obj) labels = [c.Label for c in controllers] combo.blockSignals(True) @@ -371,13 +375,16 @@ def setupToolController(self, obj, combo): self.selectInComboBox(obj.ToolController.Label, combo) def updateToolController(self, obj, combo): - '''updateToolController(obj, combo) ... helper function to update obj's ToolController property if a different one has been selected in the combo box.''' + '''updateToolController(obj, combo) ... + helper function to update obj's ToolController property if a different + one has been selected in the combo box.''' tc = PathUtils.findToolController(obj, combo.currentText()) if obj.ToolController != tc: obj.ToolController = tc def setupCoolant(self, obj, combo): - '''setupCoolant(obj, combo) ... helper function to setup obj's Coolant option.''' + '''setupCoolant(obj, combo) ... + helper function to setup obj's Coolant option.''' job = PathUtils.findParentJob(obj) options = job.SetupSheet.CoolantModes combo.blockSignals(True) @@ -389,13 +396,18 @@ def setupCoolant(self, obj, combo): self.selectInComboBox(obj.CoolantMode, combo) def updateCoolant(self, obj, combo): - '''updateCoolant(obj, combo) ... helper function to update obj's Coolant property if a different one has been selected in the combo box.''' + '''updateCoolant(obj, combo) ... + helper function to update obj's Coolant property if a different + one has been selected in the combo box.''' option = combo.currentText() if hasattr(obj, 'CoolantMode'): if obj.CoolantMode != option: obj.CoolantMode = option def updatePanelVisibility(self, panelTitle, obj): + '''updatePanelVisibility(panelTitle, obj) ... + Function to call the `updateVisibility()` GUI method of the + page whose panel title is as indicated.''' if hasattr(self, 'parent'): parent = getattr(self, 'parent') if parent and hasattr(parent, 'featurePages'): @@ -424,7 +436,10 @@ def getForm(self): return panel def modifyPanel(self, panel): - # Determine if possible operations are available + '''modifyPanel(self, panel) ... + Helper method to modify the current form immediately after + it is loaded.''' + # Determine if Job operations are available with Base Geometry availableOps = list() ops = self.job.Operations.Group for op in ops: @@ -432,6 +447,7 @@ def modifyPanel(self, panel): if len(op.Base) > 0: availableOps.append(op.Label) + # Load available operations into combobox if len(availableOps) > 0: # Populate the operations list addInputs = True