From 3b954f95f3e9c257ef532243d6149116cbec56a0 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Fri, 11 Nov 2022 10:08:26 -0600 Subject: [PATCH] use correct widgets in task panel --- .../Resources/panels/PageOpAdaptiveEdit.ui | 206 ++++++++++-------- src/Mod/Path/Path/Op/Gui/Adaptive.py | 71 ++++-- 2 files changed, 173 insertions(+), 104 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpAdaptiveEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageOpAdaptiveEdit.ui index 67dd17a360..89ef4c99df 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageOpAdaptiveEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/PageOpAdaptiveEdit.ui @@ -49,24 +49,24 @@ QFrame::Raised - - + + - Cut Region + Use Outline - - - - <html><head/><body><p>Cut inside or outside of the selected shapes</p></body></html> + + + + Keep Tool Down Ratio - - + + - Operation Type + Helix Max Diameter @@ -77,6 +77,13 @@ + + + + Cut Region + + + @@ -84,20 +91,49 @@ - - - - <html><head/><body><p>Optimal value for tool stepover</p></body></html> - - - 1 - - - 100 + + + + Force Clearing Inside-out - + + + + Lift Distance + + + + + + + Stock to Leave + + + + + + + Operation Type + + + + + + + Helix Ramp Angle + + + + + + + Finishing Profile + + + + QFrame::StyledPanel @@ -141,17 +177,10 @@ - - - - Helix Ramp Angle - - - - - + + - <html><head/><body><p>Angle of the helix ramp entry</p></body></html> + <html><head/><body><p>Cut inside or outside of the selected shapes</p></body></html> @@ -162,91 +191,86 @@ - - - - <html><head/><body><p>Angle of the helix entry cone</p></body></html> - - - - - - - Helix Max Diameter - - - - + <html><head/><body><p>If &gt;0 it limits the helix ramp diameter</p><p>otherwise the 75 percent of tool diameter is used</p></body></html> - - - - - - Lift Distance + + - - + + <html><head/><body><p>How much to lift the tool up during the rapid linking moves over cleared regions.</p><p>If linking path is not clear tool is raised to clearence height.</p></body></html> - - - - - - Keep Tool Down Ratio + + - - + + <html><head/><body><p>Max length of keep-tool-down linking path compared to direct distance between points.</p><p>If exceeded link will be done by raising the tool to clearence height.</p></body></html> - - - - - - Stock to Leave + + - - + + <html><head/><body><p>How much material to leave (i.e. for finishing operation)</p></body></html> - - - - - - Force Clearing Inside-out + + - - - - Finishing Profile + + + + <html><head/><body><p>The amount by which the tool is laterally displaced on each cycle of the pattern, specified in percent of the tool diameter.</p><p>A step over of 100% results in no overlap between two different cycles.</p></body></html> + + + 1 + + + 100 + + + 10 + + + 100 - - - - Use Outline + + + + <html><head/><body><p>Angle of the helix ramp entry</p></body></html> + + + - + + + + <html><head/><body><p>Angle of the helix entry cone</p></body></html> + + + + + + + @@ -271,6 +295,18 @@ + + + Gui::InputField + QLineEdit +
Gui/InputField.h
+
+ + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
+
diff --git a/src/Mod/Path/Path/Op/Gui/Adaptive.py b/src/Mod/Path/Path/Op/Gui/Adaptive.py index 4bc069470b..a51c80c509 100644 --- a/src/Mod/Path/Path/Op/Gui/Adaptive.py +++ b/src/Mod/Path/Path/Op/Gui/Adaptive.py @@ -22,11 +22,14 @@ # *************************************************************************** import FreeCADGui +import FreeCAD import Path.Op.Adaptive as PathAdaptive import Path.Op.Gui.Base as PathOpGui import Path.Op.Gui.FeatureExtension as PathFeatureExtensionsGui from PySide import QtCore +import Path.Base.Gui.Util as PathGuiUtil + class TaskPanelOpPage(PathOpGui.TaskPanelPage): def getForm(self): @@ -40,14 +43,27 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): self.populateCombobox(form, enumTups, comboToPropertyMap) return form + def initPage(self, obj): + self.form.LiftDistance.setProperty( + "unit", obj.LiftDistance.getUserPreferred()[2] + ) + self.form.HelixDiameterLimit.setProperty( + "unit", obj.HelixDiameterLimit.getUserPreferred()[2] + ) + self.form.KeepToolDownRatio.setProperty( + "unit", obj.KeepToolDownRatio.getUserPreferred()[2] + ) + self.form.StockToLeave.setProperty( + "unit", obj.StockToLeave.getUserPreferred()[2] + ) + def getSignalsForUpdate(self, obj): """getSignalsForUpdate(obj) ... return list of signals for updating obj""" signals = [] - # signals.append(self.form.button.clicked) signals.append(self.form.Side.currentIndexChanged) signals.append(self.form.OperationType.currentIndexChanged) signals.append(self.form.ToolController.currentIndexChanged) - signals.append(self.form.StepOver.valueChanged) + signals.append(self.form.stepOverPercent.valueChanged) signals.append(self.form.Tolerance.valueChanged) signals.append(self.form.HelixAngle.valueChanged) signals.append(self.form.HelixConeAngle.valueChanged) @@ -56,8 +72,6 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): signals.append(self.form.KeepToolDownRatio.valueChanged) signals.append(self.form.StockToLeave.valueChanged) signals.append(self.form.coolantController.currentIndexChanged) - - # signals.append(self.form.ProcessHoles.stateChanged) signals.append(self.form.ForceInsideOut.stateChanged) signals.append(self.form.FinishingProfile.stateChanged) signals.append(self.form.useOutline.stateChanged) @@ -67,19 +81,32 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def setFields(self, obj): self.selectInComboBox(obj.Side, self.form.Side) self.selectInComboBox(obj.OperationType, self.form.OperationType) - self.form.StepOver.setValue(obj.StepOver) + self.form.stepOverPercent.setValue(obj.StepOver) self.form.Tolerance.setValue(int(obj.Tolerance * 100)) - self.form.HelixAngle.setValue(obj.HelixAngle) - self.form.HelixConeAngle.setValue(obj.HelixConeAngle) - self.form.HelixDiameterLimit.setValue(obj.HelixDiameterLimit) - self.form.LiftDistance.setValue(obj.LiftDistance) + + self.form.HelixAngle.setText( + FreeCAD.Units.Quantity(obj.HelixAngle, FreeCAD.Units.Angle).UserString + ) + + self.form.HelixConeAngle.setText( + FreeCAD.Units.Quantity(obj.HelixConeAngle, FreeCAD.Units.Angle).UserString + ) + + self.form.HelixDiameterLimit.setProperty( + "rawValue", obj.HelixDiameterLimit.Value + ) + + self.form.LiftDistance.setProperty("rawValue", obj.LiftDistance.Value) + if hasattr(obj, "KeepToolDownRatio"): - self.form.KeepToolDownRatio.setValue(obj.KeepToolDownRatio) + self.form.KeepToolDownRatio.setProperty( + "rawValue", obj.KeepToolDownRatio.Value + ) + # self.form.KeepToolDownRatio.setValue(obj.KeepToolDownRatio) if hasattr(obj, "StockToLeave"): - self.form.StockToLeave.setValue(obj.StockToLeave) + self.form.StockToLeave.setProperty("rawValue", obj.StockToLeave.Value) - # self.form.ProcessHoles.setChecked(obj.ProcessHoles) self.form.ForceInsideOut.setChecked(obj.ForceInsideOut) self.form.FinishingProfile.setChecked(obj.FinishingProfile) self.form.useOutline.setChecked(obj.UseOutline) @@ -98,18 +125,24 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): if obj.OperationType != str(self.form.OperationType.currentData()): obj.OperationType = str(self.form.OperationType.currentData()) - obj.StepOver = self.form.StepOver.value() + if obj.StepOver != self.form.stepOverPercent.value(): + obj.StepOver = self.form.stepOverPercent.value() + obj.Tolerance = 1.0 * self.form.Tolerance.value() / 100.0 - obj.HelixAngle = self.form.HelixAngle.value() - obj.HelixConeAngle = self.form.HelixConeAngle.value() - obj.HelixDiameterLimit = self.form.HelixDiameterLimit.value() - obj.LiftDistance = self.form.LiftDistance.value() + PathGuiUtil.updateInputField(obj, "HelixAngle", self.form.HelixAngle) + PathGuiUtil.updateInputField(obj, "HelixConeAngle", self.form.HelixConeAngle) + PathGuiUtil.updateInputField( + obj, "HelixDiameterLimit", self.form.HelixDiameterLimit + ) + PathGuiUtil.updateInputField(obj, "LiftDistance", self.form.LiftDistance) if hasattr(obj, "KeepToolDownRatio"): - obj.KeepToolDownRatio = self.form.KeepToolDownRatio.value() + PathGuiUtil.updateInputField( + obj, "KeepToolDownRatio", self.form.KeepToolDownRatio + ) if hasattr(obj, "StockToLeave"): - obj.StockToLeave = self.form.StockToLeave.value() + PathGuiUtil.updateInputField(obj, "StockToLeave", self.form.StockToLeave) obj.ForceInsideOut = self.form.ForceInsideOut.isChecked() obj.FinishingProfile = self.form.FinishingProfile.isChecked()