This commit is contained in:
sliptonic
2022-01-21 14:04:31 -06:00
parent 17182b1c71
commit 49eaadcd25

View File

@@ -22,7 +22,7 @@
import FreeCAD
import FreeCADGui
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathGui as PGui # ensure Path/Gui/Resources are loaded
import PathScripts.PathCircularHoleBaseGui as PathCircularHoleBaseGui
import PathScripts.PathDrilling as PathDrilling
import PathScripts.PathGui as PathGui
@@ -47,13 +47,19 @@ else:
class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
'''Controller for the drilling operation's page'''
"""Controller for the drilling operation's page"""
def initPage(self, obj):
# pylint: disable=attribute-defined-outside-init
self.peckDepthSpinBox = PathGui.QuantitySpinBox(self.form.peckDepth, obj, 'PeckDepth')
self.peckRetractSpinBox = PathGui.QuantitySpinBox(self.form.peckRetractHeight, obj, 'RetractHeight')
self.dwellTimeSpinBox = PathGui.QuantitySpinBox(self.form.dwellTime, obj, 'DwellTime')
self.peckDepthSpinBox = PathGui.QuantitySpinBox(
self.form.peckDepth, obj, "PeckDepth"
)
self.peckRetractSpinBox = PathGui.QuantitySpinBox(
self.form.peckRetractHeight, obj, "RetractHeight"
)
self.dwellTimeSpinBox = PathGui.QuantitySpinBox(
self.form.dwellTime, obj, "DwellTime"
)
def registerSignalHandlers(self, obj):
self.form.peckEnabled.toggled.connect(self.form.peckDepth.setEnabled)
@@ -76,17 +82,17 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
self.form.dwellTimelabel.setEnabled(True)
def getForm(self):
'''getForm() ... return UI'''
"""getForm() ... return UI"""
return FreeCADGui.PySideUic.loadUi(":/panels/PageOpDrillingEdit.ui")
def updateQuantitySpinBoxes(self, index = None):
def updateQuantitySpinBoxes(self, index=None):
# pylint: disable=unused-argument
self.peckDepthSpinBox.updateSpinBox()
self.peckRetractSpinBox.updateSpinBox()
self.dwellTimeSpinBox.updateSpinBox()
def getFields(self, obj):
'''setFields(obj) ... update obj's properties with values from the UI'''
"""setFields(obj) ... update obj's properties with values from the UI"""
PathLog.track()
self.peckDepthSpinBox.updateProperty()
self.peckRetractSpinBox.updateProperty()
@@ -103,7 +109,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
self.updateCoolant(obj, self.form.coolantController)
def setFields(self, obj):
'''setFields(obj) ... update UI with obj properties' values'''
"""setFields(obj) ... update UI with obj properties' values"""
PathLog.track()
self.updateQuantitySpinBoxes()
@@ -122,9 +128,8 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
self.setupToolController(obj, self.form.toolController)
self.setupCoolant(obj, self.form.coolantController)
def getSignalsForUpdate(self, obj):
'''getSignalsForUpdate(obj) ... return list of signals which cause the receiver to update the model'''
"""getSignalsForUpdate(obj) ... return list of signals which cause the receiver to update the model"""
signals = []
signals.append(self.form.peckRetractHeight.editingFinished)
@@ -139,15 +144,21 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
return signals
def updateData(self, obj, prop):
if prop in ['PeckDepth', 'RetractHeight'] and not prop in ['Base', 'Disabled']:
if prop in ["PeckDepth", "RetractHeight"] and not prop in ["Base", "Disabled"]:
self.updateQuantitySpinBoxes()
Command = PathOpGui.SetupOperation('Drilling',
PathDrilling.Create,
TaskPanelOpPage,
'Path_Drilling',
QtCore.QT_TRANSLATE_NOOP("Path_Drilling", "Drilling"),
QtCore.QT_TRANSLATE_NOOP("Path_Drilling", "Creates a Path Drilling object from a features of a base object"),
PathDrilling.SetupProperties)
Command = PathOpGui.SetupOperation(
"Drilling",
PathDrilling.Create,
TaskPanelOpPage,
"Path_Drilling",
QtCore.QT_TRANSLATE_NOOP("Path_Drilling", "Drilling"),
QtCore.QT_TRANSLATE_NOOP(
"Path_Drilling",
"Creates a Path Drilling object from a features of a base object",
),
PathDrilling.SetupProperties,
)
FreeCAD.Console.PrintLog("Loading PathDrillingGui... done\n")