From 82e6d44f436c286d90c3211bab0f8f39df11f011 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 25 Mar 2020 19:56:41 +0100 Subject: [PATCH] Part: [skip ci] make quantity fields in Python attachment dialog expressen aware --- .../AttachmentEditor/TaskAttachmentEditor.py | 23 ++++++++++++++----- .../AttachmentEditor/TaskAttachmentEditor.ui | 18 +++++++-------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py b/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py index ddb8a77f37..33e6ece843 100644 --- a/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py +++ b/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py @@ -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) diff --git a/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.ui b/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.ui index 5dd8174005..f685fe6e7c 100644 --- a/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.ui +++ b/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.ui @@ -154,7 +154,7 @@ - + 0 @@ -186,7 +186,7 @@ - + 0 @@ -244,7 +244,7 @@ - + 0 @@ -263,7 +263,7 @@ - + 0 @@ -295,7 +295,7 @@ Note: The placement is expressed in local space of object being attached. - + 0 @@ -327,7 +327,7 @@ Note: The placement is expressed in local space of object being attached. - + 0 @@ -372,9 +372,9 @@ Note: The placement is expressed in local space of object being attached. - Gui::InputField - QLineEdit -
Gui/InputField.h
+ Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h