Assembly: Improve joint taskbox offset ui.

This commit is contained in:
PaddleStroke
2024-11-05 11:15:21 +01:00
committed by Chris Hennes
parent ca0549d489
commit bf64ab9f51
2 changed files with 127 additions and 127 deletions

View File

@@ -82,123 +82,106 @@
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_offsets">
<property name="title">
<string>Attachement offsets</string>
<layout class="QHBoxLayout" name="hLayout">
<item>
<widget class="QLabel" name="offsetLabel">
<property name="text">
<string>Offset</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="offsetSpinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0" colspan="2">
<layout class="QHBoxLayout" name="hLayoutRotation">
<item>
<widget class="QLabel" name="rotationLabel">
<property name="text">
<string>Rotation</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="rotationSpinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<layout class="QHBoxLayout" name="hLayoutOffset1">
<item>
<widget class="QLabel" name="offset1Label">
<property name="text">
<string>Offset1</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="offset1Button">
<property name="toolTip">
<string>By clicking this button, you can set the attachement offset of the first marker (coordinate system) of the joint.</string>
</property>
<property name="text">
<string></string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0" colspan="2">
<layout class="QHBoxLayout" name="hLayoutOffset2">
<item>
<widget class="QLabel" name="offset2Label">
<property name="text">
<string>Offset2</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="offset2Button">
<property name="toolTip">
<string>By clicking this button, you can set the attachement offset of the second marker (coordinate system) of the joint.</string>
</property>
<property name="text">
<string></string>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="advancedOffsetCheckbox">
<property name="text">
<string>Show advanced offsets</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="layout_offset_group">
<item>
<widget class="QTabWidget" name="offsetTabs">
<widget class="QWidget" name="tabSimple">
<attribute name="title">
<string>Simple</string>
</attribute>
<layout class="QVBoxLayout" name="layout_tabSimple">
<item>
<layout class="QHBoxLayout" name="hLayout">
<item>
<widget class="QLabel" name="offsetLabel">
<property name="text">
<string>Offset</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="offsetSpinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="hLayoutRotation">
<item>
<widget class="QLabel" name="rotationLabel">
<property name="text">
<string>Rotation</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="rotationSpinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="unit" stdset="0">
<string notr="true">deg</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabAdvanced">
<attribute name="title">
<string>Advanced</string>
</attribute>
<layout class="QVBoxLayout" name="layout_tabAdvanced">
<item>
<layout class="QHBoxLayout" name="hLayoutOffset1">
<item>
<widget class="QLabel" name="offset1Label">
<property name="text">
<string>Offset1</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="offset1Button">
<property name="toolTip">
<string>By clicking this button, you can set the attachement offset of the first marker (coordinate system) of the joint.</string>
</property>
<property name="text">
<string></string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="hLayoutOffset2">
<item>
<widget class="QLabel" name="offset2Label">
<property name="text">
<string>Offset2</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="offset2Button">
<property name="toolTip">
<string>By clicking this button, you can set the attachement offset of the second marker (coordinate system) of the joint.</string>
</property>
<property name="text">
<string></string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<item row="9" column="0">
<widget class="QToolButton" name="PushButtonReverse">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -218,7 +201,7 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="10" column="0">
<widget class="QGroupBox" name="groupBox_limits">
<property name="title">
<string>Limits</string>
@@ -331,7 +314,7 @@
</layout>
</widget>
</item>
<item row="8" column="0">
<item row="11" column="0">
<widget class="QCheckBox" name="reverseRotCheckbox">
<property name="text">
<string>Reverse rotation</string>

View File

@@ -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):