Jelajahi Sumber

- removed the f-strings replacing them with the traditional string formatting due of not being supported by older versions of Python 3

Marius Stanciu 6 tahun lalu
induk
melakukan
a4f5ed0b74
3 mengubah file dengan 24 tambahan dan 22 penghapusan
  1. 10 12
      FlatCAMApp.py
  2. 10 10
      FlatCAMCommon.py
  3. 4 0
      README.md

+ 10 - 12
FlatCAMApp.py

@@ -4708,8 +4708,7 @@ class App(QtCore.QObject):
             e = sys.exc_info()[0]
             App.log.error("Could not load defaults file.")
             App.log.error(str(e))
-            self.inform.emit('[ERROR_NOTCL] %s' %
-                             _("Could not load defaults file."))
+            self.inform.emit('[ERROR_NOTCL] %s' % _("Could not load defaults file."))
             return
 
         try:
@@ -4718,8 +4717,7 @@ class App(QtCore.QObject):
             e = sys.exc_info()[0]
             App.log.error("Failed to parse defaults file.")
             App.log.error(str(e))
-            self.inform.emit('[ERROR_NOTCL] %s' %
-                             _("Failed to parse defaults file."))
+            self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to parse defaults file."))
             return
 
         # Update options
@@ -4766,11 +4764,11 @@ class App(QtCore.QObject):
             f.close()
         except Exception as e:
             log.debug("App.save_defaults() --> %s" % str(e))
-            self.inform.emit(f'[ERROR_NOTCL] {_("Failed to write defaults to file.")}')
+            self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to write defaults to file."))
             return
 
         if not silent:
-            self.inform.emit(f'[success] {_("Preferences saved.")}')
+            self.inform.emit('[success] %s' % _("Preferences saved."))
 
     def save_factory_defaults(self, silent_message=False, data_path=None):
         """
@@ -4798,7 +4796,7 @@ class App(QtCore.QObject):
             e = sys.exc_info()[0]
             App.log.error("Could not load factory defaults file.")
             App.log.error(str(e))
-            self.inform.emit(f'[ERROR_NOTCL] {_("Could not load factory defaults file.")}')
+            self.inform.emit('[ERROR_NOTCL] %s' % _("Could not load factory defaults file."))
             return
 
         try:
@@ -4807,7 +4805,7 @@ class App(QtCore.QObject):
             e = sys.exc_info()[0]
             App.log.error("Failed to parse factory defaults file.")
             App.log.error(str(e))
-            self.inform.emit(f'[ERROR_NOTCL] {_("Failed to parse factory defaults file.")}')
+            self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to parse factory defaults file."))
             return
 
         # Update options
@@ -4821,12 +4819,12 @@ class App(QtCore.QObject):
             json.dump(factory_defaults, f_f_def_s, default=to_dict, indent=2, sort_keys=True)
             f_f_def_s.close()
         except Exception as e:
-            log.debug(f"App.save_factory_default() save update --> {str(e)}")
-            self.inform.emit(f'[ERROR_NOTCL] {_("Failed to write factory defaults to file.")}')
+            log.debug("App.save_factory_default() save update --> %s" % str(e))
+            self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to write factory defaults to file."))
             return
 
         if silent_message is False:
-            self.inform.emit(f'{_("Factory defaults saved.")}')
+            self.inform.emit(_("Factory defaults saved."))
 
     def final_save(self):
         """
@@ -4836,7 +4834,7 @@ class App(QtCore.QObject):
         :return: None
         """
         if self.save_in_progress:
-            self.inform.emit(f'[WARNING_NOTCL] {_("Application is saving the project. Please wait ...")}')
+            self.inform.emit('[WARNING_NOTCL] %s' % _("Application is saving the project. Please wait ..."))
             return
 
         if self.should_we_save and self.collection.get_list():

+ 10 - 10
FlatCAMCommon.py

@@ -257,7 +257,7 @@ class BookmarkManager(QtWidgets.QWidget):
         else:
             title = self.title_entry.get_value()
         if title == '':
-            self.app.inform.emit(f'[ERROR_NOTCL] {_("Title entry is empty.")}')
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Title entry is empty."))
             return 'fail'
 
         if 'link' is kwargs:
@@ -266,7 +266,7 @@ class BookmarkManager(QtWidgets.QWidget):
             link = self.link_entry.get_value()
 
         if link == 'http://':
-            self.app.inform.emit(f'[ERROR_NOTCL] {_("Web link entry is empty.")}')
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _("Web link entry is empty."))
             return 'fail'
 
         # if 'http' not in link or 'https' not in link:
@@ -274,7 +274,7 @@ class BookmarkManager(QtWidgets.QWidget):
 
         for bookmark in self.bm_dict.values():
             if title == bookmark[0] or link == bookmark[1]:
-                self.app.inform.emit(f'[ERROR_NOTCL] {_("Either the Title or the Weblink already in the table.")}')
+                self.app.inform.emit('[ERROR_NOTCL] %s' % _("Either the Title or the Weblink already in the table."))
                 return 'fail'
 
         # for some reason if the last char in the weblink is a slash it does not make the link clickable
@@ -294,7 +294,7 @@ class BookmarkManager(QtWidgets.QWidget):
             act.triggered.connect(lambda: webbrowser.open(link))
             self.app.ui.menuhelp_bookmarks.insertAction(self.app.ui.menuhelp_bookmarks_manager, act)
 
-        self.app.inform.emit(f'[success] {_("Bookmark added.")}')
+        self.app.inform.emit('[success] %s' % _("Bookmark added."))
 
         # add the new entry to the bookmark manager table
         self.build_bm_ui()
@@ -342,7 +342,7 @@ class BookmarkManager(QtWidgets.QWidget):
         self.bm_dict = deepcopy(new_dict)
         new_dict.clear()
 
-        self.app.inform.emit(f'[success] {_("Bookmark removed.")}')
+        self.app.inform.emit('[success] %s' % _("Bookmark removed."))
 
         # for index in index_list:
         #     self.table_widget.model().removeRow(index.row())
@@ -990,7 +990,7 @@ class ToolsDB(QtWidgets.QWidget):
         # add the new entry to the Tools DB table
         self.build_db_ui()
         self.callback_on_edited()
-        self.app.inform.emit(f'[success] {_("Tool added to DB.")}')
+        self.app.inform.emit('[success] %s' % _("Tool added to DB."))
 
     def on_tool_copy(self):
         """
@@ -1011,7 +1011,7 @@ class ToolsDB(QtWidgets.QWidget):
 
         self.build_db_ui()
         self.callback_on_edited()
-        self.app.inform.emit(f'[success] {_("Tool copied from Tools DB.")}')
+        self.app.inform.emit('[success] %s' % _("Tool copied from Tools DB."))
 
     def on_tool_delete(self):
         """
@@ -1029,7 +1029,7 @@ class ToolsDB(QtWidgets.QWidget):
 
         self.build_db_ui()
         self.callback_on_edited()
-        self.app.inform.emit(f'[success] {_("Tool removed from Tools DB.")}')
+        self.app.inform.emit('[success] %s' % _("Tool removed from Tools DB."))
 
     def on_export_tools_db_file(self):
         self.app.report_usage("on_export_tools_db_file")
@@ -1080,7 +1080,7 @@ class ToolsDB(QtWidgets.QWidget):
                         json.dump(self.db_tool_dict, f, default=to_dict, indent=2)
                 except Exception as e:
                     self.app.log.debug("App.on_save_tools_db() --> %s" % str(e))
-                    self.inform.emit(f'[ERROR_NOTCL] {_("Failed to write Tools DB to file.")}')
+                    self.inform.emit('[ERROR_NOTCL] %s' % _("Failed to write Tools DB to file."))
                     return
             except Exception:
                 self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed to write Tools DB to file."))
@@ -1135,7 +1135,7 @@ class ToolsDB(QtWidgets.QWidget):
                     f.close()
                 except Exception as e:
                     self.app.log.debug("ToolsDB.on_save_tools_db() --> %s" % str(e))
-                    self.app.inform.emit(f'[ERROR_NOTCL] {_("Failed to write Tools DB to file.")}')
+                    self.app.inform.emit('[ERROR_NOTCL] %s' % _("Failed to write Tools DB to file."))
                     return
 
                 if not silent:

+ 4 - 0
README.md

@@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing.
 
 =================================================
 
+19.11.2019
+
+- removed the f-strings replacing them with the traditional string formatting due of not being supported by older versions of Python 3
+
 18.11.2019
 
 - finished the Dots and Squares options in the Copper Thieving Tool