- changed the save_project() method such that when the project is saved as compressed now the compression is first done in memory and only after that the app will attempt to write it to a file on disk
This commit is contained in:
@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
3.05.2021
|
||||||
|
|
||||||
|
- changed the save_project() method such that when the project is saved as compressed now the compression is first done in memory and only after that the app will attempt to write it to a file on disk
|
||||||
|
|
||||||
29.04.2021
|
29.04.2021
|
||||||
|
|
||||||
- in CNCJob object, for CNCJob objects created when importing a foreign Gcode file, fixed the updating of the tool diameter
|
- in CNCJob object, for CNCJob objects created when importing a foreign Gcode file, fixed the updating of the tool diameter
|
||||||
@@ -22,7 +26,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
5.04.2021
|
5.04.2021
|
||||||
|
|
||||||
- now every version of FlatCAM beta creates it's own set of Preferences files
|
- now every version of FlatCAM beta creates its own set of Preferences files
|
||||||
|
|
||||||
4.04.2021
|
4.04.2021
|
||||||
|
|
||||||
@@ -30,7 +34,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
1.04.2021
|
1.04.2021
|
||||||
|
|
||||||
- fixed bug in the Drilling Tool when there are tools without drill points
|
- fixed a bug in the Drilling Tool when there are tools without drill points
|
||||||
|
|
||||||
29.03.2021
|
29.03.2021
|
||||||
|
|
||||||
|
|||||||
33
app_Main.py
33
app_Main.py
@@ -11277,11 +11277,30 @@ class MenuFileHandlers(QtCore.QObject):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.defaults["global_save_compressed"] is True:
|
if self.defaults["global_save_compressed"] is True:
|
||||||
with lzma.open(filename, "w", preset=int(self.defaults['global_compression_level'])) as f:
|
try:
|
||||||
g = json.dumps(d, default=to_dict, indent=2, sort_keys=True).encode('utf-8')
|
project_as_json = json.dumps(d, default=to_dict, indent=2, sort_keys=True).encode('utf-8')
|
||||||
# # Write
|
# with lzma.open(filename, "w", preset=int(self.defaults['global_compression_level'])) as f:
|
||||||
f.write(g)
|
# # # Write
|
||||||
|
# f.write(project_as_json)
|
||||||
|
|
||||||
|
compressor_obj = lzma.LZMACompressor(preset=int(self.defaults['global_compression_level']))
|
||||||
|
out1 = compressor_obj.compress(project_as_json)
|
||||||
|
out2 = compressor_obj.flush()
|
||||||
|
project_zipped = b"".join([out1, out2])
|
||||||
|
except Exception:
|
||||||
|
self.log.error("Failed to save file: %s", filename)
|
||||||
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Failed."))
|
||||||
|
return
|
||||||
|
|
||||||
|
if project_zipped != b'':
|
||||||
|
with open(filename, "wb") as f_to_write:
|
||||||
|
f_to_write.write(project_zipped)
|
||||||
|
|
||||||
self.inform.emit('[success] %s: %s' % (_("Project saved to"), filename))
|
self.inform.emit('[success] %s: %s' % (_("Project saved to"), filename))
|
||||||
|
else:
|
||||||
|
self.log.error("Failed to save file: %s", filename)
|
||||||
|
self.inform.emit('[ERROR_NOTCL] %s' % _("Failed."))
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
# Open file
|
# Open file
|
||||||
try:
|
try:
|
||||||
@@ -11307,12 +11326,18 @@ class MenuFileHandlers(QtCore.QObject):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
saved_d = json.load(saved_f, object_hook=dict2obj)
|
saved_d = json.load(saved_f, object_hook=dict2obj)
|
||||||
|
if not saved_d:
|
||||||
|
self.inform.emit('[ERROR_NOTCL] %s: %s %s' %
|
||||||
|
(_("Failed to parse saved project file"), filename, _("Retry to save it.")))
|
||||||
|
f.close()
|
||||||
|
return
|
||||||
except Exception:
|
except Exception:
|
||||||
if silent is False:
|
if silent is False:
|
||||||
self.inform.emit('[ERROR_NOTCL] %s: %s %s' %
|
self.inform.emit('[ERROR_NOTCL] %s: %s %s' %
|
||||||
(_("Failed to parse saved project file"), filename, _("Retry to save it.")))
|
(_("Failed to parse saved project file"), filename, _("Retry to save it.")))
|
||||||
f.close()
|
f.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
saved_f.close()
|
saved_f.close()
|
||||||
|
|
||||||
if silent is False:
|
if silent is False:
|
||||||
|
|||||||
Reference in New Issue
Block a user