From 56f6736923a1e3114875ffce20be1d78fc38dfad Mon Sep 17 00:00:00 2001
From: Russell Johnson <47639332+Russ4262@users.noreply.github.com>
Date: Thu, 18 Jun 2020 15:04:17 -0500
Subject: [PATCH 1/3] Path: Add icon reference to UI panel
---
.../Resources/panels/PageBaseGeometryEdit.ui | 139 ++++++++++--------
.../Gui/Resources/panels/PageDepthsEdit.ui | 14 +-
.../Gui/Resources/panels/PageHeightsEdit.ui | 6 +-
3 files changed, 93 insertions(+), 66 deletions(-)
diff --git a/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui
index c490abaee3..a779506eda 100644
--- a/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui
+++ b/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui
@@ -7,67 +7,29 @@
0
0
400
- 400
+ 250
+
+
+ 0
+ 0
+
+
Form
+
+
+ :/icons/Path-BaseGeometry.svg:/icons/Path-BaseGeometry.svg
+
-
-
-
-
-
- <html><head/><body><p>Add selected features to the list of base geometries for this operation.</p></body></html>
-
+
-
+
- Add
-
-
-
- -
-
-
- <html><head/><body><p>Clears list of base geometries.</p></body></html>
-
-
- Clear
-
-
-
- -
-
-
- All objects will be processed using the same operation properties
-
-
- Qt::AlignCenter
-
-
- true
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
-
- 0
- 25
-
-
-
- <html><head/><body><p>Select one or more features in the 3d view and press 'Add' to add them as the base items for this operation.</p><p><br/></p><p>Selected features can be deleted entirely.</p></body></html>
+ Import
@@ -81,13 +43,6 @@
- -
-
-
- Import
-
-
-
-
@@ -101,8 +56,70 @@
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ <html><head/><body><p>Select one or more features in the 3d view and press 'Add' to add them as the base items for this operation.</p><p><br/></p><p>Selected features can be deleted entirely.</p></body></html>
+
+
+
+ -
+
+
+ <html><head/><body><p>Clears list of base geometries.</p></body></html>
+
+
+ Clear
+
+
+
+ -
+
+
+ <html><head/><body><p>Add selected features to the list of base geometries for this operation.</p></body></html>
+
+
+ Add
+
+
+
+ -
+
+
+ All objects will be processed using the same operation properties
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
@@ -111,6 +128,8 @@
deleteBase
clearBase
-
+
+
+
diff --git a/src/Mod/Path/Gui/Resources/panels/PageDepthsEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageDepthsEdit.ui
index 6b780e4189..aa0de41a53 100644
--- a/src/Mod/Path/Gui/Resources/panels/PageDepthsEdit.ui
+++ b/src/Mod/Path/Gui/Resources/panels/PageDepthsEdit.ui
@@ -7,12 +7,16 @@
0
0
345
- 235
+ 234
Form
+
+
+ :/icons/Path-Depths.svg:/icons/Path-Depths.svg
+
-
@@ -78,7 +82,7 @@
...
-
+
:/icons/button_left.svg:/icons/button_left.svg
@@ -92,7 +96,7 @@
...
-
+
:/icons/button_left.svg:/icons/button_left.svg
@@ -165,7 +169,7 @@
Gui::QuantitySpinBox
- QDoubleSpinBox
+ QWidget
@@ -178,7 +182,7 @@
finalDepthSet
-
+
diff --git a/src/Mod/Path/Gui/Resources/panels/PageHeightsEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageHeightsEdit.ui
index 3dbb2464fd..ddccdd7db9 100644
--- a/src/Mod/Path/Gui/Resources/panels/PageHeightsEdit.ui
+++ b/src/Mod/Path/Gui/Resources/panels/PageHeightsEdit.ui
@@ -13,6 +13,10 @@
Form
+
+
+ :/icons/Path-Heights.svg:/icons/Path-Heights.svg
+
-
@@ -78,7 +82,7 @@
Gui::QuantitySpinBox
- QDoubleSpinBox
+ QWidget
From 33a1804050fa8e8bcbc48570bfcfe2a52c94bb53 Mon Sep 17 00:00:00 2001
From: Russell Johnson <47639332+Russ4262@users.noreply.github.com>
Date: Thu, 18 Jun 2020 13:48:29 -0500
Subject: [PATCH 2/3] Path: Add icons to feature tabs
Add Base Geometry, Heights, Depths, and Operation icons on the tabs in the Tasks Window editor.
---
src/Mod/Path/PathScripts/PathOpGui.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py
index 02561a47ba..0b695b6678 100644
--- a/src/Mod/Path/PathScripts/PathOpGui.py
+++ b/src/Mod/Path/PathScripts/PathOpGui.py
@@ -415,6 +415,8 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
super(TaskPanelBaseGeometryPage, self).__init__(obj, features)
self.panelTitle = 'Base Geometry'
+ self.OpIcon = ":/icons/Path-BaseGeometry.svg"
+ self.setIcon(self.OpIcon)
def getForm(self):
panel = FreeCADGui.PySideUic.loadUi(":/panels/PageBaseGeometryEdit.ui")
@@ -723,6 +725,8 @@ class TaskPanelHeightsPage(TaskPanelPage):
self.clearanceHeight = None
self.safeHeight = None
self.panelTitle = 'Heights'
+ self.OpIcon = ":/icons/Path-Heights.svg"
+ self.setIcon(self.OpIcon)
def getForm(self):
return FreeCADGui.PySideUic.loadUi(":/panels/PageHeightsEdit.ui")
@@ -765,6 +769,8 @@ class TaskPanelDepthsPage(TaskPanelPage):
self.finishDepth = None
self.stepDown = None
self.panelTitle = 'Depths'
+ self.OpIcon = ":/icons/Path-Depths.svg"
+ self.setIcon(self.OpIcon)
def getForm(self):
return FreeCADGui.PySideUic.loadUi(":/panels/PageDepthsEdit.ui")
@@ -961,10 +967,16 @@ class TaskPanel(object):
if taskPanelLayout == 0:
for page in self.featurePages:
toolbox.addItem(page.form, page.getTitle(obj))
+ itemIdx = toolbox.count() - 1
+ if page.icon:
+ toolbox.setItemIcon(itemIdx, QtGui.QIcon(page.icon))
toolbox.setCurrentIndex(len(self.featurePages)-1)
else:
for page in reversed(self.featurePages):
toolbox.addItem(page.form, page.getTitle(obj))
+ itemIdx = toolbox.count() - 1
+ if page.icon:
+ toolbox.setItemIcon(itemIdx, QtGui.QIcon(page.icon))
toolbox.setWindowTitle(opTitle)
if opPage.getIcon(obj):
toolbox.setWindowIcon(QtGui.QIcon(opPage.getIcon(obj)))
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 3/3] 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 0b695b6678..8ff48ade2d 100644
--- a/src/Mod/Path/PathScripts/PathOpGui.py
+++ b/src/Mod/Path/PathScripts/PathOpGui.py
@@ -342,14 +342,16 @@ class TaskPanelPage(object):
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 @@ class TaskPanelPage(object):
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 @@ class TaskPanelPage(object):
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 @@ class TaskPanelPage(object):
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 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
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 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
if len(op.Base) > 0:
availableOps.append(op.Label)
+ # Load available operations into combobox
if len(availableOps) > 0:
# Populate the operations list
addInputs = True