- added possibility to see the GCode when right clicking on the Project tab on a CNCJob object and then clicking View Source

This commit is contained in:
Marius Stanciu
2019-09-15 22:46:51 +03:00
committed by Marius
parent b0d545eb03
commit c06317374e
4 changed files with 27 additions and 11 deletions

View File

@@ -8217,20 +8217,34 @@ class App(QtCore.QObject):
if obj.kind == 'gerber':
flt = "Gerber Files (*.GBR);;All Files (*.*)"
else:
elif obj.kind == 'excellon':
flt = "Excellon Files (*.DRL);;All Files (*.*)"
elif obj.kind == 'cncjob':
"GCode Files (*.NC);;All Files (*.*)"
else:
flt = "All Files (*.*)"
self.init_code_editor(name=_("Source Editor"))
self.ui.buttonOpen.clicked.connect(lambda: self.handleOpen(filt=flt))
self.ui.buttonSave.clicked.connect(lambda: self.handleSaveGCode(filt=flt))
# then append the text from GCode to the text editor
try:
file = StringIO(obj.source_file)
except AttributeError:
self.inform.emit('[WARNING_NOTCL] %s' %
_("There is no selected object for which to see it's source file code."))
return 'fail'
if obj.kind == 'cncjob':
try:
file = obj.export_gcode(preamble='', postamble='', to_file=True)
if file == 'fail':
return 'fail'
except AttributeError:
self.inform.emit('[WARNING_NOTCL] %s' %
_("There is no selected object for which to see it's source file code."))
return 'fail'
else:
try:
file = StringIO(obj.source_file)
except AttributeError:
self.inform.emit('[WARNING_NOTCL] %s' %
_("There is no selected object for which to see it's source file code."))
return 'fail'
self.ui.cncjob_frame.hide()
try: