Skip to content

Commit

Permalink
qtvcp -qt5_graphics: allow magic comments notify to print to terminal
Browse files Browse the repository at this point in the history
(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.
  • Loading branch information
c-morley committed Jul 15, 2022
1 parent 46309b1 commit 0ccb307
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/emc/usr_intf/gremlin/qt5_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,15 @@ def check_abort(self):
def next_line(self, st):
glcanon.GLCanon.next_line(self, st)
self.progress.update(self.lineno)
# not sure if this is used - copied from AXIS code
if self.notify:
print("info",self.notify_message)
self.output_notify_message(self.notify_message)
self.notify = 0

# this is class patched
# output the text from the magic comment eg: (PREVEIW,notify,The text)
def output_notify_message(self, message):
pass

###############################
# widget for graphics plotting
###############################
Expand Down Expand Up @@ -344,6 +348,7 @@ def load(self,filename = None):

lines = open(filename).readlines()
progress = Progress(2, len(lines))
# monkey patch function to call ours
progress.emit_percent = self.emit_percent

code = []
Expand Down Expand Up @@ -371,6 +376,8 @@ def load(self,filename = None):
self.lathe_option,
s, text, random, i,
progress, arcdivision)
# monkey patched function to call ours
canon.output_notify_message = self.output_notify_message
parameter = self.inifile.find("RS274NGC", "PARAMETER_FILE")
temp_parameter = os.path.join(td, os.path.basename(parameter or "linuxcnc.var"))
if parameter:
Expand All @@ -397,6 +404,11 @@ def load(self,filename = None):
pass
self._redraw()

# monkey patched function from StatCanon class
def output_notify_message(self, message):
print("Preview Notify:", message)

# monkey patched function from Progess class
def emit_percent(self, percent):
self.percentLoaded.emit(percent)

Expand Down

0 comments on commit 0ccb307

Please sign in to comment.