From bf64ab9f51b82fef6e1886dca7ab4f7e9ee22bfe Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Tue, 5 Nov 2024 11:15:21 +0100 Subject: [PATCH] Assembly: Improve joint taskbox offset ui. --- .../panels/TaskAssemblyCreateJoint.ui | 215 ++++++++---------- src/Mod/Assembly/JointObject.py | 39 +++- 2 files changed, 127 insertions(+), 127 deletions(-) diff --git a/src/Mod/Assembly/Gui/Resources/panels/TaskAssemblyCreateJoint.ui b/src/Mod/Assembly/Gui/Resources/panels/TaskAssemblyCreateJoint.ui index 2f60f15fb1..596f540aae 100644 --- a/src/Mod/Assembly/Gui/Resources/panels/TaskAssemblyCreateJoint.ui +++ b/src/Mod/Assembly/Gui/Resources/panels/TaskAssemblyCreateJoint.ui @@ -82,123 +82,106 @@ - - - Attachement offsets + + + + + Offset + + + + + + + + 0 + 0 + + + + mm + + + + + + + + + + + Rotation + + + + + + + + 0 + 0 + + + + deg + + + + + + + + + + + Offset1 + + + + + + + By clicking this button, you can set the attachement offset of the first marker (coordinate system) of the joint. + + + + + + + + + + + + + + Offset2 + + + + + + + By clicking this button, you can set the attachement offset of the second marker (coordinate system) of the joint. + + + + + + + + + + + + Show advanced offsets + + + false - - - - - - Simple - - - - - - - - Offset - - - - - - - - 0 - 0 - - - - mm - - - - - - - - - - - Rotation - - - - - - - - 0 - 0 - - - - deg - - - - - - - - - - Advanced - - - - - - - - Offset1 - - - - - - - By clicking this button, you can set the attachement offset of the first marker (coordinate system) of the joint. - - - - - - - - - - - - - - Offset2 - - - - - - - By clicking this button, you can set the attachement offset of the second marker (coordinate system) of the joint. - - - - - - - - - - - - - - + @@ -218,7 +201,7 @@ - + Limits @@ -331,7 +314,7 @@ - + Reverse rotation diff --git a/src/Mod/Assembly/JointObject.py b/src/Mod/Assembly/JointObject.py index 5a6ebac9b5..c03627bb12 100644 --- a/src/Mod/Assembly/JointObject.py +++ b/src/Mod/Assembly/JointObject.py @@ -1216,7 +1216,7 @@ class TaskAssemblyCreateJoint(QtCore.QObject): self.form.reverseRotCheckbox.setChecked(self.jType == "Gears") self.form.reverseRotCheckbox.stateChanged.connect(self.reverseRotToggled) - self.form.offsetTabs.currentChanged.connect(self.on_offset_tab_changed) + self.form.advancedOffsetCheckbox.stateChanged.connect(self.advancedOffsetToggled) if jointObj: Gui.Selection.clearSelection() @@ -1494,19 +1494,35 @@ class TaskAssemblyCreateJoint(QtCore.QObject): self.form.distanceSpinbox.setProperty("minimum", float("-inf")) self.form.distanceSpinbox2.setProperty("minimum", float("-inf")) - if jType in JointUsingOffset: - self.form.offsetLabel.show() - self.form.offsetSpinbox.show() - else: + if self.form.advancedOffsetCheckbox.isChecked(): + self.form.offset1Label.show() + self.form.offset2Label.show() + self.form.offset1Button.show() + self.form.offset2Button.show() + self.form.offsetLabel.hide() self.form.offsetSpinbox.hide() - - if jType in JointUsingRotation: - self.form.rotationLabel.show() - self.form.rotationSpinbox.show() - else: self.form.rotationLabel.hide() self.form.rotationSpinbox.hide() + else: + self.form.offset1Label.hide() + self.form.offset2Label.hide() + self.form.offset1Button.hide() + self.form.offset2Button.hide() + + if jType in JointUsingOffset: + self.form.offsetLabel.show() + self.form.offsetSpinbox.show() + else: + self.form.offsetLabel.hide() + self.form.offsetSpinbox.hide() + + if jType in JointUsingRotation: + self.form.rotationLabel.show() + self.form.rotationSpinbox.show() + else: + self.form.rotationLabel.hide() + self.form.rotationSpinbox.hide() if jType in JointUsingReverse: self.form.PushButtonReverse.show() @@ -1574,7 +1590,8 @@ class TaskAssemblyCreateJoint(QtCore.QObject): ) self.blockOffsetRotation = False - def on_offset_tab_changed(self): + def advancedOffsetToggled(self, on): + self.adaptUi() self.updateOffsetWidgets() def onOffset1Clicked(self):