Using InputField for width and height and use proper properties.
This commit is contained in:
parent
6792e2c4b9
commit
f89eea7b59
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>363</width>
|
||||
<height>530</height>
|
||||
<width>380</width>
|
||||
<height>539</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -16,6 +16,12 @@
|
|||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
|
@ -27,8 +33,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>345</width>
|
||||
<height>476</height>
|
||||
<width>362</width>
|
||||
<height>485</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
@ -48,13 +54,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsbWidth">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Specify the resulting width of tags at the base.</p><p>The initial default width is based on the longest edge found in the base path.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
|
@ -62,13 +61,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsbHeight">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Height of holding tags.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
|
@ -76,10 +68,36 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::InputField" name="ifWidth">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Width of the resulting holding tag.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="ifHeight">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Height of holding tag.</p><p>Note that resulting tag might be smaller if the tag's width and angle result in a triangular shape.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsbAngle">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Angle of ascend and descend of the tool for the holding tag cutout.</p><p><br/></p><p>If the angle is too flat for the given width to reach the specified height the resulting tag will have a triangular shape and not as high as specified.</p></body></html></string>
|
||||
<string><html><head/><body><p>Plunge angle for ascent and descent of holding tag.</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>90.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>15.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>45.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -89,14 +107,14 @@
|
|||
<item>
|
||||
<widget class="QListWidget" name="lwTags">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>List of current tags.</p><p>Edit coordinates to move tag or invoker snapper tool.</p></body></html></string>
|
||||
<string><html><head/><body><p>List of current tags.</p><p>Edit coordinates by double click or Enter key.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pbDelete">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -106,13 +124,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pbAdd">
|
||||
<property name="text">
|
||||
<string>Add...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -154,6 +182,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -577,9 +577,9 @@ class ObjectDressup:
|
|||
def __init__(self, obj):
|
||||
self.obj = obj
|
||||
obj.addProperty("App::PropertyLink", "Base","Base", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "The base path to modify"))
|
||||
obj.addProperty("App::PropertyFloat", "Width", "Tag", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "Width of tags."))
|
||||
obj.addProperty("App::PropertyFloat", "Height", "Tag", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "Height of tags."))
|
||||
obj.addProperty("App::PropertyFloat", "Angle", "Tag", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "Angle of tag plunge and ascent."))
|
||||
obj.addProperty("App::PropertyLength", "Width", "Tag", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "Width of tags."))
|
||||
obj.addProperty("App::PropertyLength", "Height", "Tag", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "Height of tags."))
|
||||
obj.addProperty("App::PropertyAngle", "Angle", "Tag", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "Angle of tag plunge and ascent."))
|
||||
obj.addProperty("App::PropertyVectorList", "Positions", "Tag", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "Locations of insterted holding tags"))
|
||||
obj.addProperty("App::PropertyIntegerList", "Disabled", "Tag", QtCore.QT_TRANSLATE_NOOP("PathDressup_HoldingTags", "Ids of disabled holding tags"))
|
||||
obj.Proxy = self
|
||||
|
@ -592,7 +592,7 @@ class ObjectDressup:
|
|||
|
||||
def generateTags(self, obj, count):
|
||||
if hasattr(self, "pathData"):
|
||||
self.tags = self.pathData.generateTags(obj, count, obj.Width, obj.Height, obj.Angle, None)
|
||||
self.tags = self.pathData.generateTags(obj, count, obj.Width.Value, obj.Height.Value, obj.Angle, None)
|
||||
obj.Positions = [tag.originAt(0) for tag in self.tags]
|
||||
obj.Disabled = []
|
||||
return False
|
||||
|
@ -696,7 +696,7 @@ class ObjectDressup:
|
|||
self.tags = []
|
||||
if hasattr(obj, "Positions"):
|
||||
for i, pos in enumerate(obj.Positions):
|
||||
tag = Tag(pos.x, pos.y, obj.Width, obj.Height, obj.Angle, not i in obj.Disabled)
|
||||
tag = Tag(pos.x, pos.y, obj.Width.Value, obj.Height.Value, obj.Angle, not i in obj.Disabled)
|
||||
tag.createSolidsAt(pathData.minZ, self.toolRadius)
|
||||
self.tags.append(tag)
|
||||
|
||||
|
@ -829,8 +829,8 @@ class TaskPanel:
|
|||
return tags
|
||||
|
||||
def getTagParameters(self):
|
||||
self.obj.Width = self.formTags.dsbWidth.value()
|
||||
self.obj.Height = self.formTags.dsbHeight.value()
|
||||
self.obj.Width = FreeCAD.Units.Quantity(self.formTags.ifWidth.text()).Value
|
||||
self.obj.Height = FreeCAD.Units.Quantity(self.formTags.ifHeight.text()).Value
|
||||
self.obj.Angle = self.formTags.dsbAngle.value()
|
||||
|
||||
def getFields(self):
|
||||
|
@ -954,9 +954,9 @@ class TaskPanel:
|
|||
def getPoint(self, whenDone, start=None):
|
||||
|
||||
def displayPoint(p):
|
||||
self.formPoint.ifValueX.setText(DraftGui.displayExternal(p.x))
|
||||
self.formPoint.ifValueY.setText(DraftGui.displayExternal(p.y))
|
||||
self.formPoint.ifValueZ.setText(DraftGui.displayExternal(p.z))
|
||||
self.formPoint.ifValueX.setText(FreeCAD.Units.Quantity(p.x, FreeCAD.Units.Length).UserString)
|
||||
self.formPoint.ifValueY.setText(FreeCAD.Units.Quantity(p.y, FreeCAD.Units.Length).UserString)
|
||||
self.formPoint.ifValueZ.setText(FreeCAD.Units.Quantity(p.z, FreeCAD.Units.Length).UserString)
|
||||
self.formPoint.ifValueX.setFocus()
|
||||
self.formPoint.ifValueX.selectAll()
|
||||
|
||||
|
@ -1002,11 +1002,9 @@ class TaskPanel:
|
|||
def setFields(self):
|
||||
self.updateTagsView()
|
||||
self.setupSpinBox(self.formTags.sbCount, len(self.obj.Positions), None)
|
||||
self.setupSpinBox(self.formTags.dsbHeight, self.obj.Height)
|
||||
self.setupSpinBox(self.formTags.dsbWidth, self.obj.Width)
|
||||
self.formTags.ifHeight.setText(FreeCAD.Units.Quantity(self.obj.Height, FreeCAD.Units.Length).UserString)
|
||||
self.formTags.ifWidth.setText(FreeCAD.Units.Quantity(self.obj.Width, FreeCAD.Units.Length).UserString)
|
||||
self.setupSpinBox(self.formTags.dsbAngle, self.obj.Angle, 0)
|
||||
self.formTags.dsbAngle.setMaximum(90)
|
||||
self.formTags.dsbAngle.setSingleStep(5.)
|
||||
|
||||
def updateModelHeight(self):
|
||||
print('updateModelHeight')
|
||||
|
@ -1031,8 +1029,8 @@ class TaskPanel:
|
|||
self.formTags.sbCount.valueChanged.connect(self.whenCountChanged)
|
||||
self.formTags.pbGenerate.clicked.connect(self.generateNewTags)
|
||||
|
||||
self.formTags.dsbHeight.editingFinished.connect(self.updateModelHeight)
|
||||
self.formTags.dsbWidth.editingFinished.connect(self.updateModelWidth)
|
||||
self.formTags.ifHeight.editingFinished.connect(self.updateModelHeight)
|
||||
self.formTags.ifWidth.editingFinished.connect(self.updateModelWidth)
|
||||
self.formTags.dsbAngle.editingFinished.connect(self.updateModelAngle)
|
||||
self.formTags.lwTags.itemChanged.connect(self.updateModelTags)
|
||||
self.formTags.lwTags.itemSelectionChanged.connect(self.whenTagSelectionChanged)
|
||||
|
|
Loading…
Reference in New Issue
Block a user