From a2dbefcef2486ed8573d2060f6bd703b74aefd04 Mon Sep 17 00:00:00 2001 From: ml Date: Thu, 13 Oct 2016 22:26:26 -0700 Subject: [PATCH] Better naming, also for properties. --- .../Path/Gui/Resources/panels/DogboneEdit.ui | 30 +++++------ src/Mod/Path/PathScripts/DogboneDressup.py | 50 +++++++++---------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/panels/DogboneEdit.ui b/src/Mod/Path/Gui/Resources/panels/DogboneEdit.ui index 1b6bb2fbe..6b7f57f88 100644 --- a/src/Mod/Path/Gui/Resources/panels/DogboneEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/DogboneEdit.ui @@ -7,7 +7,7 @@ 0 0 352 - 486 + 387 @@ -28,7 +28,7 @@ 0 0 334 - 439 + 340 @@ -36,16 +36,16 @@ - + - Shape + Style - + - <html><head/><body><p>Select desired shape of the bone dressup:</p><p><span style=" font-weight:600; font-style:italic;">Dogbone</span> ... take the shortest path to cover the edge,</p><p><span style=" font-weight:600; font-style:italic;">T-bone</span> ... follow a certain direction until corner is covered</p></body></html> + <html><head/><body><p>Select desired style of the bone dressup:</p><p><span style=" font-weight:600; font-style:italic;">Dogbone</span> ... take the shortest path to cover the corner,</p><p><span style=" font-weight:600; font-style:italic;">T-bone</span> ... extend a certain direction until corner is covered</p></body></html> @@ -75,14 +75,14 @@ - + Side - + <html><head/><body><p>On which side of the profile bones are inserted - this also determines which corners are dressed up. The default value is determined based on the profile being dressed up.</p></body></html> @@ -102,16 +102,16 @@ - + - Length + Incision - + - <html><head/><body><p>Lenght of the bone to be inserted into the profile.</p><p><span style=" font-weight:600; font-style:italic;">adaptive</span> ... the lenght is adapted to cover the corner based on the angle of it's edges, taking the current tool radius into account (default)</p><p><span style=" font-weight:600; font-style:italic;">fixed</span> ... is the same as adaptive for straight angles. For T-bones it's the radius of the tool (R) and for dogbones it's R * (2/√2 - 1).</p><p><span style=" font-weight:600; font-style:italic;">custom</span> ... let's you sepcify a custom (fixed) distance below</p></body></html> + <html><head/><body><p>Determines the incision length of the bone to be inserted into the profile.</p><p><span style=" font-weight:600; font-style:italic;">adaptive</span> ... the lenght is adapted to cover the corner based on the angle of it's edges, taking the current tool radius into account (default)</p><p><span style=" font-weight:600; font-style:italic;">fixed</span> ... is the same as adaptive for straight angles. For T-bones it's the radius of the tool (R) and for dogbones it's R * (2/√2 - 1).</p><p><span style=" font-weight:600; font-style:italic;">custom</span> ... let's you sepcify a custom (fixed) length below</p></body></html> 2 @@ -139,7 +139,7 @@ false - <html><head/><body><p>Enter distance for each bone if <span style=" font-weight:600;">Lenght</span> is set to <span style=" font-weight:600;">custom</span>, ignored otherwise.</p></body></html> + <html><head/><body><p>Enter length for each bone if <span style=" font-weight:600;">Incision</span> is set to <span style=" font-weight:600;">custom</span>, ignored otherwise.</p></body></html> @@ -152,7 +152,7 @@ - <html><head/><body><p>List of bone locations (with all bones at that location) that are part of this dressup. The list is determined by the corners in the profile and the selected <span style=" font-weight:600;">Side</span> for the bones. </p><p>You can <span style=" font-weight:600;">un-check</span> the bones you don't want to be dressed up.</p><p><br/></p><p>If a bone is <span style=" font-weight:600;">grayed out</span> it means that it is already dressed up by a previous dressup. Or put another way, if you dress up this dogobone dressup again you will only be able to select the bones that are un-checked here.</p><p><br/></p><p>If this list is empty it probably means you're trying to create bones on the wrong side of the profile.</p></body></html> + <html><head/><body><p>List of bone locations (with all bones at that location) that are part of this dressup. The list is determined by the corners in the profile and the selected <span style=" font-weight:600;">Side</span> for the bones. </p><p>You can <span style=" font-weight:600;">un-check</span> the bones you don't want to be dressed up.</p><p>If a bone is <span style=" font-weight:600;">grayed out</span> it means that it is already dressed up by a previous dressup. Or put another way, if you dress up this dogobone dressup again you will only be able to select the bones that are un-checked here.</p><p>If this list is empty it probably means you're trying to create bones on the wrong side of the profile.</p></body></html> @@ -162,7 +162,7 @@ false - Distance + Length diff --git a/src/Mod/Path/PathScripts/DogboneDressup.py b/src/Mod/Path/PathScripts/DogboneDressup.py index adb23bcc8..bf7bfc8f2 100644 --- a/src/Mod/Path/PathScripts/DogboneDressup.py +++ b/src/Mod/Path/PathScripts/DogboneDressup.py @@ -45,7 +45,7 @@ except AttributeError: movecommands = ['G0', 'G00', 'G1', 'G01', 'G2', 'G02', 'G3', 'G03'] movestraight = ['G1', 'G01'] -class Shape: +class Style: Dogbone = 'Dogbone' Tbone_H = 'T-bone horizontal' Tbone_V = 'T-bone vertical' @@ -58,7 +58,7 @@ class Side: Right = 'Right' All = [Left, Right] -class Length: +class Incision: Fixed = 'fixed' Adaptive = 'adaptive' Custom = 'custom' @@ -198,15 +198,15 @@ class ObjectDressup: obj.addProperty("App::PropertyEnumeration", "Side", "Dressup", QtCore.QT_TRANSLATE_NOOP("Dogbone_Dressup", "The side of path to insert bones")) obj.Side = [Side.Left, Side.Right] obj.Side = Side.Right - obj.addProperty("App::PropertyEnumeration", "Shape", "Dressup", QtCore.QT_TRANSLATE_NOOP("Dogbone_Dressup", "The shape of boness")) - obj.Shape = Shape.All - obj.Shape = Shape.Dogbone + obj.addProperty("App::PropertyEnumeration", "Style", "Dressup", QtCore.QT_TRANSLATE_NOOP("Dogbone_Dressup", "The style of boness")) + obj.Style = Style.All + obj.Style = Style.Dogbone obj.addProperty("App::PropertyIntegerList", "BoneBlacklist", "Dressup", QtCore.QT_TRANSLATE_NOOP("Dogbone_Dressup", "Bones that aren't dressed up")) obj.BoneBlacklist = [] obj.setEditorMode('BoneBlacklist', 2) # hide this one - obj.addProperty("App::PropertyEnumeration", "Length", "Dressup", QtCore.QT_TRANSLATE_NOOP("Dogbone_Dressup", "The algorithm to determine the bone length")) - obj.Length = Length.All - obj.Length = Length.Adaptive + obj.addProperty("App::PropertyEnumeration", "Incision", "Dressup", QtCore.QT_TRANSLATE_NOOP("Dogbone_Dressup", "The algorithm to determine the bone length")) + obj.Incision = Incision.All + obj.Incision = Incision.Adaptive obj.addProperty("App::PropertyFloat", "Custom", "Dressup", QtCore.QT_TRANSLATE_NOOP("Dogbone_Dressup", "Dressup length if lenght == custom")) obj.Custom = 0.0 obj.Proxy = self @@ -254,9 +254,9 @@ class ObjectDressup: def inOutBoneCommands(self, obj, inChord, outChord, angle, fixedLength): length = fixedLength - if obj.Length == Length.Custom: + if obj.Incision == Incision.Custom: length = obj.Custom - if obj.Length == Length.Adaptive: + if obj.Incision == Incision.Adaptive: length = self.adaptiveBoneLength(obj, inChord, outChord, angle) x = length * math.cos(angle); y = length * math.sin(angle); @@ -336,15 +336,15 @@ class ObjectDressup: self.bones.append((boneId, loc, enabled, inaccessible)) if enabled: - if obj.Shape == Shape.Dogbone: + if obj.Style == Style.Dogbone: return self.dogbone(obj, inChord, outChord) - if obj.Shape == Shape.Tbone_H: + if obj.Style == Style.Tbone_H: return self.tboneHorizontal(obj, inChord, outChord) - if obj.Shape == Shape.Tbone_V: + if obj.Style == Style.Tbone_V: return self.tboneVertical(obj, inChord, outChord) - if obj.Shape == Shape.Tbone_L: + if obj.Style == Style.Tbone_L: return self.tboneLongEdge(obj, inChord, outChord) - if obj.Shape == Shape.Tbone_S: + if obj.Style == Style.Tbone_S: return self.tboneShortEdge(obj, inChord, outChord) return self.debugCircleBone(obj, inChord, outChord) else: @@ -546,9 +546,9 @@ class TaskPanel: FreeCAD.ActiveDocument.recompute() def getFields(self): - self.obj.Shape = str(self.form.shape.currentText()) - self.obj.Side = str(self.form.side.currentText()) - self.obj.Length = str(self.form.length.currentText()) + self.obj.Style = str(self.form.styleCombo.currentText()) + self.obj.Side = str(self.form.sideCombo.currentText()) + self.obj.Incision = str(self.form.incisionCombo.currentText()) self.obj.Custom = self.form.custom.value() blacklist = [] for i in range(0, self.form.bones.count()): @@ -579,7 +579,7 @@ class TaskPanel: self.form.bones.addItem(item) def updateUI(self): - customSelected = self.obj.Length == Length.Custom + customSelected = self.obj.Incision == Incision.Custom self.form.custom.setEnabled(customSelected) self.form.customLabel.setEnabled(customSelected) self.updateBoneList() @@ -599,9 +599,9 @@ class TaskPanel: combo.setCurrentIndex(index) def setFields(self): - self.setupCombo(self.form.shape, self.obj.Shape, Shape.All) - self.setupCombo(self.form.side, self.obj.Side, Side.All) - self.setupCombo(self.form.length, self.obj.Length, Length.All) + self.setupCombo(self.form.styleCombo, self.obj.Style, Style.All) + self.setupCombo(self.form.sideCombo, self.obj.Side, Side.All) + self.setupCombo(self.form.incisionCombo, self.obj.Incision, Incision.All) self.form.custom.setMinimum(0.0) self.form.custom.setDecimals(3) self.form.custom.setValue(self.obj.Custom) @@ -618,9 +618,9 @@ class TaskPanel: def setupUi(self): self.setFields() # now that the form is filled, setup the signal handlers - self.form.shape.currentIndexChanged.connect(self.updateModel) - self.form.side.currentIndexChanged.connect(self.updateModel) - self.form.length.currentIndexChanged.connect(self.updateModel) + self.form.styleCombo.currentIndexChanged.connect(self.updateModel) + self.form.sideCombo.currentIndexChanged.connect(self.updateModel) + self.form.incisionCombo.currentIndexChanged.connect(self.updateModel) self.form.custom.valueChanged.connect(self.updateModel) self.form.bones.itemChanged.connect(self.updateModel)