Skip to content

Commit 5e323c5

Browse files
committed
hal_glib - add runstop-line-changed signal
emits last running linenumber when linuxcnc estops or stops (in auto mode)
1 parent b0e84bb commit 5e323c5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/python/hal_glib.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class _GStat(GObject.GObject):
139139
'file-loaded': (GObject.SignalFlags.RUN_FIRST , GObject.TYPE_NONE, (GObject.TYPE_STRING,)),
140140
'reload-display': (GObject.SignalFlags.RUN_FIRST , GObject.TYPE_NONE, ()),
141141
'line-changed': (GObject.SignalFlags.RUN_FIRST , GObject.TYPE_NONE, (GObject.TYPE_INT,)),
142+
'runstop-line-changed': (GObject.SignalFlags.RUN_FIRST , GObject.TYPE_NONE, (GObject.TYPE_INT,)),
142143

143144
'tool-in-spindle-changed': (GObject.SignalFlags.RUN_FIRST , GObject.TYPE_NONE, (GObject.TYPE_INT,)),
144145
'tool-prep-changed': (GObject.SignalFlags.RUN_FIRST , GObject.TYPE_NONE, (GObject.TYPE_INT,)),
@@ -528,7 +529,15 @@ def update(self):
528529
if interp_new != interp_old:
529530
if not interp_old or interp_old == linuxcnc.INTERP_IDLE:
530531
self.emit('interp-run')
532+
# if processing has stoped:
533+
elif interp_new == linuxcnc.INTERP_IDLE:
534+
# only in auto mode
535+
if mode_old == linuxcnc.MODE_AUTO:
536+
# we stopped, emit last line number that was running
537+
self.emit('runstop-line-changed',old.get('line', None))
538+
# emit interpeter state
531539
self.emit(self.INTERP[interp_new])
540+
532541
# paused
533542
paused_old = old.get('paused', None)
534543
paused_new = self.old['paused']

0 commit comments

Comments
 (0)