Skip to content

Commit

Permalink
change prefUnit spin box to Quantity spin box
Browse files Browse the repository at this point in the history
  • Loading branch information
shaise committed Dec 4, 2024
1 parent f584135 commit 2ce9600
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 33 deletions.
9 changes: 2 additions & 7 deletions Resources/panels/BendOnLinePanel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::PrefUnitSpinBox" name="unitBendRadius" native="true"/>
<widget class="Gui::QuantitySpinBox" name="unitBendRadius" native="true"/>
</item>
<item row="1" column="1">
<widget class="Gui::PrefUnitSpinBox" name="unitBendAngle" native="true"/>
<widget class="Gui::QuantitySpinBox" name="unitBendAngle" native="true"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
Expand Down Expand Up @@ -125,11 +125,6 @@
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefUnitSpinBox</class>
<extends>Gui::QuantitySpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down
11 changes: 3 additions & 8 deletions Resources/panels/CornerReliefPanel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::PrefUnitSpinBox" name="unitXOffset" native="true">
<widget class="Gui::QuantitySpinBox" name="unitXOffset" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand All @@ -196,7 +196,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::PrefUnitSpinBox" name="unitYOffset" native="true">
<widget class="Gui::QuantitySpinBox" name="unitYOffset" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -282,7 +282,7 @@
</widget>
</item>
<item>
<widget class="Gui::PrefUnitSpinBox" name="unitReliefSize" native="true">
<widget class="Gui::QuantitySpinBox" name="unitReliefSize" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -398,11 +398,6 @@
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefUnitSpinBox</class>
<extends>Gui::QuantitySpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::DoubleSpinBox</class>
<extends>QWidget</extends>
Expand Down
9 changes: 2 additions & 7 deletions Resources/panels/ExtrudedCutoutPanel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
</widget>
</item>
<item>
<widget class="Gui::PrefUnitSpinBox" name="unitLengthA" native="true">
<widget class="Gui::QuantitySpinBox" name="unitLengthA" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -240,7 +240,7 @@
</widget>
</item>
<item>
<widget class="Gui::PrefUnitSpinBox" name="unitLengthB" native="true">
<widget class="Gui::QuantitySpinBox" name="unitLengthB" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -352,11 +352,6 @@
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefUnitSpinBox</class>
<extends>Gui::QuantitySpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
<customwidget>
<class>Gui::IntSpinBox</class>
<extends>QWidget</extends>
Expand Down
15 changes: 5 additions & 10 deletions Resources/panels/StampPanel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::PrefUnitSpinBox" name="unitOffsetX"/>
<widget class="Gui::QuantitySpinBox" name="unitOffsetX"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
Expand All @@ -86,7 +86,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::PrefUnitSpinBox" name="unitOffsetY"/>
<widget class="Gui::QuantitySpinBox" name="unitOffsetY"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
Expand All @@ -96,7 +96,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::PrefUnitSpinBox" name="unitOffsetZ"/>
<widget class="Gui::QuantitySpinBox" name="unitOffsetZ"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
Expand All @@ -106,7 +106,7 @@
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefUnitSpinBox" name="unitAngle"/>
<widget class="Gui::QuantitySpinBox" name="unitAngle"/>
</item>
</layout>
</widget>
Expand All @@ -128,7 +128,7 @@
</widget>
</item>
<item row="0" column="3">
<widget class="Gui::PrefUnitSpinBox" name="unitThickness"/>
<widget class="Gui::QuantitySpinBox" name="unitThickness"/>
</item>
</layout>
</widget>
Expand All @@ -154,11 +154,6 @@
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::PrefUnitSpinBox</class>
<extends>Gui::QuantitySpinBox</extends>
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down
9 changes: 8 additions & 1 deletion SheetMetalTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,21 @@ def taskSingleSelectionChanged(button):

def _taskUpdateValue(value, obj, objvar, callback):
setattr(obj, objvar, value)
obj.Document.recompute()
try: # avoid intermitant changes
obj.Document.recompute()
except:
pass
if callback is not None:
callback(value)

def _taskEditFinished(obj):
obj.Document.recompute()

def taskConnectSpin(task, formvar, objvar, callback = None):
formvar.setProperty("value", getattr(task.obj, objvar))
Gui.ExpressionBinding(formvar).bind(task.obj, objvar)
formvar.valueChanged.connect(lambda value: _taskUpdateValue(value, task.obj, objvar, callback))
formvar.editingFinished.connect(lambda: _taskEditFinished(task.obj))

def taskConnectCheck(task, formvar, objvar, callback = None):
formvar.setChecked(getattr(task.obj, objvar))
Expand Down

0 comments on commit 2ce9600

Please sign in to comment.