Skip to content

Commit 4c2092e

Browse files
committed
PrintAndCutWizard: add distance preset buttons for quick selection #244
1 parent d8c8f5a commit 4c2092e

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

  • rayforge/builtin_addons/rayforge-addon-print-and-cut/print_and_cut

rayforge/builtin_addons/rayforge-addon-print-and-cut/print_and_cut/wizard.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(
6262
super().__init__(
6363
transient_for=parent,
6464
default_width=1150,
65-
default_height=750,
65+
default_height=780,
6666
title=_("Print & Cut"),
6767
**kwargs,
6868
)
@@ -283,6 +283,14 @@ def _setup_jog_panel(self):
283283
self._distance_row.connect("changed", self._on_distance_changed)
284284
controls_group.add(self._distance_row)
285285

286+
presets_row = Adw.ActionRow(title=_("Distance Presets"))
287+
controls_group.add(presets_row)
288+
289+
for value in [0.1, 1.0, 10.0]:
290+
btn = Gtk.Button(label=str(value), valign=Gtk.Align.CENTER)
291+
btn.connect("clicked", self._on_preset_clicked, value)
292+
presets_row.add_suffix(btn)
293+
286294
self._focus_active = False
287295
self._focus_on_icon = get_icon("laser-on-symbolic")
288296
self._focus_off_icon = get_icon("laser-off-symbolic")
@@ -602,6 +610,10 @@ def _update_laser_position(self):
602610
def _on_distance_changed(self, spin_row):
603611
self._jog_widget.jog_distance = get_spinrow_float(spin_row)
604612

613+
def _on_preset_clicked(self, button, value):
614+
self._distance_row.get_adjustment().set_value(value)
615+
self._on_distance_changed(self._distance_row)
616+
605617
def _on_focus_toggled(self, button):
606618
if not self._machine or not self._machine_cmd:
607619
return

0 commit comments

Comments
 (0)