From 092d337bdcc5521fa57d7fc273828f20810fff32 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sun, 8 Oct 2017 11:44:46 -0700 Subject: [PATCH] Changed tool controller editor to use QuantitySpinBox for speeds. --- .../Resources/panels/DlgToolControllerEdit.ui | 25 +++++++++++++--- src/Mod/Path/PathScripts/PathGui.py | 5 ---- .../Path/PathScripts/PathToolController.py | 29 +++++++++++-------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/panels/DlgToolControllerEdit.ui b/src/Mod/Path/Gui/Resources/panels/DlgToolControllerEdit.ui index 66a120ffeb..9e5c1ed9e2 100644 --- a/src/Mod/Path/Gui/Resources/panels/DlgToolControllerEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/DlgToolControllerEdit.ui @@ -78,40 +78,52 @@ - + 0.000000000000000 + + 9999999.000000000000000 + mm/s - + 0.000000000000000 + + 9999999.000000000000000 + mm/s - + 0.000000000000000 + + 9999999.000000000000000 + mm/s - + 0.000000000000000 + + 9999999.000000000000000 + mm/s @@ -495,6 +507,11 @@ QLineEdit
Gui/InputField.h
+ + Gui::QuantitySpinBox + QDoubleSpinBox +
Gui/QuantitySpinBox.h
+
diff --git a/src/Mod/Path/PathScripts/PathGui.py b/src/Mod/Path/PathScripts/PathGui.py index 9d8f262a45..e53f4cc831 100644 --- a/src/Mod/Path/PathScripts/PathGui.py +++ b/src/Mod/Path/PathScripts/PathGui.py @@ -24,12 +24,7 @@ import FreeCAD import FreeCADGui -import PathScripts.PathGeom as PathGeom -import PathScripts.PathGetPoint as PathGetPoint import PathScripts.PathLog as PathLog -import PathScripts.PathSelection as PathSelection -import PathScripts.PathOp as PathOp -import PathScripts.PathUtils as PathUtils import importlib from PathScripts.PathGeom import PathGeom diff --git a/src/Mod/Path/PathScripts/PathToolController.py b/src/Mod/Path/PathScripts/PathToolController.py index be3b08542c..f1a25f12cd 100644 --- a/src/Mod/Path/PathScripts/PathToolController.py +++ b/src/Mod/Path/PathScripts/PathToolController.py @@ -24,16 +24,17 @@ ''' Tool Controller defines tool, spindle speed and feed rates for Path Operations ''' import FreeCAD -import FreeCADGui import Part import Path import PathScripts import PathScripts.PathLog as PathLog -#from . import PathUtils -import xml.etree.ElementTree as xml from FreeCAD import Units -from PySide import QtCore, QtGui +from PySide import QtCore + +if FreeCAD.GuiUp: + import FreeCADGui + import PathScripts.PathGui as PathGui if False: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) @@ -268,6 +269,10 @@ class ToolControllerEditor: if not asDialog: self.form.buttonBox.hide() self.obj = obj + self.vertFeed = PathGui.QuantitySpinBox(self.form.vertFeed, obj, 'VertFeed') + self.horizFeed = PathGui.QuantitySpinBox(self.form.horizFeed, obj, 'HorizFeed') + self.vertRapid = PathGui.QuantitySpinBox(self.form.vertRapid, obj, 'VertRapid') + self.horizRapid = PathGui.QuantitySpinBox(self.form.horizRapid, obj, 'HorizRapid') def getType(self, tooltype): "gets a combobox index number for a given type or viceversa" @@ -298,10 +303,10 @@ class ToolControllerEditor: tc = self.obj self.form.tcName.setText(tc.Label) self.form.tcNumber.setValue(tc.ToolNumber) - self.form.horizFeed.setText(tc.HorizFeed.UserString) - self.form.vertFeed.setText(tc.VertFeed.UserString) - self.form.horizRapid.setText(tc.HorizRapid.UserString) - self.form.vertRapid.setText(tc.VertRapid.UserString) + self.horizFeed.updateSpinBox() + self.horizRapid.updateSpinBox() + self.vertFeed.updateSpinBox() + self.vertRapid.updateSpinBox() self.form.spindleSpeed.setValue(tc.SpindleSpeed) index = self.form.spindleDirection.findText(tc.SpindleDir, QtCore.Qt.MatchFixedString) if index >= 0: @@ -322,10 +327,10 @@ class ToolControllerEditor: try: tc.Label = self.form.tcName.text() tc.ToolNumber = self.form.tcNumber.value() - tc.HorizFeed = self.form.horizFeed.text() - tc.VertFeed = self.form.vertFeed.text() - tc.HorizRapid = self.form.horizRapid.text() - tc.VertRapid = self.form.vertRapid.text() + self.horizFeed.updateProperty() + self.vertFeed.updateProperty() + self.horizRapid.updateProperty() + self.vertRapid.updateProperty() tc.SpindleSpeed = self.form.spindleSpeed.value() tc.SpindleDir = self.form.spindleDirection.currentText()