Skip to content

Commit 02b0f29

Browse files
committed
gmoccapy: ignore last line to show 100% at program end
The "M2" command (program end) is usually the last line, so the progress will not reach 100% if this line is taken into account.
1 parent 0fd2ef5 commit 02b0f29

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/emc/usr_intf/gmoccapy/gmoccapy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,11 @@ def on_hal_status_line_changed(self, widget, line):
25742574
else:
25752575
self.halcomp["program.progress"] = 0.0
25762576

2577-
self.widgets.progressbar_pgm.set_fraction(self.halcomp["program.progress"] / 100)
2577+
# The program length used for the progress calculation is decreased here by 1 because
2578+
# the last line doesn't emit a line-changed signal.
2579+
progress = line / (self.halcomp["program.length"]-1)
2580+
if progress > 1.0: progress = 1.0
2581+
self.widgets.progressbar_pgm.set_fraction(progress)
25782582

25792583
def on_hal_status_interp_idle(self, widget):
25802584
LOG.debug("IDLE")
@@ -2627,7 +2631,6 @@ def on_hal_status_interp_idle(self, widget):
26272631

26282632
self.halcomp["program.current-line"] = 0
26292633
self.halcomp["program.progress"] = 0.0
2630-
self.widgets.progressbar_pgm.set_fraction(0)
26312634

26322635
def on_hal_status_interp_run(self, widget):
26332636
LOG.debug("RUN")

0 commit comments

Comments
 (0)