|
@@ -1499,7 +1499,7 @@ class App(QtCore.QObject):
|
|
|
if isinstance(edited_object, FlatCAMGeometry):
|
|
if isinstance(edited_object, FlatCAMGeometry):
|
|
|
# for now, if the Geometry is MultiGeo do not allow the editing
|
|
# for now, if the Geometry is MultiGeo do not allow the editing
|
|
|
if edited_object.multigeo is True:
|
|
if edited_object.multigeo is True:
|
|
|
- self.inform.emit("[warning_notcl]Editing a MultiGeo Geometry is not possible for the moment.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Editing a MultiGeo Geometry is not possible for the moment.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
self.geo_editor.edit_fcgeometry(edited_object)
|
|
self.geo_editor.edit_fcgeometry(edited_object)
|
|
@@ -1512,7 +1512,7 @@ class App(QtCore.QObject):
|
|
|
# set call source to the Editor we go into
|
|
# set call source to the Editor we go into
|
|
|
self.call_source = 'exc_editor'
|
|
self.call_source = 'exc_editor'
|
|
|
else:
|
|
else:
|
|
|
- self.inform.emit("[warning_notcl]Select a Geometry or Excellon Object to edit.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Select a Geometry or Excellon Object to edit.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# make sure that we can't select another object while in Editor Mode:
|
|
# make sure that we can't select another object while in Editor Mode:
|
|
@@ -1523,7 +1523,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
self.ui.plot_tab_area.setTabText(0, "EDITOR Area")
|
|
self.ui.plot_tab_area.setTabText(0, "EDITOR Area")
|
|
|
self.ui.plot_tab_area.protectTab(0)
|
|
self.ui.plot_tab_area.protectTab(0)
|
|
|
- self.inform.emit("[warning_notcl]Editor is activated ...")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Editor is activated ...")
|
|
|
|
|
|
|
|
def editor2object(self):
|
|
def editor2object(self):
|
|
|
"""
|
|
"""
|
|
@@ -1553,7 +1553,7 @@ class App(QtCore.QObject):
|
|
|
edited_obj.options['xmax'] = xmax
|
|
edited_obj.options['xmax'] = xmax
|
|
|
edited_obj.options['ymax'] = ymax
|
|
edited_obj.options['ymax'] = ymax
|
|
|
except AttributeError:
|
|
except AttributeError:
|
|
|
- self.inform.emit("[warning] Object empty after edit.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING] Object empty after edit.")
|
|
|
|
|
|
|
|
elif isinstance(edited_obj, FlatCAMExcellon):
|
|
elif isinstance(edited_obj, FlatCAMExcellon):
|
|
|
obj_type = "Excellon"
|
|
obj_type = "Excellon"
|
|
@@ -1569,9 +1569,9 @@ class App(QtCore.QObject):
|
|
|
edited_obj.options['xmax'] = xmax
|
|
edited_obj.options['xmax'] = xmax
|
|
|
edited_obj.options['ymax'] = ymax
|
|
edited_obj.options['ymax'] = ymax
|
|
|
except AttributeError:
|
|
except AttributeError:
|
|
|
- self.inform.emit("[warning] Object empty after edit.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING] Object empty after edit.")
|
|
|
else:
|
|
else:
|
|
|
- self.inform.emit("[warning_notcl]Select a Geometry or Excellon Object to update.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Select a Geometry or Excellon Object to update.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# restore the call_source to app
|
|
# restore the call_source to app
|
|
@@ -1628,7 +1628,7 @@ class App(QtCore.QObject):
|
|
|
"""
|
|
"""
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
- def shell_message(self, msg, show=False, error=False):
|
|
|
|
|
|
|
+ def shell_message(self, msg, show=False, error=False, warning=False, success=False):
|
|
|
"""
|
|
"""
|
|
|
Shows a message on the FlatCAM Shell
|
|
Shows a message on the FlatCAM Shell
|
|
|
|
|
|
|
@@ -1643,7 +1643,13 @@ class App(QtCore.QObject):
|
|
|
if error:
|
|
if error:
|
|
|
self.shell.append_error(msg + "\n")
|
|
self.shell.append_error(msg + "\n")
|
|
|
else:
|
|
else:
|
|
|
- self.shell.append_output(msg + "\n")
|
|
|
|
|
|
|
+ if warning:
|
|
|
|
|
+ self.shell.append_warning(msg + "\n")
|
|
|
|
|
+ else:
|
|
|
|
|
+ if success:
|
|
|
|
|
+ self.shell.append_success(msg + "\n")
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.shell.append_output(msg + "\n")
|
|
|
except AttributeError:
|
|
except AttributeError:
|
|
|
log.debug("shell_message() is called before Shell Class is instantiated. The message is: %s", str(msg))
|
|
log.debug("shell_message() is called before Shell Class is instantiated. The message is: %s", str(msg))
|
|
|
|
|
|
|
@@ -1809,12 +1815,20 @@ class App(QtCore.QObject):
|
|
|
msg_ = match.group(2)
|
|
msg_ = match.group(2)
|
|
|
self.ui.fcinfo.set_status(str(msg_), level=level)
|
|
self.ui.fcinfo.set_status(str(msg_), level=level)
|
|
|
|
|
|
|
|
- if level == "error" or level == "warning":
|
|
|
|
|
|
|
+ if level.lower() == "error":
|
|
|
self.shell_message(msg, error=True, show=True)
|
|
self.shell_message(msg, error=True, show=True)
|
|
|
- elif level == "error_notcl" or level == "warning_notcl":
|
|
|
|
|
|
|
+ elif level.lower() == "warning":
|
|
|
|
|
+ self.shell_message(msg, warning=True, show=True)
|
|
|
|
|
+
|
|
|
|
|
+ elif level.lower() == "error_notcl":
|
|
|
self.shell_message(msg, error=True, show=False)
|
|
self.shell_message(msg, error=True, show=False)
|
|
|
|
|
+ elif level.lower() == "warning_notcl":
|
|
|
|
|
+ self.shell_message(msg, warning=True, show=False)
|
|
|
|
|
+
|
|
|
|
|
+ elif level.lower() == "success":
|
|
|
|
|
+ self.shell_message(msg, success=True, show=False)
|
|
|
else:
|
|
else:
|
|
|
- self.shell_message(msg, error=False, show=False)
|
|
|
|
|
|
|
+ self.shell_message(msg, show=False)
|
|
|
else:
|
|
else:
|
|
|
self.ui.fcinfo.set_status(str(msg), level="info")
|
|
self.ui.fcinfo.set_status(str(msg), level="info")
|
|
|
|
|
|
|
@@ -1873,7 +1887,7 @@ class App(QtCore.QObject):
|
|
|
f.close()
|
|
f.close()
|
|
|
except IOError:
|
|
except IOError:
|
|
|
self.log.error("Could not load defaults file.")
|
|
self.log.error("Could not load defaults file.")
|
|
|
- self.inform.emit("[error] Could not load defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR] Could not load defaults file.")
|
|
|
# in case the defaults file can't be loaded, show all toolbars
|
|
# in case the defaults file can't be loaded, show all toolbars
|
|
|
self.defaults["global_toolbar_view"] = 127
|
|
self.defaults["global_toolbar_view"] = 127
|
|
|
return
|
|
return
|
|
@@ -1885,7 +1899,7 @@ class App(QtCore.QObject):
|
|
|
self.defaults["global_toolbar_view"] = 127
|
|
self.defaults["global_toolbar_view"] = 127
|
|
|
e = sys.exc_info()[0]
|
|
e = sys.exc_info()[0]
|
|
|
App.log.error(str(e))
|
|
App.log.error(str(e))
|
|
|
- self.inform.emit("[error] Failed to parse defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR] Failed to parse defaults file.")
|
|
|
return
|
|
return
|
|
|
self.defaults.update(defaults)
|
|
self.defaults.update(defaults)
|
|
|
log.debug("FlatCAM defaults loaded from: %s" % filename)
|
|
log.debug("FlatCAM defaults loaded from: %s" % filename)
|
|
@@ -1914,7 +1928,7 @@ class App(QtCore.QObject):
|
|
|
filename = str(filename)
|
|
filename = str(filename)
|
|
|
|
|
|
|
|
if filename == "":
|
|
if filename == "":
|
|
|
- self.inform.emit("[warning_notcl]FlatCAM preferences import cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]FlatCAM preferences import cancelled.")
|
|
|
else:
|
|
else:
|
|
|
try:
|
|
try:
|
|
|
f = open(filename)
|
|
f = open(filename)
|
|
@@ -1922,7 +1936,7 @@ class App(QtCore.QObject):
|
|
|
f.close()
|
|
f.close()
|
|
|
except IOError:
|
|
except IOError:
|
|
|
self.log.error("Could not load defaults file.")
|
|
self.log.error("Could not load defaults file.")
|
|
|
- self.inform.emit("[error_notcl] Could not load defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Could not load defaults file.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
@@ -1930,7 +1944,7 @@ class App(QtCore.QObject):
|
|
|
except:
|
|
except:
|
|
|
e = sys.exc_info()[0]
|
|
e = sys.exc_info()[0]
|
|
|
App.log.error(str(e))
|
|
App.log.error(str(e))
|
|
|
- self.inform.emit("[error_notcl] Failed to parse defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to parse defaults file.")
|
|
|
return
|
|
return
|
|
|
self.defaults.update(defaults_from_file)
|
|
self.defaults.update(defaults_from_file)
|
|
|
self.inform.emit("[success]Imported Defaults from %s" %filename)
|
|
self.inform.emit("[success]Imported Defaults from %s" %filename)
|
|
@@ -1951,7 +1965,7 @@ class App(QtCore.QObject):
|
|
|
defaults_from_file = {}
|
|
defaults_from_file = {}
|
|
|
|
|
|
|
|
if filename == "":
|
|
if filename == "":
|
|
|
- self.inform.emit("[warning_notcl]FlatCAM preferences export cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]FlatCAM preferences export cancelled.")
|
|
|
return
|
|
return
|
|
|
else:
|
|
else:
|
|
|
try:
|
|
try:
|
|
@@ -1967,7 +1981,7 @@ class App(QtCore.QObject):
|
|
|
e = sys.exc_info()[0]
|
|
e = sys.exc_info()[0]
|
|
|
App.log.error("Could not load defaults file.")
|
|
App.log.error("Could not load defaults file.")
|
|
|
App.log.error(str(e))
|
|
App.log.error(str(e))
|
|
|
- self.inform.emit("[error_notcl]Could not load defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL]Could not load defaults file.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
@@ -1986,7 +2000,7 @@ class App(QtCore.QObject):
|
|
|
json.dump(defaults_from_file, f)
|
|
json.dump(defaults_from_file, f)
|
|
|
f.close()
|
|
f.close()
|
|
|
except:
|
|
except:
|
|
|
- self.inform.emit("[error_notcl] Failed to write defaults to file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to write defaults to file.")
|
|
|
return
|
|
return
|
|
|
self.inform.emit("[success]Exported Defaults to %s" % filename)
|
|
self.inform.emit("[success]Exported Defaults to %s" % filename)
|
|
|
|
|
|
|
@@ -2034,7 +2048,7 @@ class App(QtCore.QObject):
|
|
|
f = open(self.data_path + '/recent.json', 'w')
|
|
f = open(self.data_path + '/recent.json', 'w')
|
|
|
except IOError:
|
|
except IOError:
|
|
|
App.log.error("Failed to open recent items file for writing.")
|
|
App.log.error("Failed to open recent items file for writing.")
|
|
|
- self.inform.emit('[error_notcl]Failed to open recent files file for writing.')
|
|
|
|
|
|
|
+ self.inform.emit('[ERROR_NOTCL]Failed to open recent files file for writing.')
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
#try:
|
|
#try:
|
|
@@ -2120,15 +2134,15 @@ class App(QtCore.QObject):
|
|
|
try:
|
|
try:
|
|
|
return_value = initialize(obj, self)
|
|
return_value = initialize(obj, self)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
- msg = "[error_notcl] An internal error has ocurred. See shell.\n"
|
|
|
|
|
|
|
+ msg = "[ERROR_NOTCL] An internal error has ocurred. See shell.\n"
|
|
|
msg += "Object (%s) failed because: %s \n\n" % (kind, str(e))
|
|
msg += "Object (%s) failed because: %s \n\n" % (kind, str(e))
|
|
|
msg += traceback.format_exc()
|
|
msg += traceback.format_exc()
|
|
|
self.inform.emit(msg)
|
|
self.inform.emit(msg)
|
|
|
|
|
|
|
|
# if str(e) == "Empty Geometry":
|
|
# if str(e) == "Empty Geometry":
|
|
|
- # self.inform.emit("[error_notcl] )
|
|
|
|
|
|
|
+ # self.inform.emit("[ERROR_NOTCL] )
|
|
|
# else:
|
|
# else:
|
|
|
- # self.inform.emit("[error] Object (%s) failed because: %s" % (kind, str(e)))
|
|
|
|
|
|
|
+ # self.inform.emit("[ERROR] Object (%s) failed because: %s" % (kind, str(e)))
|
|
|
return "fail"
|
|
return "fail"
|
|
|
|
|
|
|
|
t2 = time.time()
|
|
t2 = time.time()
|
|
@@ -2360,7 +2374,7 @@ class App(QtCore.QObject):
|
|
|
e = sys.exc_info()[0]
|
|
e = sys.exc_info()[0]
|
|
|
App.log.error("Could not load defaults file.")
|
|
App.log.error("Could not load defaults file.")
|
|
|
App.log.error(str(e))
|
|
App.log.error(str(e))
|
|
|
- self.inform.emit("[error_notcl] Could not load defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Could not load defaults file.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
@@ -2369,7 +2383,7 @@ class App(QtCore.QObject):
|
|
|
e = sys.exc_info()[0]
|
|
e = sys.exc_info()[0]
|
|
|
App.log.error("Failed to parse defaults file.")
|
|
App.log.error("Failed to parse defaults file.")
|
|
|
App.log.error(str(e))
|
|
App.log.error(str(e))
|
|
|
- self.inform.emit("[error_notcl] Failed to parse defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to parse defaults file.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# Update options
|
|
# Update options
|
|
@@ -2383,7 +2397,7 @@ class App(QtCore.QObject):
|
|
|
json.dump(defaults, f)
|
|
json.dump(defaults, f)
|
|
|
f.close()
|
|
f.close()
|
|
|
except:
|
|
except:
|
|
|
- self.inform.emit("[error_notcl] Failed to write defaults to file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to write defaults to file.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# Save the toolbar view
|
|
# Save the toolbar view
|
|
@@ -2433,7 +2447,7 @@ class App(QtCore.QObject):
|
|
|
e = sys.exc_info()[0]
|
|
e = sys.exc_info()[0]
|
|
|
App.log.error("Could not load factory defaults file.")
|
|
App.log.error("Could not load factory defaults file.")
|
|
|
App.log.error(str(e))
|
|
App.log.error(str(e))
|
|
|
- self.inform.emit("[error_notcl] Could not load factory defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Could not load factory defaults file.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
@@ -2442,7 +2456,7 @@ class App(QtCore.QObject):
|
|
|
e = sys.exc_info()[0]
|
|
e = sys.exc_info()[0]
|
|
|
App.log.error("Failed to parse factory defaults file.")
|
|
App.log.error("Failed to parse factory defaults file.")
|
|
|
App.log.error(str(e))
|
|
App.log.error(str(e))
|
|
|
- self.inform.emit("[error_notcl] Failed to parse factory defaults file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to parse factory defaults file.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# Update options
|
|
# Update options
|
|
@@ -2456,7 +2470,7 @@ class App(QtCore.QObject):
|
|
|
json.dump(factory_defaults, f_f_def_s)
|
|
json.dump(factory_defaults, f_f_def_s)
|
|
|
f_f_def_s.close()
|
|
f_f_def_s.close()
|
|
|
except:
|
|
except:
|
|
|
- self.inform.emit("[error_notcl] Failed to write factory defaults to file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to write factory defaults to file.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
if silent is False:
|
|
if silent is False:
|
|
@@ -2516,7 +2530,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
# if len(set(geo_type_list)) == 1 means that all list elements are the same
|
|
# if len(set(geo_type_list)) == 1 means that all list elements are the same
|
|
|
if len(set(geo_type_list)) != 1:
|
|
if len(set(geo_type_list)) != 1:
|
|
|
- self.inform.emit("[error] Failed join. The Geometry objects are of different types.\n"
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR] Failed join. The Geometry objects are of different types.\n"
|
|
|
"At least one is MultiGeo type and the other is SingleGeo type. A possibility is to "
|
|
"At least one is MultiGeo type and the other is SingleGeo type. A possibility is to "
|
|
|
"convert from one to another and retry joining \n"
|
|
"convert from one to another and retry joining \n"
|
|
|
"but in the case of converting from MultiGeo to SingleGeo, informations may be lost and "
|
|
"but in the case of converting from MultiGeo to SingleGeo, informations may be lost and "
|
|
@@ -2553,7 +2567,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
for obj in objs:
|
|
for obj in objs:
|
|
|
if not isinstance(obj, FlatCAMExcellon):
|
|
if not isinstance(obj, FlatCAMExcellon):
|
|
|
- self.inform.emit("[error_notcl]Failed. Excellon joining works only on Excellon objects.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL]Failed. Excellon joining works only on Excellon objects.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
def initialize(obj, app):
|
|
def initialize(obj, app):
|
|
@@ -2572,7 +2586,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
for obj in objs:
|
|
for obj in objs:
|
|
|
if not isinstance(obj, FlatCAMGerber):
|
|
if not isinstance(obj, FlatCAMGerber):
|
|
|
- self.inform.emit("[error_notcl]Failed. Gerber joining works only on Gerber objects.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL]Failed. Gerber joining works only on Gerber objects.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
def initialize(obj, app):
|
|
def initialize(obj, app):
|
|
@@ -2584,11 +2598,11 @@ class App(QtCore.QObject):
|
|
|
obj = self.collection.get_active()
|
|
obj = self.collection.get_active()
|
|
|
|
|
|
|
|
if obj is None:
|
|
if obj is None:
|
|
|
- self.inform.emit("[error_notcl]Failed. Select a Geometry Object and try again.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL]Failed. Select a Geometry Object and try again.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
if not isinstance(obj, FlatCAMGeometry):
|
|
if not isinstance(obj, FlatCAMGeometry):
|
|
|
- self.inform.emit("[error_notcl]Expected a FlatCAMGeometry, got %s" % type(obj))
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL]Expected a FlatCAMGeometry, got %s" % type(obj))
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
obj.multigeo = True
|
|
obj.multigeo = True
|
|
@@ -2605,11 +2619,11 @@ class App(QtCore.QObject):
|
|
|
obj = self.collection.get_active()
|
|
obj = self.collection.get_active()
|
|
|
|
|
|
|
|
if obj is None:
|
|
if obj is None:
|
|
|
- self.inform.emit("[error_notcl]Failed. Select a Geometry Object and try again.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL]Failed. Select a Geometry Object and try again.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
if not isinstance(obj, FlatCAMGeometry):
|
|
if not isinstance(obj, FlatCAMGeometry):
|
|
|
- self.inform.emit("[error_notcl]Expected a FlatCAMGeometry, got %s" % type(obj))
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL]Expected a FlatCAMGeometry, got %s" % type(obj))
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
obj.multigeo = False
|
|
obj.multigeo = False
|
|
@@ -3548,7 +3562,7 @@ class App(QtCore.QObject):
|
|
|
ymaxlist = []
|
|
ymaxlist = []
|
|
|
|
|
|
|
|
if not obj_list:
|
|
if not obj_list:
|
|
|
- self.inform.emit("[warning_notcl] No object selected to Flip on Y axis.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL] No object selected to Flip on Y axis.")
|
|
|
else:
|
|
else:
|
|
|
try:
|
|
try:
|
|
|
# first get a bounding box to fit all
|
|
# first get a bounding box to fit all
|
|
@@ -3574,7 +3588,7 @@ class App(QtCore.QObject):
|
|
|
obj.plot()
|
|
obj.plot()
|
|
|
self.object_changed.emit(obj)
|
|
self.object_changed.emit(obj)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
- self.inform.emit("[error_notcl] Due of %s, Flip action was not executed." % str(e))
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Due of %s, Flip action was not executed." % str(e))
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
def on_flipx(self):
|
|
def on_flipx(self):
|
|
@@ -3585,7 +3599,7 @@ class App(QtCore.QObject):
|
|
|
ymaxlist = []
|
|
ymaxlist = []
|
|
|
|
|
|
|
|
if not obj_list:
|
|
if not obj_list:
|
|
|
- self.inform.emit("[warning_notcl] No object selected to Flip on X axis.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL] No object selected to Flip on X axis.")
|
|
|
else:
|
|
else:
|
|
|
try:
|
|
try:
|
|
|
# first get a bounding box to fit all
|
|
# first get a bounding box to fit all
|
|
@@ -3611,7 +3625,7 @@ class App(QtCore.QObject):
|
|
|
obj.plot()
|
|
obj.plot()
|
|
|
self.object_changed.emit(obj)
|
|
self.object_changed.emit(obj)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
- self.inform.emit("[error_notcl] Due of %s, Flip action was not executed." % str(e))
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Due of %s, Flip action was not executed." % str(e))
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
def on_rotate(self, silent=False, preset=None):
|
|
def on_rotate(self, silent=False, preset=None):
|
|
@@ -3622,7 +3636,7 @@ class App(QtCore.QObject):
|
|
|
ymaxlist = []
|
|
ymaxlist = []
|
|
|
|
|
|
|
|
if not obj_list:
|
|
if not obj_list:
|
|
|
- self.inform.emit("[warning_notcl] No object selected to Rotate.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL] No object selected to Rotate.")
|
|
|
else:
|
|
else:
|
|
|
if silent is False:
|
|
if silent is False:
|
|
|
rotatebox = FCInputDialog(title="Transform", text="Enter the Angle value:",
|
|
rotatebox = FCInputDialog(title="Transform", text="Enter the Angle value:",
|
|
@@ -3655,7 +3669,7 @@ class App(QtCore.QObject):
|
|
|
sel_obj.plot()
|
|
sel_obj.plot()
|
|
|
self.object_changed.emit(sel_obj)
|
|
self.object_changed.emit(sel_obj)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
- self.inform.emit("[error_notcl] Due of %s, rotation movement was not executed." % str(e))
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Due of %s, rotation movement was not executed." % str(e))
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
def on_skewx(self):
|
|
def on_skewx(self):
|
|
@@ -3664,7 +3678,7 @@ class App(QtCore.QObject):
|
|
|
yminlist = []
|
|
yminlist = []
|
|
|
|
|
|
|
|
if not obj_list:
|
|
if not obj_list:
|
|
|
- self.inform.emit("[warning_notcl] No object selected to Skew/Shear on X axis.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL] No object selected to Skew/Shear on X axis.")
|
|
|
else:
|
|
else:
|
|
|
skewxbox = FCInputDialog(title="Transform", text="Enter the Angle value:",
|
|
skewxbox = FCInputDialog(title="Transform", text="Enter the Angle value:",
|
|
|
min=-360, max=360, decimals=3)
|
|
min=-360, max=360, decimals=3)
|
|
@@ -3691,7 +3705,7 @@ class App(QtCore.QObject):
|
|
|
yminlist = []
|
|
yminlist = []
|
|
|
|
|
|
|
|
if not obj_list:
|
|
if not obj_list:
|
|
|
- self.inform.emit("[warning_notcl] No object selected to Skew/Shear on Y axis.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL] No object selected to Skew/Shear on Y axis.")
|
|
|
else:
|
|
else:
|
|
|
skewybox = FCInputDialog(title="Transform", text="Enter the Angle value:",
|
|
skewybox = FCInputDialog(title="Transform", text="Enter the Angle value:",
|
|
|
min=-360, max=360, decimals=3)
|
|
min=-360, max=360, decimals=3)
|
|
@@ -4006,7 +4020,7 @@ class App(QtCore.QObject):
|
|
|
name = obj.options["name"]
|
|
name = obj.options["name"]
|
|
|
except AttributeError:
|
|
except AttributeError:
|
|
|
log.debug("on_copy_name() --> No object selected to copy it's name")
|
|
log.debug("on_copy_name() --> No object selected to copy it's name")
|
|
|
- self.inform.emit("[warning_notcl]No object selected to copy it's name")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]No object selected to copy it's name")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
self.clipboard.setText(name)
|
|
self.clipboard.setText(name)
|
|
@@ -4296,7 +4310,7 @@ class App(QtCore.QObject):
|
|
|
# TODO: on selected objects change the object colors and do not draw the selection box
|
|
# TODO: on selected objects change the object colors and do not draw the selection box
|
|
|
# self.plotcanvas.vispy_canvas.update() # this updates the canvas
|
|
# self.plotcanvas.vispy_canvas.update() # this updates the canvas
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
- log.error("[error] Something went bad. %s" % str(e))
|
|
|
|
|
|
|
+ log.error("[ERROR] Something went bad. %s" % str(e))
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
def delete_selection_shape(self):
|
|
def delete_selection_shape(self):
|
|
@@ -4451,7 +4465,7 @@ class App(QtCore.QObject):
|
|
|
filenames = [str(filename) for filename in filenames]
|
|
filenames = [str(filename) for filename in filenames]
|
|
|
|
|
|
|
|
if len(filenames) == 0:
|
|
if len(filenames) == 0:
|
|
|
- self.inform.emit("[warning_notcl]Open Gerber cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Open Gerber cancelled.")
|
|
|
else:
|
|
else:
|
|
|
for filename in filenames:
|
|
for filename in filenames:
|
|
|
if filename != '':
|
|
if filename != '':
|
|
@@ -4489,7 +4503,7 @@ class App(QtCore.QObject):
|
|
|
follow = True
|
|
follow = True
|
|
|
|
|
|
|
|
if filename == "":
|
|
if filename == "":
|
|
|
- self.inform.emit("[warning_notcl]Open Gerber-Follow cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Open Gerber-Follow cancelled.")
|
|
|
else:
|
|
else:
|
|
|
self.worker_task.emit({'fcn': self.open_gerber,
|
|
self.worker_task.emit({'fcn': self.open_gerber,
|
|
|
'params': [filename, follow]})
|
|
'params': [filename, follow]})
|
|
@@ -4516,7 +4530,7 @@ class App(QtCore.QObject):
|
|
|
filenames = [str(filename) for filename in filenames]
|
|
filenames = [str(filename) for filename in filenames]
|
|
|
|
|
|
|
|
if len(filenames) == 0:
|
|
if len(filenames) == 0:
|
|
|
- self.inform.emit("[warning_notcl]Open Excellon cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Open Excellon cancelled.")
|
|
|
else:
|
|
else:
|
|
|
for filename in filenames:
|
|
for filename in filenames:
|
|
|
if filename != '':
|
|
if filename != '':
|
|
@@ -4546,7 +4560,7 @@ class App(QtCore.QObject):
|
|
|
filenames = [str(filename) for filename in filenames]
|
|
filenames = [str(filename) for filename in filenames]
|
|
|
|
|
|
|
|
if len(filenames) == 0:
|
|
if len(filenames) == 0:
|
|
|
- self.inform.emit("[warning_notcl]Open G-Code cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Open G-Code cancelled.")
|
|
|
else:
|
|
else:
|
|
|
for filename in filenames:
|
|
for filename in filenames:
|
|
|
if filename != '':
|
|
if filename != '':
|
|
@@ -4575,7 +4589,7 @@ class App(QtCore.QObject):
|
|
|
filename = str(filename)
|
|
filename = str(filename)
|
|
|
|
|
|
|
|
if filename == "":
|
|
if filename == "":
|
|
|
- self.inform.emit("[warning_notcl]Open Project cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Open Project cancelled.")
|
|
|
else:
|
|
else:
|
|
|
# self.worker_task.emit({'fcn': self.open_project,
|
|
# self.worker_task.emit({'fcn': self.open_project,
|
|
|
# 'params': [filename]})
|
|
# 'params': [filename]})
|
|
@@ -4606,7 +4620,7 @@ class App(QtCore.QObject):
|
|
|
# Check for more compatible types and add as required
|
|
# Check for more compatible types and add as required
|
|
|
if (not isinstance(obj, FlatCAMGeometry) and not isinstance(obj, FlatCAMGerber) and not isinstance(obj, FlatCAMCNCjob)
|
|
if (not isinstance(obj, FlatCAMGeometry) and not isinstance(obj, FlatCAMGerber) and not isinstance(obj, FlatCAMCNCjob)
|
|
|
and not isinstance(obj, FlatCAMExcellon)):
|
|
and not isinstance(obj, FlatCAMExcellon)):
|
|
|
- msg = "[error_notcl] Only Geometry, Gerber and CNCJob objects can be used."
|
|
|
|
|
|
|
+ msg = "[ERROR_NOTCL] Only Geometry, Gerber and CNCJob objects can be used."
|
|
|
msgbox = QtWidgets.QMessageBox()
|
|
msgbox = QtWidgets.QMessageBox()
|
|
|
msgbox.setInformativeText(msg)
|
|
msgbox.setInformativeText(msg)
|
|
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
|
@@ -4626,7 +4640,7 @@ class App(QtCore.QObject):
|
|
|
filename = str(filename)
|
|
filename = str(filename)
|
|
|
|
|
|
|
|
if filename == "":
|
|
if filename == "":
|
|
|
- self.inform.emit("[warning_notcl]Export SVG cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Export SVG cancelled.")
|
|
|
return
|
|
return
|
|
|
else:
|
|
else:
|
|
|
self.export_svg(name, filename)
|
|
self.export_svg(name, filename)
|
|
@@ -4640,7 +4654,7 @@ class App(QtCore.QObject):
|
|
|
image = _screenshot()
|
|
image = _screenshot()
|
|
|
data = np.asarray(image)
|
|
data = np.asarray(image)
|
|
|
if not data.ndim == 3 and data.shape[-1] in (3, 4):
|
|
if not data.ndim == 3 and data.shape[-1] in (3, 4):
|
|
|
- self.inform.emit('[[warning_notcl]] Data must be a 3D array with last dimension 3 or 4')
|
|
|
|
|
|
|
+ self.inform.emit('[[WARNING_NOTCL]] Data must be a 3D array with last dimension 3 or 4')
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
filter = "PNG File (*.png);;All Files (*.*)"
|
|
filter = "PNG File (*.png);;All Files (*.*)"
|
|
@@ -4670,7 +4684,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
obj = self.collection.get_active()
|
|
obj = self.collection.get_active()
|
|
|
if obj is None:
|
|
if obj is None:
|
|
|
- self.inform.emit("[warning_notcl] No object selected.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL] No object selected.")
|
|
|
msg = "Please Select an Excellon object to export"
|
|
msg = "Please Select an Excellon object to export"
|
|
|
msgbox = QtWidgets.QMessageBox()
|
|
msgbox = QtWidgets.QMessageBox()
|
|
|
msgbox.setInformativeText(msg)
|
|
msgbox.setInformativeText(msg)
|
|
@@ -4681,7 +4695,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
# Check for more compatible types and add as required
|
|
# Check for more compatible types and add as required
|
|
|
if not isinstance(obj, FlatCAMExcellon):
|
|
if not isinstance(obj, FlatCAMExcellon):
|
|
|
- msg = "[warning_notcl] Only Excellon objects can be used."
|
|
|
|
|
|
|
+ msg = "[WARNING_NOTCL] Only Excellon objects can be used."
|
|
|
msgbox = QtWidgets.QMessageBox()
|
|
msgbox = QtWidgets.QMessageBox()
|
|
|
msgbox.setInformativeText(msg)
|
|
msgbox.setInformativeText(msg)
|
|
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
|
@@ -4701,7 +4715,7 @@ class App(QtCore.QObject):
|
|
|
filename = str(filename)
|
|
filename = str(filename)
|
|
|
|
|
|
|
|
if filename == "":
|
|
if filename == "":
|
|
|
- self.inform.emit("[warning_notcl]Export Excellon cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Export Excellon cancelled.")
|
|
|
return
|
|
return
|
|
|
else:
|
|
else:
|
|
|
if altium_format == None:
|
|
if altium_format == None:
|
|
@@ -4722,7 +4736,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
obj = self.collection.get_active()
|
|
obj = self.collection.get_active()
|
|
|
if obj is None:
|
|
if obj is None:
|
|
|
- self.inform.emit("W[warning_notcl] No object selected.")
|
|
|
|
|
|
|
+ self.inform.emit("W[WARNING_NOTCL] No object selected.")
|
|
|
msg = "Please Select a Geometry object to export"
|
|
msg = "Please Select a Geometry object to export"
|
|
|
msgbox = QtWidgets.QMessageBox()
|
|
msgbox = QtWidgets.QMessageBox()
|
|
|
msgbox.setInformativeText(msg)
|
|
msgbox.setInformativeText(msg)
|
|
@@ -4733,7 +4747,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
# Check for more compatible types and add as required
|
|
# Check for more compatible types and add as required
|
|
|
if not isinstance(obj, FlatCAMGeometry):
|
|
if not isinstance(obj, FlatCAMGeometry):
|
|
|
- msg = "[error_notcl] Only Geometry objects can be used."
|
|
|
|
|
|
|
+ msg = "[ERROR_NOTCL] Only Geometry objects can be used."
|
|
|
msgbox = QtWidgets.QMessageBox()
|
|
msgbox = QtWidgets.QMessageBox()
|
|
|
msgbox.setInformativeText(msg)
|
|
msgbox.setInformativeText(msg)
|
|
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
|
@@ -4753,7 +4767,7 @@ class App(QtCore.QObject):
|
|
|
filename = str(filename)
|
|
filename = str(filename)
|
|
|
|
|
|
|
|
if filename == "":
|
|
if filename == "":
|
|
|
- self.inform.emit("[warning_notcl]Export DXF cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Export DXF cancelled.")
|
|
|
return
|
|
return
|
|
|
else:
|
|
else:
|
|
|
self.export_dxf(name, filename)
|
|
self.export_dxf(name, filename)
|
|
@@ -4782,7 +4796,7 @@ class App(QtCore.QObject):
|
|
|
filenames = [str(filename) for filename in filenames]
|
|
filenames = [str(filename) for filename in filenames]
|
|
|
|
|
|
|
|
if len(filenames) == 0:
|
|
if len(filenames) == 0:
|
|
|
- self.inform.emit("[warning_notcl]Open SVG cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Open SVG cancelled.")
|
|
|
else:
|
|
else:
|
|
|
for filename in filenames:
|
|
for filename in filenames:
|
|
|
if filename != '':
|
|
if filename != '':
|
|
@@ -4812,7 +4826,7 @@ class App(QtCore.QObject):
|
|
|
filenames = [str(filename) for filename in filenames]
|
|
filenames = [str(filename) for filename in filenames]
|
|
|
|
|
|
|
|
if len(filenames) == 0:
|
|
if len(filenames) == 0:
|
|
|
- self.inform.emit("[warning_notcl]Open DXF cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Open DXF cancelled.")
|
|
|
else:
|
|
else:
|
|
|
for filename in filenames:
|
|
for filename in filenames:
|
|
|
if filename != '':
|
|
if filename != '':
|
|
@@ -4841,7 +4855,7 @@ class App(QtCore.QObject):
|
|
|
filename = str(filename)
|
|
filename = str(filename)
|
|
|
|
|
|
|
|
if filename == "":
|
|
if filename == "":
|
|
|
- self.inform.emit("[warning_notcl]Open TCL script cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Open TCL script cancelled.")
|
|
|
else:
|
|
else:
|
|
|
try:
|
|
try:
|
|
|
with open(filename, "r") as tcl_script:
|
|
with open(filename, "r") as tcl_script:
|
|
@@ -4894,7 +4908,7 @@ class App(QtCore.QObject):
|
|
|
filename = str(filename)
|
|
filename = str(filename)
|
|
|
|
|
|
|
|
if filename == '':
|
|
if filename == '':
|
|
|
- self.inform.emit("[warning_notcl]Save Project cancelled.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]Save Project cancelled.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
@@ -5008,7 +5022,7 @@ class App(QtCore.QObject):
|
|
|
return "Could not retrieve object: %s" % box_name
|
|
return "Could not retrieve object: %s" % box_name
|
|
|
|
|
|
|
|
if box is None:
|
|
if box is None:
|
|
|
- self.inform.emit("[warning_notcl]No object Box. Using instead %s" % obj)
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]No object Box. Using instead %s" % obj)
|
|
|
box = obj
|
|
box = obj
|
|
|
|
|
|
|
|
def make_negative_film():
|
|
def make_negative_film():
|
|
@@ -5127,7 +5141,7 @@ class App(QtCore.QObject):
|
|
|
return "Could not retrieve object: %s" % box_name
|
|
return "Could not retrieve object: %s" % box_name
|
|
|
|
|
|
|
|
if box is None:
|
|
if box is None:
|
|
|
- self.inform.emit("[warning_notcl]No object Box. Using instead %s" % obj)
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL]No object Box. Using instead %s" % obj)
|
|
|
box = obj
|
|
box = obj
|
|
|
|
|
|
|
|
def make_black_film():
|
|
def make_black_film():
|
|
@@ -5295,14 +5309,14 @@ class App(QtCore.QObject):
|
|
|
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] Could not export Excellon file.')
|
|
|
|
|
|
|
+ self.inform.emit('[ERROR_NOTCL] 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]})
|
|
|
else:
|
|
else:
|
|
|
ret = make_excellon()
|
|
ret = make_excellon()
|
|
|
if ret == 'fail':
|
|
if ret == 'fail':
|
|
|
- self.inform.emit('[error_notcl] Could not export Excellon file.')
|
|
|
|
|
|
|
+ self.inform.emit('[ERROR_NOTCL] Could not export Excellon file.')
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
def export_dxf(self, obj_name, filename, use_thread=True):
|
|
def export_dxf(self, obj_name, filename, use_thread=True):
|
|
@@ -5351,14 +5365,14 @@ class App(QtCore.QObject):
|
|
|
def job_thread_exc(app_obj):
|
|
def job_thread_exc(app_obj):
|
|
|
ret = make_dxf()
|
|
ret = make_dxf()
|
|
|
if ret == 'fail':
|
|
if ret == 'fail':
|
|
|
- self.inform.emit('[[warning_notcl]] Could not export DXF file.')
|
|
|
|
|
|
|
+ self.inform.emit('[[WARNING_NOTCL]] Could not export DXF file.')
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
self.worker_task.emit({'fcn': job_thread_exc, 'params': [self]})
|
|
self.worker_task.emit({'fcn': job_thread_exc, 'params': [self]})
|
|
|
else:
|
|
else:
|
|
|
ret = make_dxf()
|
|
ret = make_dxf()
|
|
|
if ret == 'fail':
|
|
if ret == 'fail':
|
|
|
- self.inform.emit('[[warning_notcl]] Could not export DXF file.')
|
|
|
|
|
|
|
+ self.inform.emit('[[WARNING_NOTCL]] Could not export DXF file.')
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
def import_svg(self, filename, geo_type='geometry', outname=None):
|
|
def import_svg(self, filename, geo_type='geometry', outname=None):
|
|
@@ -5376,7 +5390,7 @@ class App(QtCore.QObject):
|
|
|
elif geo_type == "gerber":
|
|
elif geo_type == "gerber":
|
|
|
obj_type = geo_type
|
|
obj_type = geo_type
|
|
|
else:
|
|
else:
|
|
|
- self.inform.emit("[error_notcl] Not supported type was choosed as parameter. "
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Not supported type was choosed as parameter. "
|
|
|
"Only Geometry and Gerber are supported")
|
|
"Only Geometry and Gerber are supported")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
@@ -5417,7 +5431,7 @@ class App(QtCore.QObject):
|
|
|
elif geo_type == "gerber":
|
|
elif geo_type == "gerber":
|
|
|
obj_type = geo_type
|
|
obj_type = geo_type
|
|
|
else:
|
|
else:
|
|
|
- self.inform.emit("[error_notcl] Not supported type was choosed as parameter. "
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Not supported type was choosed as parameter. "
|
|
|
"Only Geometry and Gerber are supported")
|
|
"Only Geometry and Gerber are supported")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
@@ -5456,7 +5470,7 @@ class App(QtCore.QObject):
|
|
|
elif type == "gerber":
|
|
elif type == "gerber":
|
|
|
obj_type = type
|
|
obj_type = type
|
|
|
else:
|
|
else:
|
|
|
- self.inform.emit("[error_notcl] Not supported type was picked as parameter. "
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Not supported type was picked as parameter. "
|
|
|
"Only Geometry and Gerber are supported")
|
|
"Only Geometry and Gerber are supported")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
@@ -5505,27 +5519,27 @@ class App(QtCore.QObject):
|
|
|
try:
|
|
try:
|
|
|
gerber_obj.parse_file(filename, follow=follow)
|
|
gerber_obj.parse_file(filename, follow=follow)
|
|
|
except IOError:
|
|
except IOError:
|
|
|
- app_obj.inform.emit("[error_notcl] Failed to open file: " + filename)
|
|
|
|
|
|
|
+ app_obj.inform.emit("[ERROR_NOTCL] Failed to open file: " + filename)
|
|
|
app_obj.progress.emit(0)
|
|
app_obj.progress.emit(0)
|
|
|
- self.inform.emit('[error_notcl] Failed to open file: ' + filename)
|
|
|
|
|
|
|
+ self.inform.emit('[ERROR_NOTCL] Failed to open file: ' + filename)
|
|
|
return "fail"
|
|
return "fail"
|
|
|
except ParseError as err:
|
|
except ParseError as err:
|
|
|
- app_obj.inform.emit("[error_notcl] Failed to parse file: " + filename + ". " + str(err))
|
|
|
|
|
|
|
+ app_obj.inform.emit("[ERROR_NOTCL] Failed to parse file: " + filename + ". " + str(err))
|
|
|
app_obj.progress.emit(0)
|
|
app_obj.progress.emit(0)
|
|
|
self.log.error(str(err))
|
|
self.log.error(str(err))
|
|
|
return "fail"
|
|
return "fail"
|
|
|
|
|
|
|
|
except:
|
|
except:
|
|
|
- msg = "[error] An internal error has ocurred. See shell.\n"
|
|
|
|
|
|
|
+ msg = "[ERROR] An internal error has ocurred. See shell.\n"
|
|
|
msg += traceback.format_exc()
|
|
msg += traceback.format_exc()
|
|
|
app_obj.inform.emit(msg)
|
|
app_obj.inform.emit(msg)
|
|
|
return "fail"
|
|
return "fail"
|
|
|
|
|
|
|
|
if gerber_obj.is_empty():
|
|
if gerber_obj.is_empty():
|
|
|
- # app_obj.inform.emit("[error] No geometry found in file: " + filename)
|
|
|
|
|
|
|
+ # app_obj.inform.emit("[ERROR] No geometry found in file: " + filename)
|
|
|
# self.collection.set_active(gerber_obj.options["name"])
|
|
# self.collection.set_active(gerber_obj.options["name"])
|
|
|
# self.collection.delete_active()
|
|
# self.collection.delete_active()
|
|
|
- self.inform.emit("[error_notcl] Object is not Gerber file or empty. Aborting object creation.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Object is not Gerber file or empty. Aborting object creation.")
|
|
|
return "fail"
|
|
return "fail"
|
|
|
|
|
|
|
|
# Further parsing
|
|
# Further parsing
|
|
@@ -5546,7 +5560,7 @@ class App(QtCore.QObject):
|
|
|
### Object creation ###
|
|
### Object creation ###
|
|
|
ret = self.new_object("gerber", name, obj_init, autoselected=False)
|
|
ret = self.new_object("gerber", name, obj_init, autoselected=False)
|
|
|
if ret == 'fail':
|
|
if ret == 'fail':
|
|
|
- self.inform.emit('[error_notcl] Open Gerber failed. Probable not a Gerber file.')
|
|
|
|
|
|
|
+ self.inform.emit('[ERROR_NOTCL] Open Gerber failed. Probable not a Gerber file.')
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# Register recent file
|
|
# Register recent file
|
|
@@ -5582,15 +5596,15 @@ class App(QtCore.QObject):
|
|
|
ret = excellon_obj.parse_file(filename)
|
|
ret = excellon_obj.parse_file(filename)
|
|
|
if ret == "fail":
|
|
if ret == "fail":
|
|
|
log.debug("Excellon parsing failed.")
|
|
log.debug("Excellon parsing failed.")
|
|
|
- self.inform.emit("[error_notcl] This is not Excellon file.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] This is not Excellon file.")
|
|
|
return "fail"
|
|
return "fail"
|
|
|
except IOError:
|
|
except IOError:
|
|
|
- app_obj.inform.emit("[error_notcl] Cannot open file: " + filename)
|
|
|
|
|
|
|
+ app_obj.inform.emit("[ERROR_NOTCL] Cannot open file: " + filename)
|
|
|
log.debug("Could not open Excellon object.")
|
|
log.debug("Could not open Excellon object.")
|
|
|
self.progress.emit(0) # TODO: self and app_bjj mixed
|
|
self.progress.emit(0) # TODO: self and app_bjj mixed
|
|
|
return "fail"
|
|
return "fail"
|
|
|
except:
|
|
except:
|
|
|
- msg = "[error_notcl] An internal error has occurred. See shell.\n"
|
|
|
|
|
|
|
+ msg = "[ERROR_NOTCL] An internal error has occurred. See shell.\n"
|
|
|
msg += traceback.format_exc()
|
|
msg += traceback.format_exc()
|
|
|
app_obj.inform.emit(msg)
|
|
app_obj.inform.emit(msg)
|
|
|
return "fail"
|
|
return "fail"
|
|
@@ -5601,7 +5615,7 @@ class App(QtCore.QObject):
|
|
|
return "fail"
|
|
return "fail"
|
|
|
|
|
|
|
|
if excellon_obj.is_empty():
|
|
if excellon_obj.is_empty():
|
|
|
- app_obj.inform.emit("[error_notcl] No geometry found in file: " + filename)
|
|
|
|
|
|
|
+ app_obj.inform.emit("[ERROR_NOTCL] No geometry found in file: " + filename)
|
|
|
return "fail"
|
|
return "fail"
|
|
|
|
|
|
|
|
with self.proc_container.new("Opening Excellon."):
|
|
with self.proc_container.new("Opening Excellon."):
|
|
@@ -5611,7 +5625,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
ret = self.new_object("excellon", name, obj_init, autoselected=False)
|
|
ret = self.new_object("excellon", name, obj_init, autoselected=False)
|
|
|
if ret == 'fail':
|
|
if ret == 'fail':
|
|
|
- self.inform.emit('[error_notcl] Open Excellon file failed. Probable not an Excellon file.')
|
|
|
|
|
|
|
+ self.inform.emit('[ERROR_NOTCL] Open Excellon file failed. Probable not an Excellon file.')
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# Register recent file
|
|
# Register recent file
|
|
@@ -5650,7 +5664,7 @@ class App(QtCore.QObject):
|
|
|
gcode = f.read()
|
|
gcode = f.read()
|
|
|
f.close()
|
|
f.close()
|
|
|
except IOError:
|
|
except IOError:
|
|
|
- app_obj_.inform.emit("[error_notcl] Failed to open " + filename)
|
|
|
|
|
|
|
+ app_obj_.inform.emit("[ERROR_NOTCL] Failed to open " + filename)
|
|
|
self.progress.emit(0)
|
|
self.progress.emit(0)
|
|
|
return "fail"
|
|
return "fail"
|
|
|
|
|
|
|
@@ -5660,7 +5674,7 @@ class App(QtCore.QObject):
|
|
|
|
|
|
|
|
ret = job_obj.gcode_parse()
|
|
ret = job_obj.gcode_parse()
|
|
|
if ret == "fail":
|
|
if ret == "fail":
|
|
|
- self.inform.emit("[error_notcl] This is not GCODE")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] This is not GCODE")
|
|
|
return "fail"
|
|
return "fail"
|
|
|
|
|
|
|
|
self.progress.emit(60)
|
|
self.progress.emit(60)
|
|
@@ -5674,7 +5688,7 @@ class App(QtCore.QObject):
|
|
|
# New object creation and file processing
|
|
# New object creation and file processing
|
|
|
ret = self.new_object("cncjob", name, obj_init, autoselected=False)
|
|
ret = self.new_object("cncjob", name, obj_init, autoselected=False)
|
|
|
if ret == 'fail':
|
|
if ret == 'fail':
|
|
|
- self.inform.emit("[error_notcl] Failed to create CNCJob Object. Probable not a GCode file.\n "
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to create CNCJob Object. Probable not a GCode file.\n "
|
|
|
"Attempting to create a FlatCAM CNCJob Object from "
|
|
"Attempting to create a FlatCAM CNCJob Object from "
|
|
|
"G-Code file failed during processing")
|
|
"G-Code file failed during processing")
|
|
|
return "fail"
|
|
return "fail"
|
|
@@ -5708,14 +5722,14 @@ class App(QtCore.QObject):
|
|
|
f = open(filename, 'r')
|
|
f = open(filename, 'r')
|
|
|
except IOError:
|
|
except IOError:
|
|
|
App.log.error("Failed to open project file: %s" % filename)
|
|
App.log.error("Failed to open project file: %s" % filename)
|
|
|
- self.inform.emit("[error_notcl] Failed to open project file: %s" % filename)
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to open project file: %s" % filename)
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
d = json.load(f, object_hook=dict2obj)
|
|
d = json.load(f, object_hook=dict2obj)
|
|
|
except:
|
|
except:
|
|
|
App.log.error("Failed to parse project file: %s" % filename)
|
|
App.log.error("Failed to parse project file: %s" % filename)
|
|
|
- self.inform.emit("[error_notcl] Failed to parse project file: %s" % filename)
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to parse project file: %s" % filename)
|
|
|
f.close()
|
|
f.close()
|
|
|
return
|
|
return
|
|
|
|
|
|
|
@@ -6066,14 +6080,14 @@ class App(QtCore.QObject):
|
|
|
f = open(self.data_path + '/recent.json')
|
|
f = open(self.data_path + '/recent.json')
|
|
|
except IOError:
|
|
except IOError:
|
|
|
App.log.error("Failed to load recent item list.")
|
|
App.log.error("Failed to load recent item list.")
|
|
|
- self.inform.emit("[error_notcl] Failed to load recent item list.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to load recent item list.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
self.recent = json.load(f)
|
|
self.recent = json.load(f)
|
|
|
except json.scanner.JSONDecodeError:
|
|
except json.scanner.JSONDecodeError:
|
|
|
App.log.error("Failed to parse recent item list.")
|
|
App.log.error("Failed to parse recent item list.")
|
|
|
- self.inform.emit("[error_notcl] Failed to parse recent item list.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to parse recent item list.")
|
|
|
f.close()
|
|
f.close()
|
|
|
return
|
|
return
|
|
|
f.close()
|
|
f.close()
|
|
@@ -6180,14 +6194,14 @@ class App(QtCore.QObject):
|
|
|
except:
|
|
except:
|
|
|
# App.log.warning("Failed checking for latest version. Could not connect.")
|
|
# App.log.warning("Failed checking for latest version. Could not connect.")
|
|
|
self.log.warning("Failed checking for latest version. Could not connect.")
|
|
self.log.warning("Failed checking for latest version. Could not connect.")
|
|
|
- self.inform.emit("[warning_notcl] Failed checking for latest version. Could not connect.")
|
|
|
|
|
|
|
+ self.inform.emit("[WARNING_NOTCL] Failed checking for latest version. Could not connect.")
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
data = json.load(f)
|
|
data = json.load(f)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
App.log.error("Could not parse information about latest version.")
|
|
App.log.error("Could not parse information about latest version.")
|
|
|
- self.inform.emit("[error_notcl] Could not parse information about latest version.")
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Could not parse information about latest version.")
|
|
|
App.log.debug("json.load(): %s" % str(e))
|
|
App.log.debug("json.load(): %s" % str(e))
|
|
|
f.close()
|
|
f.close()
|
|
|
return
|
|
return
|
|
@@ -6344,7 +6358,7 @@ class App(QtCore.QObject):
|
|
|
try:
|
|
try:
|
|
|
self.collection.get_active().read_form()
|
|
self.collection.get_active().read_form()
|
|
|
except:
|
|
except:
|
|
|
- self.log.debug("[warning] There was no active object")
|
|
|
|
|
|
|
+ self.log.debug("[WARNING] There was no active object")
|
|
|
pass
|
|
pass
|
|
|
# Project options
|
|
# Project options
|
|
|
self.options_read_form()
|
|
self.options_read_form()
|
|
@@ -6358,7 +6372,7 @@ class App(QtCore.QObject):
|
|
|
try:
|
|
try:
|
|
|
f = open(filename, 'w')
|
|
f = open(filename, 'w')
|
|
|
except IOError:
|
|
except IOError:
|
|
|
- App.log.error("[error] Failed to open file for saving: %s", filename)
|
|
|
|
|
|
|
+ App.log.error("[ERROR] Failed to open file for saving: %s", filename)
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
# Write
|
|
# Write
|
|
@@ -6370,13 +6384,13 @@ class App(QtCore.QObject):
|
|
|
try:
|
|
try:
|
|
|
saved_f = open(filename, 'r')
|
|
saved_f = open(filename, 'r')
|
|
|
except IOError:
|
|
except IOError:
|
|
|
- self.inform.emit("[error_notcl] Failed to verify project file: %s. Retry to save it." % filename)
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to verify project file: %s. Retry to save it." % filename)
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
|
saved_d = json.load(saved_f, object_hook=dict2obj)
|
|
saved_d = json.load(saved_f, object_hook=dict2obj)
|
|
|
except:
|
|
except:
|
|
|
- self.inform.emit("[error_notcl] Failed to parse saved project file: %s. Retry to save it." % filename)
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to parse saved project file: %s. Retry to save it." % filename)
|
|
|
f.close()
|
|
f.close()
|
|
|
return
|
|
return
|
|
|
saved_f.close()
|
|
saved_f.close()
|
|
@@ -6384,7 +6398,7 @@ class App(QtCore.QObject):
|
|
|
if 'version' in saved_d:
|
|
if 'version' in saved_d:
|
|
|
self.inform.emit("[success] Project saved to: %s" % filename)
|
|
self.inform.emit("[success] Project saved to: %s" % filename)
|
|
|
else:
|
|
else:
|
|
|
- self.inform.emit("[error_notcl] Failed to save project file: %s. Retry to save it." % filename)
|
|
|
|
|
|
|
+ self.inform.emit("[ERROR_NOTCL] Failed to save project file: %s. Retry to save it." % filename)
|
|
|
|
|
|
|
|
def on_options_app2project(self):
|
|
def on_options_app2project(self):
|
|
|
"""
|
|
"""
|