Part: [skip ci] make quantity fields in Python attachment dialog expressen aware

This commit is contained in:
wmayer
2020-03-25 19:56:41 +01:00
parent ba99c8ad6e
commit 82e6d44f43
2 changed files with 26 additions and 15 deletions

View File

@@ -227,6 +227,17 @@ class AttachmentEditorTaskPanel(FrozenClass):
self.form.setWindowIcon(QtGui.QIcon(':/icons/Part_Attachment.svg'))
self.form.setWindowTitle(_translate('AttachmentEditor',"Attachment",None))
self.form.attachmentOffsetX.setProperty("unit", "mm")
self.form.attachmentOffsetY.setProperty("unit", "mm")
self.form.attachmentOffsetZ.setProperty("unit", "mm")
Gui.ExpressionBinding(self.form.attachmentOffsetX).bind(self.obj,"AttachmentOffset.Base.x")
Gui.ExpressionBinding(self.form.attachmentOffsetY).bind(self.obj,"AttachmentOffset.Base.y")
Gui.ExpressionBinding(self.form.attachmentOffsetZ).bind(self.obj,"AttachmentOffset.Base.z")
Gui.ExpressionBinding(self.form.attachmentOffsetYaw).bind(self.obj,"AttachmentOffset.Rotation.Yaw")
Gui.ExpressionBinding(self.form.attachmentOffsetPitch).bind(self.obj,"AttachmentOffset.Rotation.Pitch")
Gui.ExpressionBinding(self.form.attachmentOffsetRoll).bind(self.obj,"AttachmentOffset.Rotation.Roll")
self.refLines = [self.form.lineRef1,
self.form.lineRef2,
self.form.lineRef3,
@@ -437,12 +448,12 @@ class AttachmentEditorTaskPanel(FrozenClass):
try:
old_selfblock = self.block
self.block = True
self.form.attachmentOffsetX.setText ((plm.Base.x * mm).UserString)
self.form.attachmentOffsetY.setText ((plm.Base.y * mm).UserString)
self.form.attachmentOffsetZ.setText ((plm.Base.z * mm).UserString)
self.form.attachmentOffsetYaw.setText ((plm.Rotation.toEuler()[0] * deg).UserString)
self.form.attachmentOffsetPitch.setText((plm.Rotation.toEuler()[1] * deg).UserString)
self.form.attachmentOffsetRoll.setText ((plm.Rotation.toEuler()[2] * deg).UserString)
self.form.attachmentOffsetX.lineEdit().setText ((plm.Base.x * mm).UserString)
self.form.attachmentOffsetY.lineEdit().setText ((plm.Base.y * mm).UserString)
self.form.attachmentOffsetZ.lineEdit().setText ((plm.Base.z * mm).UserString)
self.form.attachmentOffsetYaw.lineEdit().setText ((plm.Rotation.toEuler()[0] * deg).UserString)
self.form.attachmentOffsetPitch.lineEdit().setText((plm.Rotation.toEuler()[1] * deg).UserString)
self.form.attachmentOffsetRoll.lineEdit().setText ((plm.Rotation.toEuler()[2] * deg).UserString)
self.form.checkBoxFlip.setChecked(self.attacher.Reverse)

View File

@@ -154,7 +154,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::InputField" name="attachmentOffsetY">
<widget class="Gui::QuantitySpinBox" name="attachmentOffsetY">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -186,7 +186,7 @@
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::InputField" name="attachmentOffsetZ">
<widget class="Gui::QuantitySpinBox" name="attachmentOffsetZ">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -244,7 +244,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::InputField" name="attachmentOffsetX">
<widget class="Gui::QuantitySpinBox" name="attachmentOffsetX">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -263,7 +263,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="Gui::InputField" name="attachmentOffsetRoll">
<widget class="Gui::QuantitySpinBox" name="attachmentOffsetRoll">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -295,7 +295,7 @@ Note: The placement is expressed in local space of object being attached.</strin
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::InputField" name="attachmentOffsetPitch">
<widget class="Gui::QuantitySpinBox" name="attachmentOffsetPitch">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -327,7 +327,7 @@ Note: The placement is expressed in local space of object being attached.</strin
</widget>
</item>
<item row="6" column="1">
<widget class="Gui::InputField" name="attachmentOffsetYaw">
<widget class="Gui::QuantitySpinBox" name="attachmentOffsetYaw">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -372,9 +372,9 @@ Note: The placement is expressed in local space of object being attached.</strin
</widget>
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>