Просмотр исходного кода

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

Marius Stanciu 6 лет назад
Родитель
Сommit
994fa65e96
2 измененных файлов с 6 добавлено и 15 удалено
  1. 5 15
      FlatCAMApp.py
  2. 1 0
      README.md

+ 5 - 15
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()

+ 1 - 0
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