- fixed bug saving the FlatCAM project saying the file is used by another application
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user