From 994fa65e96c586e3a37dae574f653ebf25a60c7b Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 17 Dec 2019 15:19:09 +0200 Subject: [PATCH] - fixed bug saving the FlatCAM project saying the file is used by another application --- FlatCAMApp.py | 20 +++++--------------- README.md | 1 + 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index fe761904..22e9bdac 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -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() diff --git a/README.md b/README.md index c5c797b5..04c46dd4 100644 --- a/README.md +++ b/README.md @@ -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