Branch: refs/heads/master
Home: https://github.com/LinuxCNC/linuxcnc
Commit: f4e3d938fec82e59b26e7e9463a6aa284f0d7c61
https://github.com/LinuxCNC/linuxcnc/commit/f4e3d938fec82e59b26e7e9463a6aa284f0d7c61
Author: Maximilian Heise <760...@us...>
Date: 2026-10-05 (Mon, 05 Oct 2026)
Changed paths:
M docs/src/gui/pyvcp.adoc
M lib/python/pyvcp_widgets.py
M tests/pyvcp/expected
M tests/pyvcp/test.xml
Log Message:
-----------
pyvcp: add an optional reset button to the spinbox widget
The pyvcp spinbox controls a float pin, but once its value has been
moved there is no way back to the value the panel started with other
than typing that value in again. This adds two optional XML tags to
the widget in lib/python/pyvcp_widgets.py, class pyvcp_spinbox:
<reset_button>1</reset_button>
<reset_text>"back to zero"</reset_text>
<reset_button> places a button directly below the spinbox. Clicking it
calls the new method reset_to_init(), which puts the value given by
<initval> back into the widget variable, so the display changes at once
and the next update() cycle carries that value out to the HAL pin.
<reset_text> sets the label on the button and defaults to "reset".
Neither tag has any effect unless it appears in the panel XML, so every
existing panel behaves exactly as it did.
Mechanically the class changes from a Spinbox into a Frame that holds
the Spinbox as self.sb, because a Tk widget cannot carry a sibling
inside itself. The spinbox is packed to fill that frame completely, so
a panel without the new tags lays the spinbox out in the same rectangle
as before. Every keyword the widget already accepted (halpin, halparam,
param_pin, min_, max_, initval, resolution, format, and anything passed
on through **kw) still reaches the spinbox unchanged. The mouse-wheel
and Return bindings move from the widget itself to the inner spinbox,
which is where the pointer and the keyboard focus actually are. The
param_pin path is untouched: an external writer still drives the value
through the parameter pin, and the reset button returns to <initval>
rather than to the last value that pin delivered. The value remembered
for the reset is the one that survived the existing min_/max_ clamping,
so an <initval> outside the range resets to the clamped value.
The use case is a machine integration panel. An analog output setpoint
is nudged up and down with the mouse wheel while a drive or an axis is
being commissioned, and the operator must be able to snap that setpoint
back to its safe initial value with a single click instead of typing it.
docs/src/gui/pyvcp.adoc describes both tags in the Spinbox section and
gains a short XML example that uses them.
tests/pyvcp/test.xml gains a fifth spinbox that sets both tags, and
tests/pyvcp/expected its one output pin, so the existing pyvcp
regression test also builds the reset button.
I used that code with my cnc machine integration panel and it worked.
Commit: 6c300638fdb2863ec376c49c59e25136aab75e9a
https://github.com/LinuxCNC/linuxcnc/commit/6c300638fdb2863ec376c49c59e25136aab75e9a
Author: Luca Toniolo <107...@us...>
Date: 2026-10-11 (Sun, 11 Oct 2026)
Changed paths:
M docs/src/gui/pyvcp.adoc
M lib/python/pyvcp_widgets.py
M tests/pyvcp/expected
M tests/pyvcp/test.xml
Log Message:
-----------
Merge pull request #4640 from maxheise/pyvcp-spinbox-reset-button
pyvcp: add an optional reset button to the spinbox widget
Compare: https://github.com/LinuxCNC/linuxcnc/compare/fbae6548b670...6c300638fdb2
To unsubscribe from these emails, change your notification settings at https://github.com/LinuxCNC/linuxcnc/settings/notifications
|