Skip to content

Commit dc003a4

Browse files
committed
qtvcp -load gcode: give a return value for pass/fail of loading.
1 parent f0184b7 commit dc003a4

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/python/qtvcp/widgets/gcode_graphics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,11 @@ def set_view_signal(self, view, args):
217217
def load_program(self, g, fname):
218218
LOG.debug('load the display: {}'.format(fname))
219219
self._reload_filename = fname
220-
self.load(fname)
220+
result = self.load(fname)
221221
STATUS.emit('graphics-gcode-properties',self.gcode_properties)
222222
# reset the current view to standard calculated zoom and position
223223
self.set_current_view()
224+
return result
224225

225226
def set_metric_units(self, w, state):
226227
self.metric_units = state

src/emc/usr_intf/gremlin/qt5_graphics.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,10 @@ def load(self,filename = None):
356356
if not filename and s.file:
357357
filename = s.file
358358
elif not filename and not s.file:
359-
return
359+
return False
360360

361+
if not os.path.exists(filename):
362+
return False
361363

362364
lines = open(filename).readlines()
363365
progress = Progress(2, len(lines))
@@ -379,6 +381,7 @@ def load(self,filename = None):
379381

380382
td = tempfile.mkdtemp()
381383
self._current_file = filename
384+
load_result = True
382385
try:
383386
random = int(self.inifile.find("EMCIO", "RANDOM_TOOLCHANGER") or 0)
384387
arcdivision = int(self.inifile.find("DISPLAY", "ARCDIVISION") or 64)
@@ -407,6 +410,7 @@ def load(self,filename = None):
407410
except Exception as e:
408411
print (e)
409412
self.gcode_properties = None
413+
load_result = False
410414
finally:
411415
shutil.rmtree(td)
412416
if canon:
@@ -416,6 +420,7 @@ def load(self,filename = None):
416420
except UnboundLocalError:
417421
pass
418422
self._redraw()
423+
return load_result
419424

420425
# monkey patched function from StatCanon class
421426
def output_notify_message(self, message):

0 commit comments

Comments
 (0)