- fixed a bug in conversion of any to Gerber in the section of Excellon conversion

- some PEP8 fixes
- fixed a bug due of recent chagnes in FileMenuHandlers class
This commit is contained in:
Marius Stanciu 2020-10-27 14:29:46 +02:00
parent fd7e47f60b
commit 64e06720b6
3 changed files with 89 additions and 54 deletions

View File

@ -12,6 +12,9 @@ CHANGELOG for FlatCAM beta
- created custom classes derived from TextEdit and from LineEdit where I overloaded the context menu and I made all the other classes that were inheriting from them to inherit from those new classes - created custom classes derived from TextEdit and from LineEdit where I overloaded the context menu and I made all the other classes that were inheriting from them to inherit from those new classes
- minor fix in ToolsDB2UI - minor fix in ToolsDB2UI
- updated the Turkuish translation strings (by Mehmet Kaya) - updated the Turkuish translation strings (by Mehmet Kaya)
- fixed a bug in conversion of any to Gerber in the section of Excellon conversion
- some PEP8 fixes
- fixed a bug due of recent chagnes in FileMenuHandlers class
26.10.2020 26.10.2020

View File

@ -74,6 +74,9 @@ class TermWidget(QWidget):
self._delete_line.clicked.connect(self.on_delete_line_clicked) self._delete_line.clicked.connect(self.on_delete_line_clicked)
def command_line(self):
return self._edit
def on_delete_line_clicked(self): def on_delete_line_clicked(self):
self._edit.clear() self._edit.clear()

View File

@ -1984,7 +1984,7 @@ class App(QtCore.QObject):
self.drilling_tool = ToolDrilling(self) self.drilling_tool = ToolDrilling(self)
self.drilling_tool.install(icon=QtGui.QIcon(self.resource_location + '/drill16.png'), pos=self.ui.menutool, self.drilling_tool.install(icon=QtGui.QIcon(self.resource_location + '/drill16.png'), pos=self.ui.menutool,
before=self.sub_tool.menuAction, separator=True) before=self.sub_tool.menuAction, separator=True)
self.copper_thieving_tool = ToolCopperThieving(self) self.copper_thieving_tool = ToolCopperThieving(self)
self.copper_thieving_tool.install(icon=QtGui.QIcon(self.resource_location + '/copperfill32.png'), self.copper_thieving_tool.install(icon=QtGui.QIcon(self.resource_location + '/copperfill32.png'),
@ -3595,10 +3595,10 @@ class App(QtCore.QObject):
root_path = winreg.HKEY_CURRENT_USER root_path = winreg.HKEY_CURRENT_USER
# create the keys # create the keys
def set_reg(name, root_pth, new_reg_path, value): def set_reg(name, root_pth, new_reg_path_par, value):
try: try:
winreg.CreateKey(root_pth, new_reg_path) winreg.CreateKey(root_pth, new_reg_path_par)
with winreg.OpenKey(root_pth, new_reg_path, 0, winreg.KEY_WRITE) as registry_key: with winreg.OpenKey(root_pth, new_reg_path_par, 0, winreg.KEY_WRITE) as registry_key:
winreg.SetValueEx(registry_key, name, 0, winreg.REG_SZ, value) winreg.SetValueEx(registry_key, name, 0, winreg.REG_SZ, value)
return True return True
except WindowsError: except WindowsError:
@ -3736,7 +3736,7 @@ class App(QtCore.QObject):
self.autocomplete_kw_list = \ self.autocomplete_kw_list = \
self.ui.util_defaults_form.kw_group.kw_list_text.get_value().replace(' ', '').split(',') self.ui.util_defaults_form.kw_group.kw_list_text.get_value().replace(' ', '').split(',')
self.myKeywords = self.tcl_commands_list + self.autocomplete_kw_list + self.tcl_keywords self.myKeywords = self.tcl_commands_list + self.autocomplete_kw_list + self.tcl_keywords
self.shell._edit.set_model_data(self.myKeywords) self.shell.command_line().set_model_data(self.myKeywords)
def del_extension(self, ext_type): def del_extension(self, ext_type):
""" """
@ -3794,7 +3794,7 @@ class App(QtCore.QObject):
self.autocomplete_kw_list = \ self.autocomplete_kw_list = \
self.ui.util_defaults_form.kw_group.kw_list_text.get_value().replace(' ', '').split(',') self.ui.util_defaults_form.kw_group.kw_list_text.get_value().replace(' ', '').split(',')
self.myKeywords = self.tcl_commands_list + self.autocomplete_kw_list + self.tcl_keywords self.myKeywords = self.tcl_commands_list + self.autocomplete_kw_list + self.tcl_keywords
self.shell._edit.set_model_data(self.myKeywords) self.shell.command_line().set_model_data(self.myKeywords)
def restore_extensions(self, ext_type): def restore_extensions(self, ext_type):
""" """
@ -3824,7 +3824,7 @@ class App(QtCore.QObject):
# update the self.myKeywords so the model is updated # update the self.myKeywords so the model is updated
self.autocomplete_kw_list = self.default_keywords self.autocomplete_kw_list = self.default_keywords
self.myKeywords = self.tcl_commands_list + self.autocomplete_kw_list + self.tcl_keywords self.myKeywords = self.tcl_commands_list + self.autocomplete_kw_list + self.tcl_keywords
self.shell._edit.set_model_data(self.myKeywords) self.shell.commnad_line().set_model_data(self.myKeywords)
def delete_all_extensions(self, ext_type): def delete_all_extensions(self, ext_type):
""" """
@ -3845,7 +3845,7 @@ class App(QtCore.QObject):
# update the self.myKeywords so the model is updated # update the self.myKeywords so the model is updated
self.myKeywords = self.tcl_commands_list + self.tcl_keywords self.myKeywords = self.tcl_commands_list + self.tcl_keywords
self.shell._edit.set_model_data(self.myKeywords) self.shell.command_line().set_model_data(self.myKeywords)
def on_edit_join(self, name=None): def on_edit_join(self, name=None):
""" """
@ -4193,7 +4193,7 @@ class App(QtCore.QObject):
'tools_drill_cutz', 'tools_drill_depthperpass', 'tools_drill_travelz', 'tools_drill_endz', 'tools_drill_cutz', 'tools_drill_depthperpass', 'tools_drill_travelz', 'tools_drill_endz',
'tools_drill_endxy', 'tools_drill_feedrate_z', 'tools_drill_toolchangez', "tools_drill_drill_overlap", 'tools_drill_endxy', 'tools_drill_feedrate_z', 'tools_drill_toolchangez', "tools_drill_drill_overlap",
'tools_drill_offset', "tools_drill_toolchangexy", "tools_drill_startz", 'tools_drill_feedrate_rapid', 'tools_drill_offset', "tools_drill_toolchangexy", "tools_drill_startz", 'tools_drill_feedrate_rapid',
"tools_drill_feedrate_probe", "tools_drill_z_pdepth", "tools_drill_area_overz", "tools_drill_feedrate_probe", "tools_drill_z_pdepth", "tools_drill_area_overz",
# NCC Tool # NCC Tool
"tools_ncc_tools", "tools_ncc_margin", "tools_ncc_offset_value", "tools_ncc_cutz", "tools_ncc_tipdia", "tools_ncc_tools", "tools_ncc_margin", "tools_ncc_offset_value", "tools_ncc_cutz", "tools_ncc_tipdia",
@ -5057,13 +5057,13 @@ class App(QtCore.QObject):
""" """
self.defaults.report_usage("on_copy_command()") self.defaults.report_usage("on_copy_command()")
def initialize(obj_init, app): def initialize(obj_init, app_obj):
""" """
:param obj_init: the new object :param obj_init: the new object
:type obj_init: class :type obj_init: class
:param app: An instance of the App class :param app_obj: An instance of the App class
:type app: App :type app_obj: App
:return: None :return: None
:rtype: :rtype:
""" """
@ -5083,14 +5083,14 @@ class App(QtCore.QObject):
if obj.tools: if obj.tools:
obj_init.tools = deepcopy(obj.tools) obj_init.tools = deepcopy(obj.tools)
except Exception as err: except Exception as err:
log.debug("App.on_copy_command() --> %s" % str(err)) app_obj.debug("App.on_copy_command() --> %s" % str(err))
try: try:
obj_init.source_file = deepcopy(obj.source_file) obj_init.source_file = deepcopy(obj.source_file)
except (AttributeError, TypeError): except (AttributeError, TypeError):
pass pass
def initialize_excellon(obj_init, app): def initialize_excellon(obj_init, app_obj):
obj_init.source_file = deepcopy(obj.source_file) obj_init.source_file = deepcopy(obj.source_file)
obj_init.tools = deepcopy(obj.tools) obj_init.tools = deepcopy(obj.tools)
@ -5101,6 +5101,10 @@ class App(QtCore.QObject):
obj_init.slots = deepcopy(obj.slots) obj_init.slots = deepcopy(obj.slots)
obj_init.create_geometry() obj_init.create_geometry()
if not obj_init.tools:
app_obj.debug("on_copy_command() --> no excellon tools")
return 'fail'
def initialize_script(obj_init, app_obj): def initialize_script(obj_init, app_obj):
obj_init.source_file = deepcopy(obj.source_file) obj_init.source_file = deepcopy(obj.source_file)
@ -5126,7 +5130,7 @@ class App(QtCore.QObject):
def on_copy_object2(self, custom_name): def on_copy_object2(self, custom_name):
def initialize_geometry(obj_init, app): def initialize_geometry(obj_init, app_obj):
obj_init.solid_geometry = deepcopy(obj.solid_geometry) obj_init.solid_geometry = deepcopy(obj.solid_geometry)
try: try:
obj_init.follow_geometry = deepcopy(obj.follow_geometry) obj_init.follow_geometry = deepcopy(obj.follow_geometry)
@ -5142,20 +5146,26 @@ class App(QtCore.QObject):
if obj.tools: if obj.tools:
obj_init.tools = deepcopy(obj.tools) obj_init.tools = deepcopy(obj.tools)
except Exception as ee: except Exception as ee:
log.debug("on_copy_object2() --> %s" % str(ee)) app_obj.debug("on_copy_object2() --> %s" % str(ee))
def initialize_gerber(obj_init, app): def initialize_gerber(obj_init, app_obj):
obj_init.solid_geometry = deepcopy(obj.solid_geometry) obj_init.solid_geometry = deepcopy(obj.solid_geometry)
obj_init.apertures = deepcopy(obj.apertures) obj_init.apertures = deepcopy(obj.apertures)
obj_init.aperture_macros = deepcopy(obj.aperture_macros) obj_init.aperture_macros = deepcopy(obj.aperture_macros)
if not obj_init.apertures:
app_obj.debug("on_copy_object2() --> no gerber apertures")
return 'fail'
def initialize_excellon(obj_init, app): def initialize_excellon(obj_init, app_obj):
obj_init.tools = deepcopy(obj.tools) obj_init.tools = deepcopy(obj.tools)
# drills are offset, so they need to be deep copied # drills are offset, so they need to be deep copied
obj_init.drills = deepcopy(obj.drills) obj_init.drills = deepcopy(obj.drills)
# slots are offset, so they need to be deep copied # slots are offset, so they need to be deep copied
obj_init.slots = deepcopy(obj.slots) obj_init.slots = deepcopy(obj.slots)
obj_init.create_geometry() obj_init.create_geometry()
if not obj_init.tools:
app_obj.debug("on_copy_object2() --> no excellon tools")
return 'fail'
for obj in self.collection.get_selected(): for obj in self.collection.get_selected():
obj_name = obj.options["name"] obj_name = obj.options["name"]
@ -5212,7 +5222,7 @@ class App(QtCore.QObject):
except AttributeError: except AttributeError:
pass pass
def initialize_excellon(obj_init, app): def initialize_excellon(obj_init, app_obj):
# objs = self.collection.get_selected() # objs = self.collection.get_selected()
# GeometryObject.merge(objs, obj) # GeometryObject.merge(objs, obj)
solid_geo = [] solid_geo = []
@ -5220,6 +5230,9 @@ class App(QtCore.QObject):
for geo in obj.tools[tool]['solid_geometry']: for geo in obj.tools[tool]['solid_geometry']:
solid_geo.append(geo) solid_geo.append(geo)
obj_init.solid_geometry = deepcopy(solid_geo) obj_init.solid_geometry = deepcopy(solid_geo)
if not obj_init.solid_geometry:
app_obj.log("convert_any2geo() failed")
return 'fail'
if not self.collection.get_selected(): if not self.collection.get_selected():
log.warning("App.convert_any2geo --> No object selected") log.warning("App.convert_any2geo --> No object selected")
@ -5245,7 +5258,7 @@ class App(QtCore.QObject):
:return: :return:
""" """
def initialize_geometry(obj_init, app): def initialize_geometry(obj_init, app_obj):
apertures = {} apertures = {}
apid = 0 apid = 0
@ -5265,7 +5278,11 @@ class App(QtCore.QObject):
obj_init.solid_geometry = deepcopy(obj.solid_geometry) obj_init.solid_geometry = deepcopy(obj.solid_geometry)
obj_init.apertures = deepcopy(apertures) obj_init.apertures = deepcopy(apertures)
def initialize_excellon(obj_init, app): if not obj_init.apertures:
app_obj.log("convert_any2gerber() failed")
return 'fail'
def initialize_excellon(obj_init, app_obj):
apertures = {} apertures = {}
apid = 10 apid = 10
@ -5278,7 +5295,7 @@ class App(QtCore.QObject):
new_el['follow'] = geo.exterior new_el['follow'] = geo.exterior
apertures[str(apid)]['geometry'].append(deepcopy(new_el)) apertures[str(apid)]['geometry'].append(deepcopy(new_el))
apertures[str(apid)]['size'] = float(obj.tools[tool]['C']) apertures[str(apid)]['size'] = float(obj.tools[tool]['tooldia'])
apertures[str(apid)]['type'] = 'C' apertures[str(apid)]['type'] = 'C'
apid += 1 apid += 1
@ -5293,8 +5310,10 @@ class App(QtCore.QObject):
obj_init.solid_geometry = deepcopy(solid_geometry) obj_init.solid_geometry = deepcopy(solid_geometry)
obj_init.apertures = deepcopy(apertures) obj_init.apertures = deepcopy(apertures)
# clear the working objects (perhaps not necessary due of Python GC)
apertures.clear() if not obj_init.apertures:
app_obj.log("convert_any2gerber() failed")
return 'fail'
if not self.collection.get_selected(): if not self.collection.get_selected():
log.warning("App.convert_any2gerber --> No object selected") log.warning("App.convert_any2gerber --> No object selected")
@ -5324,7 +5343,7 @@ class App(QtCore.QObject):
:return: :return:
""" """
def initialize_geometry(obj_init, app): def initialize_geometry(obj_init, app_obj):
tools = {} tools = {}
tooluid = 1 tooluid = 1
@ -5347,9 +5366,9 @@ class App(QtCore.QObject):
current_tooldias.append(tools[tool]['tooldia']) current_tooldias.append(tools[tool]['tooldia'])
if new_dia in current_tooldias: if new_dia in current_tooldias:
digits = app_obj.decimals
for tool in tools: for tool in tools:
if float('%.*f' % (self.decimals, tools[tool]["tooldia"])) == float('%.*f' % (self.decimals, if app_obj.dec_format(tools[tool]["tooldia"], digits) == app_obj.dec_format(new_dia, digits):
new_dia)):
tools[tool]['drills'].append(new_drill) tools[tool]['drills'].append(new_drill)
tools[tool]['solid_geometry'].append(deepcopy(new_drill_geo)) tools[tool]['solid_geometry'].append(deepcopy(new_drill_geo))
else: else:
@ -5368,9 +5387,13 @@ class App(QtCore.QObject):
obj_init.tools = deepcopy(tools) obj_init.tools = deepcopy(tools)
obj_init.solid_geometry = unary_union(obj_init.solid_geometry) obj_init.solid_geometry = unary_union(obj_init.solid_geometry)
def initialize_gerber(obj_init, app): if not obj_init.solid_geometry:
return 'fail'
def initialize_gerber(obj_init, app_obj):
tools = {} tools = {}
tooluid = 1 tooluid = 1
digits = app_obj.decimals
obj_init.solid_geometry = [] obj_init.solid_geometry = []
@ -5391,13 +5414,13 @@ class App(QtCore.QObject):
for tool in tools: for tool in tools:
if tools[tool] and 'tooldia' in tools[tool]: if tools[tool] and 'tooldia' in tools[tool]:
current_tooldias.append( current_tooldias.append(
float('%.*f' % (self.decimals, tools[tool]['tooldia'])) app_obj.dec_format(tools[tool]['tooldia'], digits)
) )
if float('%.*f' % (self.decimals, new_dia)) in current_tooldias: formatted_new_dia = app_obj.dec_format(new_dia, digits)
if formatted_new_dia in current_tooldias:
for tool in tools: for tool in tools:
if float('%.*f' % (self.decimals, tools[tool]["tooldia"])) == float( if app_obj.dec_format(tools[tool]["tooldia"], digits) == formatted_new_dia:
'%.*f' % (self.decimals, new_dia)):
if new_drill not in tools[tool]['drills']: if new_drill not in tools[tool]['drills']:
tools[tool]['drills'].append(new_drill) tools[tool]['drills'].append(new_drill)
tools[tool]['solid_geometry'].append(deepcopy(new_drill_geo)) tools[tool]['solid_geometry'].append(deepcopy(new_drill_geo))
@ -5460,6 +5483,9 @@ class App(QtCore.QObject):
obj_init.tools = deepcopy(tools) obj_init.tools = deepcopy(tools)
obj_init.solid_geometry = unary_union(obj_init.solid_geometry) obj_init.solid_geometry = unary_union(obj_init.solid_geometry)
if not obj_init.solid_geometry:
return 'fail'
if not self.collection.get_selected(): if not self.collection.get_selected():
log.warning("App.convert_any2excellon--> No object selected") log.warning("App.convert_any2excellon--> No object selected")
self.inform.emit('[WARNING_NOTCL] %s' % _("No object is selected. Select an object and try again.")) self.inform.emit('[WARNING_NOTCL] %s' % _("No object is selected. Select an object and try again."))
@ -7787,8 +7813,9 @@ class App(QtCore.QObject):
return return
if act_name == _("Opacity"): if act_name == _("Opacity"):
# alpha_level, ok_button = QtWidgets.QInputDialog.getInt( # alpha_level, ok_button = QtWidgets.QInputDialog.getInt(self.ui, _("Set alpha level ..."),
# self.ui, _("Set alpha level ..."), '%s:' % _("Value"), min=0, max=255, step=1, value=191) # '%s:' % _("Value"),
# min=0, max=255, step=1, value=191)
alpha_dialog = FCInputDialogSlider( alpha_dialog = FCInputDialogSlider(
self.ui, _("Set alpha level ..."), '%s:' % _("Value"), min=0, max=255, step=1, init_val=191) self.ui, _("Set alpha level ..."), '%s:' % _("Value"), min=0, max=255, step=1, init_val=191)
@ -8319,7 +8346,7 @@ class MenuFileHandlers(QtCore.QObject):
date = str(datetime.today()).rpartition('.')[0] date = str(datetime.today()).rpartition('.')[0]
date = ''.join(c for c in date if c not in ':-') date = ''.join(c for c in date if c not in ':-')
date = self.app.date.replace(' ', '_') date = date.replace(' ', '_')
data = None data = None
if self.app.is_legacy is False: if self.app.is_legacy is False:
@ -9293,7 +9320,7 @@ class MenuFileHandlers(QtCore.QObject):
except Exception: except Exception:
return 'fail' return 'fail'
with self.app.proc_container.new(_("Exporting SVG")) as proc: with self.app.proc_container.new(_("Exporting SVG")):
exported_svg = obj.export_svg(scale_stroke_factor=scale_stroke_factor) exported_svg = obj.export_svg(scale_stroke_factor=scale_stroke_factor)
# Determine bounding area for svg export # Determine bounding area for svg export
@ -9553,12 +9580,12 @@ class MenuFileHandlers(QtCore.QObject):
if use_thread is True: if use_thread is True:
with self.app.proc_container.new(_("Exporting Excellon")) as proc: with self.app.proc_container.new(_("Exporting Excellon")):
def job_thread_exc(app_obj): def job_thread_exc(app_obj):
ret = make_excellon() ret = make_excellon()
if ret == 'fail': if ret == 'fail':
self.inform.emit('[ERROR_NOTCL] %s' % _('Could not export Excellon file.')) app_obj.inform.emit('[ERROR_NOTCL] %s' % _('Could not export Excellon file.'))
return return
self.worker_task.emit({'fcn': job_thread_exc, 'params': [self]}) self.worker_task.emit({'fcn': job_thread_exc, 'params': [self]})
@ -9687,12 +9714,12 @@ class MenuFileHandlers(QtCore.QObject):
return 'fail' return 'fail'
if use_thread is True: if use_thread is True:
with self.app.proc_container.new(_("Exporting Gerber")) as proc: with self.app.proc_container.new(_("Exporting Gerber")):
def job_thread_grb(app_obj): def job_thread_grb(app_obj):
ret = make_gerber() ret = make_gerber()
if ret == 'fail': if ret == 'fail':
self.inform.emit('[ERROR_NOTCL] %s' % _('Could not export file.')) app_obj.inform.emit('[ERROR_NOTCL] %s' % _('Could not export file.'))
return return
self.worker_task.emit({'fcn': job_thread_grb, 'params': [self]}) self.worker_task.emit({'fcn': job_thread_grb, 'params': [self]})
@ -9754,7 +9781,7 @@ class MenuFileHandlers(QtCore.QObject):
if use_thread is True: if use_thread is True:
with self.app.proc_container.new(_("Exporting DXF")) as proc: with self.app.proc_container.new(_("Exporting DXF")):
def job_thread_exc(app_obj): def job_thread_exc(app_obj):
ret_dxf_val = make_dxf() ret_dxf_val = make_dxf()
@ -9804,7 +9831,10 @@ class MenuFileHandlers(QtCore.QObject):
file_content = f.read() file_content = f.read()
geo_obj.source_file = file_content geo_obj.source_file = file_content
with self.app.proc_container.new(_("Importing SVG")) as proc: # appGUI feedback
app_obj.inform.emit('[success] %s: %s' % (_("Opened"), filename))
with self.app.proc_container.new(_("Importing SVG")):
# Object name # Object name
name = outname or filename.split('/')[-1].split('\\')[-1] name = outname or filename.split('/')[-1].split('\\')[-1]
@ -9818,9 +9848,6 @@ class MenuFileHandlers(QtCore.QObject):
# Register recent file # Register recent file
self.app.file_opened.emit("svg", filename) self.app.file_opened.emit("svg", filename)
# appGUI feedback
self.inform.emit('[success] %s: %s' % (_("Opened"), filename))
def import_dxf(self, filename, geo_type='geometry', outname=None, plot=True): def import_dxf(self, filename, geo_type='geometry', outname=None, plot=True):
""" """
Adds a new Geometry Object to the projects and populates Adds a new Geometry Object to the projects and populates
@ -9859,6 +9886,9 @@ class MenuFileHandlers(QtCore.QObject):
file_content = f.read() file_content = f.read()
geo_obj.source_file = file_content geo_obj.source_file = file_content
# appGUI feedback
app_obj.inform.emit('[success] %s: %s' % (_("Opened"), filename))
with self.app.proc_container.new(_("Importing DXF")): with self.app.proc_container.new(_("Importing DXF")):
# Object name # Object name
@ -9873,9 +9903,6 @@ class MenuFileHandlers(QtCore.QObject):
# Register recent file # Register recent file
self.app.file_opened.emit("dxf", filename) self.app.file_opened.emit("dxf", filename)
# appGUI feedback
self.inform.emit('[success] %s: %s' % (_("Opened"), filename))
def open_gerber(self, filename, outname=None, plot=True, from_tcl=False): def open_gerber(self, filename, outname=None, plot=True, from_tcl=False):
""" """
Opens a Gerber file, parses it and creates a new object for Opens a Gerber file, parses it and creates a new object for
@ -10333,12 +10360,12 @@ class MenuFileHandlers(QtCore.QObject):
def obj_init(obj_inst, app_inst): def obj_init(obj_inst, app_inst):
try: try:
obj_inst.from_dict(obj) obj_inst.from_dict(obj)
except Exception as e: except Exception as erro:
self.app.log('App.open_project() --> ' + str(e)) app_inst.log('MenuFileHandlers.open_project() --> ' + str(erro))
return 'fail' return 'fail'
self.app.log.debug("Recreating from opened project an %s object: %s" % self.app.log.debug(
(obj['kind'].capitalize(), obj['options']['name'])) "Recreating from opened project an %s object: %s" % (obj['kind'].capitalize(), obj['options']['name']))
# for some reason, setting ui_title does not work when this method is called from Tcl Shell # for some reason, setting ui_title does not work when this method is called from Tcl Shell
# it's because the TclCommand is run in another thread (it inherit TclCommandSignaled) # it's because the TclCommand is run in another thread (it inherit TclCommandSignaled)
@ -10377,6 +10404,9 @@ class MenuFileHandlers(QtCore.QObject):
self.app.log.debug("save_project()") self.app.log.debug("save_project()")
self.app.save_in_progress = True self.app.save_in_progress = True
if from_tcl:
log.debug("MenuFileHandlers.save_project() -> Project saved from TCL command.")
with self.app.proc_container.new(_("Saving FlatCAM Project")): with self.app.proc_container.new(_("Saving FlatCAM Project")):
# Capture the latest changes # Capture the latest changes
# Current object # Current object
@ -10452,13 +10482,12 @@ class MenuFileHandlers(QtCore.QObject):
# t.start() # t.start()
self.app.start_delayed_quit(delay=500, filename=filename, should_quit=quit_action) self.app.start_delayed_quit(delay=500, filename=filename, should_quit=quit_action)
def save_source_file(self, obj_name, filename, use_thread=True): def save_source_file(self, obj_name, filename):
""" """
Exports a FlatCAM Object to an Gerber/Excellon file. Exports a FlatCAM Object to an Gerber/Excellon file.
:param obj_name: the name of the FlatCAM object for which to save it's embedded source file :param obj_name: the name of the FlatCAM object for which to save it's embedded source file
:param filename: Path to the Gerber file to save to. :param filename: Path to the Gerber file to save to.
:param use_thread: if to be run in a separate thread
:return: :return:
""" """