- fixed bug saving the FlatCAM project saying the file is used by another application

This commit is contained in:
Marius Stanciu 2019-12-17 15:19:09 +02:00
parent 0e3a9f0795
commit 994fa65e96
2 changed files with 6 additions and 15 deletions

View File

@ -10254,13 +10254,6 @@ class App(QtCore.QObject):
self.inform.emit('[WARNING_NOTCL] %s' % _("Save Project cancelled."))
return
try:
f = open(filename, 'r')
f.close()
except IOError:
self.inform.emit('[ERROR_NOTCL] %s' % _("The object is used by another application."))
return
if use_thread is True:
self.worker_task.emit({'fcn': self.save_project,
'params': [filename, quit_action]})
@ -12167,14 +12160,14 @@ class App(QtCore.QObject):
g = json.dumps(d, default=to_dict, indent=2, sort_keys=True).encode('utf-8')
# # Write
f.write(g)
self.inform.emit('[success] %s: %s' %
(_("Project saved to"), filename))
self.inform.emit('[success] %s: %s' % (_("Project saved to"), filename))
else:
# Open file
try:
f = open(filename, 'w')
except IOError:
App.log.error("Failed to open file for saving: %s", filename)
self.inform.emit('[ERROR_NOTCL] %s' % _("The object is used by another application."))
return
# Write
@ -12188,8 +12181,7 @@ class App(QtCore.QObject):
except IOError:
if silent is False:
self.inform.emit('[ERROR_NOTCL] %s: %s %s' %
(_("Failed to verify project file"), filename, _("Retry to save it."))
)
(_("Failed to verify project file"), filename, _("Retry to save it.")))
return
try:
@ -12197,8 +12189,7 @@ class App(QtCore.QObject):
except Exception:
if silent is False:
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()
return
saved_f.close()
@ -12209,8 +12200,7 @@ class App(QtCore.QObject):
(_("Project saved to"), filename))
else:
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.")))
tb_settings = QSettings("Open Source", "FlatCAM")
lock_state = self.ui.lock_action.isChecked()

View File

@ -20,6 +20,7 @@ CAD program, and create G-Code for Isolation routing.
- fixed the generate_from_geometry_2() method to use the default values in case the parameters are None
- added ability to save the Source File as PDF - fixed page size and added line breaks
- more mods to generate_from_geometry_2() method
- fixed bug saving the FlatCAM project saying the file is used by another application
16.12.2019