Skip to content

Commit 4788f77

Browse files
committed
Gmoccapy: Add user confirmation on leaving tooltable with active tool offset changed
1 parent 354d91e commit 4788f77

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/emc/usr_intf/gmoccapy/gmoccapy.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4736,6 +4736,24 @@ def on_btn_back_clicked(self, widget, data=None):
47364736
result = self.dialogs.yesno_dialog(self, message, _("Attention!"))
47374737
if not result: # user says no, he want to save
47384738
return
4739+
# check if offset values for current tool have been changed
4740+
tt = self.stat.tool_table[0]
4741+
new_offset = (tt.xoffset, tt.yoffset, tt.zoffset,
4742+
tt.aoffset, tt.boffset, tt.coffset,
4743+
tt.uoffset, tt.voffset, tt.woffset)
4744+
if (new_offset != self.stat.tool_offset) and ("G43" in self.active_gcodes):
4745+
message = _("Offset values for the tool in the spindle\n" \
4746+
"have been changed whith tool compensation (G43) active.\n\n" \
4747+
"Do you want the new values to be applied as the currently\n" \
4748+
"active tool offset?")
4749+
result = self.dialogs.yesno_dialog(self, message, _("Attention!"))
4750+
if result: # user says YES
4751+
self.command.mode(linuxcnc.MODE_MDI)
4752+
self.command.wait_complete()
4753+
self.command.mdi("G43")
4754+
self.command.wait_complete()
4755+
self.command.mode(linuxcnc.MODE_MANUAL)
4756+
self.command.wait_complete()
47394757
self.widgets.ntb_button.set_current_page(_BB_MANUAL)
47404758
self.widgets.ntb_main.set_current_page(0)
47414759
self.widgets.ntb_preview.set_current_page(0)

0 commit comments

Comments
 (0)