Better naming, also for properties.

This commit is contained in:
ml 2016-10-13 22:26:26 -07:00 committed by Markus Lampert
parent a4b987157f
commit a2dbefcef2
2 changed files with 40 additions and 40 deletions

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>352</width>
<height>486</height>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
@ -28,7 +28,7 @@
<x>0</x>
<y>0</y>
<width>334</width>
<height>439</height>
<height>340</height>
</rect>
</property>
<attribute name="label">
@ -36,16 +36,16 @@
</attribute>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="styleLabel">
<property name="text">
<string>Shape</string>
<string>Style</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="shape">
<widget class="QComboBox" name="styleCombo">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select desired shape of the bone dressup:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;Dogbone&lt;/span&gt; ... take the shortest path to cover the edge,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;T-bone&lt;/span&gt; ... follow a certain direction until corner is covered&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Select desired style of the bone dressup:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;Dogbone&lt;/span&gt; ... take the shortest path to cover the corner,&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;T-bone&lt;/span&gt; ... extend a certain direction until corner is covered&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
@ -75,14 +75,14 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="sideLabel">
<property name="text">
<string>Side</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="side">
<widget class="QComboBox" name="sideCombo">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -102,16 +102,16 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="incisionLabel">
<property name="text">
<string>Length </string>
<string>Incision </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="length">
<widget class="QComboBox" name="incisionCombo">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Lenght of the bone to be inserted into the profile.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;adaptive&lt;/span&gt; ... the lenght is adapted to cover the corner based on the angle of it's edges, taking the current tool radius into account (default)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;fixed&lt;/span&gt; ... 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).&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;custom&lt;/span&gt; ... let's you sepcify a custom (fixed) distance below&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines the incision length of the bone to be inserted into the profile.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;adaptive&lt;/span&gt; ... the lenght is adapted to cover the corner based on the angle of it's edges, taking the current tool radius into account (default)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;fixed&lt;/span&gt; ... 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).&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; font-style:italic;&quot;&gt;custom&lt;/span&gt; ... let's you sepcify a custom (fixed) length below&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>2</number>
@ -139,7 +139,7 @@
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter distance for each bone if &lt;span style=&quot; font-weight:600;&quot;&gt;Lenght&lt;/span&gt; is set to &lt;span style=&quot; font-weight:600;&quot;&gt;custom&lt;/span&gt;, ignored otherwise.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter length for each bone if &lt;span style=&quot; font-weight:600;&quot;&gt;Incision&lt;/span&gt; is set to &lt;span style=&quot; font-weight:600;&quot;&gt;custom&lt;/span&gt;, ignored otherwise.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -152,7 +152,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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 &lt;span style=&quot; font-weight:600;&quot;&gt;Side&lt;/span&gt; for the bones. &lt;/p&gt;&lt;p&gt;You can &lt;span style=&quot; font-weight:600;&quot;&gt;un-check&lt;/span&gt; the bones you don't want to be dressed up.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;If a bone is &lt;span style=&quot; font-weight:600;&quot;&gt;grayed out&lt;/span&gt; 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.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;If this list is empty it probably means you're trying to create bones on the wrong side of the profile.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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 &lt;span style=&quot; font-weight:600;&quot;&gt;Side&lt;/span&gt; for the bones. &lt;/p&gt;&lt;p&gt;You can &lt;span style=&quot; font-weight:600;&quot;&gt;un-check&lt;/span&gt; the bones you don't want to be dressed up.&lt;/p&gt;&lt;p&gt;If a bone is &lt;span style=&quot; font-weight:600;&quot;&gt;grayed out&lt;/span&gt; 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.&lt;/p&gt;&lt;p&gt;If this list is empty it probably means you're trying to create bones on the wrong side of the profile.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -162,7 +162,7 @@
<bool>false</bool>
</property>
<property name="text">
<string>Distance</string>
<string>Length</string>
</property>
</widget>
</item>

View File

@ -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)