Better naming, also for properties.
This commit is contained in:
parent
a4b987157f
commit
a2dbefcef2
|
@ -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><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></string>
|
||||
<string><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></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><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></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><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></string>
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
|
@ -139,7 +139,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><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></string>
|
||||
<string><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></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -152,7 +152,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><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></string>
|
||||
<string><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></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -162,7 +162,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Distance</string>
|
||||
<string>Length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user