Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/emc/usr_intf/gmoccapy/gmoccapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def __init__(self, argv):
self.distance = 0 # This global will hold the jog distance
self.tool_change = False # this is needed to get back to manual mode after a tool change
self.load_tool = False # We use this avoid mode switching on reloading the tool on start up of the GUI
self.apply_tool_changes = False # We use this avoid mode switching on reactivation G43 during Aplly tooltable
self.macrobuttons = [] # The list of all macros defined in the INI file
self.fo_counts = 0 # need to calculate difference in counts to change the feed override slider
self.so_counts = 0 # need to calculate difference in counts to change the spindle override slider
Expand Down Expand Up @@ -2776,6 +2777,10 @@ def on_hal_status_limits_tripped(self, object, state, lst_limits):
self.widgets.chk_ignore_limits.set_active(False)

def on_hal_status_mode_manual(self, widget):
if self.apply_tool_changes:
LOG.debug("switch to Manual page is ignored, because reactivation G43 is running during Apply tooltable")
return

LOG.debug("MANUAL Mode")
self.widgets.rbt_manual.set_active(True)
# if setup page is activated, we must leave here, otherwise the pages will be reset
Expand All @@ -2798,6 +2803,10 @@ def on_hal_status_mode_manual(self, widget):
self.last_key_event = None, 0

def on_hal_status_mode_mdi(self, widget):
if self.apply_tool_changes:
LOG.debug("switch to MDI page is ignored, because reactivation G43 is running during Apply tooltable")
return

LOG.debug("MDI Mode, tool_change = {0}".format(self.tool_change))

# if the edit offsets button is active, we do not want to change
Expand Down Expand Up @@ -5064,9 +5073,32 @@ def on_btn_reload_tooltable_clicked(self, widget, data=None):
self.widgets.tooledit1.set_selected_tool(self.stat.tool_in_spindle)

def on_btn_apply_tool_changes_clicked(self, widget, data=None):
self.apply_tool_changes = True # Disable switch pages

self.widgets.tooledit1.save(None)
self.widgets.tooledit1.set_selected_tool(self.stat.tool_in_spindle)

# Reactivate G43 to update offset Z and offset Y
if "G43" in self.active_gcodes:
self.command.wait_complete()
self.command.mode(linuxcnc.MODE_MDI)
self.command.wait_complete()
self.command.mdi("G43")
self.command.wait_complete()
self.command.mode(linuxcnc.MODE_MANUAL)
self.command.wait_complete()

# GUI update
self.stat.poll()
toolinfo = self.widgets.tooledit1.get_toolinfo(self.stat.tool_in_spindle)
if toolinfo:
self.widgets.lbl_tool_no.set_text(str(toolinfo[1]))
self.widgets.lbl_tool_dia.set_text(toolinfo[12])
self.halcomp["tool-diameter"] = float(locale.atof(toolinfo[12]))
self.widgets.lbl_tool_name.set_text(toolinfo[16])

self.apply_tool_changes = False # Enable switch pages

def on_btn_tool_touchoff_clicked(self, widget, data=None):
if not self.widgets.tooledit1.get_selected_tool():
message = _("No or multiple tools selected in the tool table. ")
Expand Down
Loading