From 3b96eedd03ffb160ce1cdde72f9e3009fb520cfd Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sun, 17 Jun 2018 23:58:15 -0700 Subject: [PATCH] Added join to chamfer properties and UI. --- src/Mod/Path/Gui/Resources/Path.qrc | 4 + .../Resources/icons/edge-join-miter-not.svg | 100 ++++++++++++ .../Gui/Resources/icons/edge-join-miter.svg | 100 ++++++++++++ .../Resources/icons/edge-join-round-not.svg | 101 +++++++++++++ .../Gui/Resources/icons/edge-join-round.svg | 101 +++++++++++++ .../Gui/Resources/panels/PageOpChamferEdit.ui | 143 ++++++++++++++---- src/Mod/Path/PathScripts/PathChamfer.py | 3 + src/Mod/Path/PathScripts/PathChamferGui.py | 18 +++ 8 files changed, 541 insertions(+), 29 deletions(-) create mode 100644 src/Mod/Path/Gui/Resources/icons/edge-join-miter-not.svg create mode 100644 src/Mod/Path/Gui/Resources/icons/edge-join-miter.svg create mode 100644 src/Mod/Path/Gui/Resources/icons/edge-join-round-not.svg create mode 100644 src/Mod/Path/Gui/Resources/icons/edge-join-round.svg diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc index c0bde1315e..c35656dbac 100644 --- a/src/Mod/Path/Gui/Resources/Path.qrc +++ b/src/Mod/Path/Gui/Resources/Path.qrc @@ -60,6 +60,10 @@ icons/Path-BPlay.svg icons/Path-BStep.svg icons/Path-BStop.svg + icons/edge-join-miter.svg + icons/edge-join-miter-not.svg + icons/edge-join-round.svg + icons/edge-join-round-not.svg icons/preferences-path.svg panels/DlgJobChooser.ui panels/DlgJobCreate.ui diff --git a/src/Mod/Path/Gui/Resources/icons/edge-join-miter-not.svg b/src/Mod/Path/Gui/Resources/icons/edge-join-miter-not.svg new file mode 100644 index 0000000000..ff6db6dbed --- /dev/null +++ b/src/Mod/Path/Gui/Resources/icons/edge-join-miter-not.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/Mod/Path/Gui/Resources/icons/edge-join-miter.svg b/src/Mod/Path/Gui/Resources/icons/edge-join-miter.svg new file mode 100644 index 0000000000..432c9e8712 --- /dev/null +++ b/src/Mod/Path/Gui/Resources/icons/edge-join-miter.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/Mod/Path/Gui/Resources/icons/edge-join-round-not.svg b/src/Mod/Path/Gui/Resources/icons/edge-join-round-not.svg new file mode 100644 index 0000000000..807c6cd4cb --- /dev/null +++ b/src/Mod/Path/Gui/Resources/icons/edge-join-round-not.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/Mod/Path/Gui/Resources/icons/edge-join-round.svg b/src/Mod/Path/Gui/Resources/icons/edge-join-round.svg new file mode 100644 index 0000000000..a3651b014d --- /dev/null +++ b/src/Mod/Path/Gui/Resources/icons/edge-join-round.svg @@ -0,0 +1,101 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpChamferEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageOpChamferEdit.ui index 83d7397e01..3cba811cfd 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageOpChamferEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/PageOpChamferEdit.ui @@ -7,7 +7,7 @@ 0 0 538 - 256 + 277 @@ -44,37 +44,122 @@ - - - - QFormLayout::AllNonFixedFieldsGrow + + + + 0 - - - - W = - + + 0 + + + 0 + + + 9 + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + W = + + + + + + + <html><head/><body><p>Width of chamfer cut.</p></body></html> + + + mm + + + + + + + h = + + + + + + + <html><head/><body><p>Extra depth of tool immersion.</p></body></html> + + + mm + + + + - - - - mm - - - - - - - h = - - - - - - - mm - + + + + + + + Join: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>Miter joint</p></body></html> + + + + + + true + + + true + + + + + + + <html><head/><body><p>Round joint</p></body></html> + + + + + + true + + + true + + + true + + + + diff --git a/src/Mod/Path/PathScripts/PathChamfer.py b/src/Mod/Path/PathScripts/PathChamfer.py index 500d05ee6c..8e3ce2e7fd 100644 --- a/src/Mod/Path/PathScripts/PathChamfer.py +++ b/src/Mod/Path/PathScripts/PathChamfer.py @@ -51,6 +51,8 @@ class ObjectChamfer(PathEngraveBase.ObjectOp): def initOperation(self, obj): obj.addProperty("App::PropertyDistance", "Width", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "The desired width of the chamfer")) obj.addProperty("App::PropertyDistance", "ExtraDepth", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "The additional depth of the tool path")) + obj.addProperty("App::PropertyEnumeration", "Join", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "How to join chamfer segments")) + obj.Join = ['Round', 'Miter'] def opExecute(self, obj): angle = self.tool.CuttingEdgeAngle @@ -110,6 +112,7 @@ class ObjectChamfer(PathEngraveBase.ObjectOp): def opSetDefaultValues(self, obj): obj.Width = '1 mm' obj.ExtraDepth = '0.1 mm' + obj.Join = 'Round' def Create(name): '''Create(name) ... Creates and returns a Chamfer operation.''' diff --git a/src/Mod/Path/PathScripts/PathChamferGui.py b/src/Mod/Path/PathScripts/PathChamferGui.py index 8bf36b7dcb..68a4eacabc 100644 --- a/src/Mod/Path/PathScripts/PathChamferGui.py +++ b/src/Mod/Path/PathScripts/PathChamferGui.py @@ -57,10 +57,20 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): self.opImagePath = "{}Mod/Path/Images/Ops/{}".format(FreeCAD.getHomePath(), 'chamfer.svg') self.opImage = QtGui.QPixmap(self.opImagePath) self.form.opImage.setPixmap(self.opImage) + iconMiter = QtGui.QIcon(':/icons/edge-join-miter-not.svg') + iconMiter.addFile(':/icons/edge-join-miter.svg', state=QtGui.QIcon.On) + iconRound = QtGui.QIcon(':/icons/edge-join-round-not.svg') + iconRound.addFile(':/icons/edge-join-round.svg', state=QtGui.QIcon.On) + self.form.joinMiter.setIcon(iconMiter) + self.form.joinRound.setIcon(iconRound) def getFields(self, obj): PathGui.updateInputField(obj, 'Width', self.form.value_W) PathGui.updateInputField(obj, 'ExtraDepth', self.form.value_h) + if self.form.joinRound.isChecked(): + obj.Join = 'Round' + elif self.form.joinMiter.isChecked(): + obj.Join = 'Miter' self.updateToolController(obj, self.form.toolController) @@ -68,6 +78,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): self.form.value_W.setText(FreeCAD.Units.Quantity(obj.Width.Value, FreeCAD.Units.Length).UserString) self.form.value_h.setText(FreeCAD.Units.Quantity(obj.ExtraDepth.Value, FreeCAD.Units.Length).UserString) self.setupToolController(obj, self.form.toolController) + self.form.joinRound.setChecked('Round' == obj.Join) + self.form.joinMiter.setChecked('Miter' == obj.Join) def updateWidth(self): PathGui.updateInputField(self.obj, 'Width', self.form.value_W) @@ -75,6 +87,12 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def updateExtraDepth(self): PathGui.updateInputField(self.obj, 'ExtraDepth', self.form.value_h) + def getSignalsForUpdate(self, obj): + signals = [] + signals.append(self.form.joinMiter.clicked) + signals.append(self.form.joinRound.clicked) + return signals + def registerSignalHandlers(self, obj): self.form.value_W.editingFinished.connect(self.updateWidth) self.form.value_h.editingFinished.connect(self.updateExtraDepth)