- fixed issue with calling the inform signal in the FlatCAMDefaults.load method

- fixed macro parsing in Gerber files generated by KiCAD 4.99 (KiCAD 5.0)
This commit is contained in:
Marius Stanciu
2020-10-18 22:06:06 +03:00
committed by Marius
parent f643d0e4cd
commit 13d4192124
5 changed files with 84 additions and 23 deletions

View File

@@ -834,8 +834,13 @@ class FlatCAMDefaults:
with open(filename, "w") as file:
simplejson.dump(self.defaults, file, default=to_dict, indent=2, sort_keys=True)
def load(self, filename: str):
"""Loads the defaults from a file on disk, performing migration if required."""
def load(self, filename: str, inform):
"""
Loads the defaults from a file on disk, performing migration if required.
:param filename: a path to the file that is to be loaded
:param inform: a pyqtSignal used to display information's in the StatusBar of the GUI
"""
# Read in the file
try:
@@ -844,7 +849,7 @@ class FlatCAMDefaults:
f.close()
except IOError:
log.error("Could not load defaults file.")
self.inform.emit('[ERROR] %s' % _("Could not load defaults file."))
inform.emit('[ERROR] %s' % _("Could not load defaults file."))
# in case the defaults file can't be loaded, show all toolbars
self.defaults["global_toolbar_view"] = 511
return
@@ -857,7 +862,7 @@ class FlatCAMDefaults:
self.defaults["global_toolbar_view"] = 511
e = sys.exc_info()[0]
log.error(str(e))
self.inform.emit('[ERROR] %s' % _("Failed to parse defaults file."))
inform.emit('[ERROR] %s' % _("Failed to parse defaults file."))
return
if defaults is None:
return