Skip to content

Commit 0fd2ef5

Browse files
committed
gmoccapy: switch file-loaded signal to GStat
The EMC_Stat signal 'file-loaded' is only emitted on a file load event. This leads to an improper value of the pin 'program.length' if a file has been edited or reloaded. The GStat signal 'file-loaded' is also emitted on a reload.
1 parent 88b5a75 commit 0fd2ef5

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/emc/usr_intf/gmoccapy/gmoccapy.glade

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@
179179
<object class="EMC_Action_Stop" id="hal_action_stop"/>
180180
<object class="EMC_Stat" id="hal_status">
181181
<signal name="all-homed" handler="on_hal_status_all_homed" swapped="no"/>
182-
<signal name="file-loaded" handler="on_hal_status_file_loaded" swapped="no"/>
183182
<signal name="hard-limits-tripped" handler="on_hal_status_limits_tripped" swapped="no"/>
184183
<signal name="interp-idle" handler="on_hal_status_interp_idle" swapped="no"/>
185184
<signal name="interp-run" handler="on_hal_status_interp_run" swapped="no"/>

src/emc/usr_intf/gmoccapy/gmoccapy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ def __init__(self, argv):
406406

407407
GSTAT = hal_glib.GStat()
408408
GSTAT.connect("graphics-gcode-properties", self.on_gcode_properties)
409+
GSTAT.connect("file-loaded", self.on_hal_status_file_loaded)
409410

410411
# get if run from line should be used
411412
rfl = self.prefs.getpref("run_from_line", "no_run", str)
@@ -4027,6 +4028,8 @@ def on_gcode_properties(self, widget, data):
40274028
self.widgets.lbl_gcode_x.set_text(data['x'])
40284029
self.widgets.lbl_gcode_y.set_text(data['y'])
40294030
self.widgets.lbl_gcode_z.set_text(data['z'])
4031+
# alternative way to calculate program length
4032+
# self.halcomp["program.length"] = int(data['size'].split("\n")[1].split(" ")[0] )
40304033

40314034
def on_ntb_tool_code_info_switch_page(self, widget, page, page_num):
40324035
self.prefs.putpref("info_tab_page", page_num, int)

0 commit comments

Comments
 (0)