Skip to content

Commit 0ccb307

Browse files
committed
qtvcp -qt5_graphics: allow magic comments notify to print to terminal
(PREVIEW,notify, some test) in gcode should print the text. Most of the code was present but at the time I didn't inderstand what the code was used for. Now it will print to the terminal. It could be overriden in gcode_graphics.py to do something else, thought I'm not sure what it is really useful for - debugging? it only prints when the gcode is loaded.
1 parent 46309b1 commit 0ccb307

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/emc/usr_intf/gremlin/qt5_graphics.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,15 @@ def check_abort(self):
170170
def next_line(self, st):
171171
glcanon.GLCanon.next_line(self, st)
172172
self.progress.update(self.lineno)
173-
# not sure if this is used - copied from AXIS code
174173
if self.notify:
175-
print("info",self.notify_message)
174+
self.output_notify_message(self.notify_message)
176175
self.notify = 0
177176

177+
# this is class patched
178+
# output the text from the magic comment eg: (PREVEIW,notify,The text)
179+
def output_notify_message(self, message):
180+
pass
181+
178182
###############################
179183
# widget for graphics plotting
180184
###############################
@@ -344,6 +348,7 @@ def load(self,filename = None):
344348

345349
lines = open(filename).readlines()
346350
progress = Progress(2, len(lines))
351+
# monkey patch function to call ours
347352
progress.emit_percent = self.emit_percent
348353

349354
code = []
@@ -371,6 +376,8 @@ def load(self,filename = None):
371376
self.lathe_option,
372377
s, text, random, i,
373378
progress, arcdivision)
379+
# monkey patched function to call ours
380+
canon.output_notify_message = self.output_notify_message
374381
parameter = self.inifile.find("RS274NGC", "PARAMETER_FILE")
375382
temp_parameter = os.path.join(td, os.path.basename(parameter or "linuxcnc.var"))
376383
if parameter:
@@ -397,6 +404,11 @@ def load(self,filename = None):
397404
pass
398405
self._redraw()
399406

407+
# monkey patched function from StatCanon class
408+
def output_notify_message(self, message):
409+
print("Preview Notify:", message)
410+
411+
# monkey patched function from Progess class
400412
def emit_percent(self, percent):
401413
self.percentLoaded.emit(percent)
402414

0 commit comments

Comments
 (0)