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

- fixed bug in Gerber Editor in which the units conversion wasn't calculated correct
- fixed bug in Gerber Editor in which the QThread that is started on object edit was not stopped at clean up stage
- fixed bug in Gerber Editor that kept all the apertures (including the geometry) of a previously edited object that was not saved after edit

Marius Stanciu 5 лет назад
Родитель
Сommit
48b3f8d65a

+ 3 - 0
CHANGELOG.md

@@ -11,6 +11,9 @@ CHANGELOG for FlatCAM beta
 
 
 - changed the icons for the grid snap in the status bar
 - changed the icons for the grid snap in the status bar
 - moved some of the methods from FlatCAMApp.App to flatcamGUI.FlatCAMGUI class
 - moved some of the methods from FlatCAMApp.App to flatcamGUI.FlatCAMGUI class
+- fixed bug in Gerber Editor in which the units conversion wasn't calculated correct
+- fixed bug in Gerber Editor in which the QThread that is started on object edit was not stopped at clean up stage
+- fixed bug in Gerber Editor that kept all the apertures (including the geometry) of a previously edited object that was not saved after edit
 
 
 01.05.2020
 01.05.2020
 
 

+ 7 - 25
FlatCAMApp.py

@@ -6940,7 +6940,6 @@ class App(QtCore.QObject):
                 else:
                 else:
 
 
                     key_modifier = QtWidgets.QApplication.keyboardModifiers()
                     key_modifier = QtWidgets.QApplication.keyboardModifiers()
-
                     if key_modifier == QtCore.Qt.ShiftModifier:
                     if key_modifier == QtCore.Qt.ShiftModifier:
                         mod_key = 'Shift'
                         mod_key = 'Shift'
                     elif key_modifier == QtCore.Qt.ControlModifier:
                     elif key_modifier == QtCore.Qt.ControlModifier:
@@ -6949,20 +6948,19 @@ class App(QtCore.QObject):
                         mod_key = None
                         mod_key = None
 
 
                     try:
                     try:
-                        if mod_key == self.defaults["global_mselect_key"]:
+                        if self.command_active is None:
                             # If the CTRL key is pressed when the LMB is clicked then if the object is selected it will
                             # If the CTRL key is pressed when the LMB is clicked then if the object is selected it will
                             # deselect, and if it's not selected then it will be selected
                             # deselect, and if it's not selected then it will be selected
                             # If there is no active command (self.command_active is None) then we check if we clicked
                             # If there is no active command (self.command_active is None) then we check if we clicked
                             # on a object by checking the bounding limits against mouse click position
                             # on a object by checking the bounding limits against mouse click position
-                            if self.command_active is None:
+                            if mod_key == self.defaults["global_mselect_key"]:
                                 self.select_objects(key='multisel')
                                 self.select_objects(key='multisel')
-                                self.delete_hover_shape()
-                        else:
-                            # If there is no active command (self.command_active is None) then we check if we clicked
-                            # on a object by checking the bounding limits against mouse click position
-                            if self.command_active is None:
+                            else:
+                                # If there is no active command (self.command_active is None) then we check if
+                                # we clicked on a object by checking the bounding limits against mouse click position
                                 self.select_objects()
                                 self.select_objects()
-                                self.delete_hover_shape()
+
+                            self.delete_hover_shape()
                     except Exception as e:
                     except Exception as e:
                         log.warning("FlatCAMApp.on_mouse_click_release_over_plot() select click --> Error: %s" % str(e))
                         log.warning("FlatCAMApp.on_mouse_click_release_over_plot() select click --> Error: %s" % str(e))
                         return
                         return
@@ -8158,7 +8156,6 @@ class App(QtCore.QObject):
     # ###############################################################################################################
     # ###############################################################################################################
     # ### The following section has the functions that are displayed and call the Editor tab CNCJob Tab #############
     # ### The following section has the functions that are displayed and call the Editor tab CNCJob Tab #############
     # ###############################################################################################################
     # ###############################################################################################################
-
     def init_code_editor(self, name):
     def init_code_editor(self, name):
 
 
         self.text_editor_tab = TextEditor(app=self, plain_text=True)
         self.text_editor_tab = TextEditor(app=self, plain_text=True)
@@ -10820,21 +10817,6 @@ class App(QtCore.QObject):
             #                       no_km)
             #                       no_km)
             # QtWidgets.qApp.sendEvent(self.shell._edit, f)
             # QtWidgets.qApp.sendEvent(self.shell._edit, f)
 
 
-    def on_toggle_shell_from_settings(self, state):
-        """
-        Toggle shell: if is visible close it, if it is closed then open it
-        :return: None
-        """
-
-        self.defaults.report_usage("on_toggle_shell_from_settings()")
-
-        if state is True:
-            if not self.ui.shell_dock.isVisible():
-                self.ui.shell_dock.show()
-        else:
-            if self.ui.shell_dock.isVisible():
-                self.ui.shell_dock.hide()
-
     def shell_message(self, msg, show=False, error=False, warning=False, success=False, selected=False):
     def shell_message(self, msg, show=False, error=False, warning=False, success=False, selected=False):
         """
         """
         Shows a message on the FlatCAM Shell
         Shows a message on the FlatCAM Shell

+ 1 - 1
flatcamEditors/FlatCAMExcEditor.py

@@ -2837,7 +2837,7 @@ class FlatCAMExcEditor(QtCore.QObject):
         # start with GRID toolbar activated
         # start with GRID toolbar activated
         if self.app.ui.grid_snap_btn.isChecked() is False:
         if self.app.ui.grid_snap_btn.isChecked() is False:
             self.app.ui.grid_snap_btn.trigger()
             self.app.ui.grid_snap_btn.trigger()
-            self.app.on_grid_snap_triggered(state=True)
+            self.app.ui.on_grid_snap_triggered(state=True)
 
 
         self.app.ui.popmenu_disable.setVisible(False)
         self.app.ui.popmenu_disable.setVisible(False)
         self.app.ui.cmenu_newmenu.menuAction().setVisible(False)
         self.app.ui.cmenu_newmenu.menuAction().setVisible(False)

+ 1 - 1
flatcamEditors/FlatCAMGeoEditor.py

@@ -4100,7 +4100,7 @@ class FlatCAMGeoEditor(QtCore.QObject):
         # start with GRID toolbar activated
         # start with GRID toolbar activated
         if self.app.ui.grid_snap_btn.isChecked() is False:
         if self.app.ui.grid_snap_btn.isChecked() is False:
             self.app.ui.grid_snap_btn.trigger()
             self.app.ui.grid_snap_btn.trigger()
-            self.app.on_grid_snap_triggered(state=True)
+            self.app.ui.on_grid_snap_triggered(state=True)
 
 
     def on_buffer_tool(self):
     def on_buffer_tool(self):
         buff_tool = BufferSelectionTool(self.app, self)
         buff_tool = BufferSelectionTool(self.app, self)

+ 18 - 5
flatcamEditors/FlatCAMGrbEditor.py

@@ -3703,7 +3703,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
         # start with GRID toolbar activated
         # start with GRID toolbar activated
         if self.app.ui.grid_snap_btn.isChecked() is False:
         if self.app.ui.grid_snap_btn.isChecked() is False:
             self.app.ui.grid_snap_btn.trigger()
             self.app.ui.grid_snap_btn.trigger()
-            self.app.on_grid_snap_triggered(state=True)
+            self.app.ui.on_grid_snap_triggered(state=True)
 
 
         # adjust the visibility of some of the canvas context menu
         # adjust the visibility of some of the canvas context menu
         self.app.ui.popmenu_edit.setVisible(False)
         self.app.ui.popmenu_edit.setVisible(False)
@@ -3723,6 +3723,8 @@ class FlatCAMGrbEditor(QtCore.QObject):
         except Exception as e:
         except Exception as e:
             log.debug("FlatCAMGrbEditor.deactivate_grb_editor() --> %s" % str(e))
             log.debug("FlatCAMGrbEditor.deactivate_grb_editor() --> %s" % str(e))
 
 
+        self.clear()
+
         # adjust the status of the menu entries related to the editor
         # adjust the status of the menu entries related to the editor
         self.app.ui.menueditedit.setDisabled(False)
         self.app.ui.menueditedit.setDisabled(False)
         self.app.ui.menueditok.setDisabled(True)
         self.app.ui.menueditok.setDisabled(True)
@@ -3731,7 +3733,6 @@ class FlatCAMGrbEditor(QtCore.QObject):
         self.app.ui.popmenu_save.setVisible(False)
         self.app.ui.popmenu_save.setVisible(False)
 
 
         self.disconnect_canvas_event_handlers()
         self.disconnect_canvas_event_handlers()
-        self.clear()
         self.app.ui.grb_edit_toolbar.setDisabled(True)
         self.app.ui.grb_edit_toolbar.setDisabled(True)
 
 
         settings = QSettings("Open Source", "FlatCAM")
         settings = QSettings("Open Source", "FlatCAM")
@@ -3939,8 +3940,12 @@ class FlatCAMGrbEditor(QtCore.QObject):
             pass
             pass
 
 
     def clear(self):
     def clear(self):
+        self.thread.quit()
+
         self.active_tool = None
         self.active_tool = None
         self.selected = []
         self.selected = []
+        self.storage_dict.clear()
+        self.results.clear()
 
 
         self.shapes.clear(update=True)
         self.shapes.clear(update=True)
         self.tool_shape.clear(update=True)
         self.tool_shape.clear(update=True)
@@ -3970,7 +3975,16 @@ class FlatCAMGrbEditor(QtCore.QObject):
 
 
         file_units = self.gerber_obj.units if self.gerber_obj.units else 'IN'
         file_units = self.gerber_obj.units if self.gerber_obj.units else 'IN'
         app_units = self.app.defaults['units']
         app_units = self.app.defaults['units']
-        self.conversion_factor = 25.4 if file_units == 'IN' else (1 / 25.4) if file_units != app_units else 1
+        # self.conversion_factor = 25.4 if file_units == 'IN' else (1 / 25.4) if file_units != app_units else 1
+
+        if file_units == app_units:
+            self.conversion_factor = 1
+        else:
+            if file_units == 'IN':
+                self.conversion_factor = 25.4
+            else:
+                self.conversion_factor = 0.0393700787401575
+
 
 
         # Hide original geometry
         # Hide original geometry
         orig_grb_obj.visible = False
         orig_grb_obj.visible = False
@@ -4230,8 +4244,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
         else:
         else:
             new_grb_name = self.edited_obj_name + "_edit"
             new_grb_name = self.edited_obj_name + "_edit"
 
 
-        self.app.worker_task.emit({'fcn': self.new_edited_gerber,
-                                   'params': [new_grb_name, self.storage_dict]})
+        self.app.worker_task.emit({'fcn': self.new_edited_gerber, 'params': [new_grb_name, self.storage_dict]})
 
 
     @staticmethod
     @staticmethod
     def update_options(obj):
     def update_options(obj):

+ 16 - 1
flatcamGUI/preferences/general/GeneralAppPrefGroupUI.py

@@ -374,10 +374,25 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
         self.splash_cb.stateChanged.connect(self.on_splash_changed)
         self.splash_cb.stateChanged.connect(self.on_splash_changed)
 
 
         # Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
         # Monitor the checkbox from the Application Defaults Tab and show the TCL shell or not depending on it's value
-        self.shell_startup_cb.clicked.connect(self.app.on_toggle_shell_from_settings)
+        self.shell_startup_cb.clicked.connect(self.on_toggle_shell_from_settings)
 
 
         self.language_apply_btn.clicked.connect(lambda: fcTranslate.on_language_apply_click(app=self.app, restart=True))
         self.language_apply_btn.clicked.connect(lambda: fcTranslate.on_language_apply_click(app=self.app, restart=True))
 
 
+    def on_toggle_shell_from_settings(self, state):
+        """
+        Toggle shell: if is visible close it, if it is closed then open it
+        :return: None
+        """
+
+        self.app.defaults.report_usage("on_toggle_shell_from_settings()")
+
+        if state is True:
+            if not self.app.ui.shell_dock.isVisible():
+                self.app.ui.shell_dock.show()
+        else:
+            if self.app.ui.shell_dock.isVisible():
+                self.app.ui.shell_dock.hide()
+
     @staticmethod
     @staticmethod
     def on_splash_changed(state):
     def on_splash_changed(state):
         qsettings = QSettings("Open Source", "FlatCAM")
         qsettings = QSettings("Open Source", "FlatCAM")

+ 1 - 1
flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py

@@ -779,7 +779,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
         self.app.connect_toolbar_signals()
         self.app.connect_toolbar_signals()
 
 
         self.app.ui.grid_snap_btn.setChecked(True)
         self.app.ui.grid_snap_btn.setChecked(True)
-        self.app.on_grid_snap_triggered(state=True)
+        self.app.ui.on_grid_snap_triggered(state=True)
 
 
         self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"]))
         self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"]))
         self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"]))
         self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"]))

+ 5 - 10
flatcamTools/ToolPcbWizard.py

@@ -421,8 +421,7 @@ class PcbWizard(FlatCAMTool):
                 ret = excellon_obj.parse_file(file_obj=excellon_fileobj)
                 ret = excellon_obj.parse_file(file_obj=excellon_fileobj)
                 if ret == "fail":
                 if ret == "fail":
                     app_obj.log.debug("Excellon parsing failed.")
                     app_obj.log.debug("Excellon parsing failed.")
-                    app_obj.inform.emit('[ERROR_NOTCL] %s' %
-                                        _("This is not Excellon file."))
+                    app_obj.inform.emit('[ERROR_NOTCL] %s' % _("This is not Excellon file."))
                     return "fail"
                     return "fail"
             except IOError:
             except IOError:
                 app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Cannot parse file"), self.outname))
                 app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (_("Cannot parse file"), self.outname))
@@ -443,8 +442,7 @@ class PcbWizard(FlatCAMTool):
             for tool in excellon_obj.tools:
             for tool in excellon_obj.tools:
                 if excellon_obj.tools[tool]['solid_geometry']:
                 if excellon_obj.tools[tool]['solid_geometry']:
                     return
                     return
-            app_obj.inform.emit('[ERROR_NOTCL] %s: %s' %
-                                (_("No geometry found in file"), name))
+            app_obj.inform.emit('[ERROR_NOTCL] %s: %s' % (_("No geometry found in file"), name))
             return "fail"
             return "fail"
 
 
         if excellon_fileobj is not None and excellon_fileobj != '':
         if excellon_fileobj is not None and excellon_fileobj != '':
@@ -463,12 +461,9 @@ class PcbWizard(FlatCAMTool):
                     self.app.file_opened.emit("excellon", name)
                     self.app.file_opened.emit("excellon", name)
 
 
                     # GUI feedback
                     # GUI feedback
-                    self.app.inform.emit('[success] %s: %s' %
-                                         (_("Imported"), name))
+                    self.app.inform.emit('[success] %s: %s' % (_("Imported"), name))
                     self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
                     self.app.ui.notebook.setCurrentWidget(self.app.ui.project_tab)
             else:
             else:
-                self.app.inform.emit('[WARNING_NOTCL] %s' %
-                                     _('Excellon merging is in progress. Please wait...'))
+                self.app.inform.emit('[WARNING_NOTCL] %s' % _('Excellon merging is in progress. Please wait...'))
         else:
         else:
-            self.app.inform.emit('[ERROR_NOTCL] %s' %
-                                 _('The imported Excellon file is None.'))
+            self.app.inform.emit('[ERROR_NOTCL] %s' % _('The imported Excellon file is empty.'))

+ 1 - 1
locale/de/LC_MESSAGES/strings.po

@@ -16793,7 +16793,7 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr "Das Zusammenführen von Excellons ist im Gange. Warten Sie mal..."
 msgstr "Das Zusammenführen von Excellons ist im Gange. Warten Sie mal..."
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
 msgstr "Die importierte Excellon-Datei ist Keine."
 msgstr "Die importierte Excellon-Datei ist Keine."
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131

+ 2 - 2
locale/en/LC_MESSAGES/strings.po

@@ -16456,8 +16456,8 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr "Excellon merging is in progress. Please wait..."
 msgstr "Excellon merging is in progress. Please wait..."
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
-msgstr "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
+msgstr "The imported Excellon file is empty."
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131
 msgid "Object Properties are displayed."
 msgid "Object Properties are displayed."

+ 1 - 1
locale/es/LC_MESSAGES/strings.po

@@ -16717,7 +16717,7 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr "La fusión de Excellon está en progreso. Por favor espera..."
 msgstr "La fusión de Excellon está en progreso. Por favor espera..."
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
 msgstr "El archivo Excellon importado es Ninguno."
 msgstr "El archivo Excellon importado es Ninguno."
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131

+ 1 - 1
locale/fr/LC_MESSAGES/strings.po

@@ -16716,7 +16716,7 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr "Excellon fusion est en cours. S'il vous plaît, attendez..."
 msgstr "Excellon fusion est en cours. S'il vous plaît, attendez..."
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
 msgstr "Le fichier Excellon importé est Aucun."
 msgstr "Le fichier Excellon importé est Aucun."
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131

+ 2 - 2
locale/hu/LC_MESSAGES/strings.po

@@ -16458,8 +16458,8 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr "Excellon merging is in progress. Please wait..."
 msgstr "Excellon merging is in progress. Please wait..."
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
-msgstr "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
+msgstr "The imported Excellon file is empty."
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131
 msgid "Object Properties are displayed."
 msgid "Object Properties are displayed."

+ 1 - 1
locale/it/LC_MESSAGES/strings.po

@@ -13789,7 +13789,7 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr ""
 msgstr ""
 
 
 #: flatcamTools/ToolPcbWizard.py:478
 #: flatcamTools/ToolPcbWizard.py:478
-msgid "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
 msgstr ""
 msgstr ""
 
 
 #: flatcamTools/ToolProperties.py:119
 #: flatcamTools/ToolProperties.py:119

+ 1 - 1
locale/pt_BR/LC_MESSAGES/strings.po

@@ -16521,7 +16521,7 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr "A união Excellon está em andamento. Por favor, espere..."
 msgstr "A união Excellon está em andamento. Por favor, espere..."
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
 msgstr "O arquivo Excellon importado está Vazio."
 msgstr "O arquivo Excellon importado está Vazio."
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131

+ 1 - 1
locale/ro/LC_MESSAGES/strings.po

@@ -16728,7 +16728,7 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr "Fuziunea fisiere Excellon este in curs. Vă rugăm aşteptați ..."
 msgstr "Fuziunea fisiere Excellon este in curs. Vă rugăm aşteptați ..."
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
 msgstr "Fişierul Excellon importat este gol."
 msgstr "Fişierul Excellon importat este gol."
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131

+ 1 - 1
locale/ru/LC_MESSAGES/strings.po

@@ -16579,7 +16579,7 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr "Слияние Excellon продолжается. Пожалуйста, подождите..."
 msgstr "Слияние Excellon продолжается. Пожалуйста, подождите..."
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
 msgstr "Импортированный файл Excellon есть None."
 msgstr "Импортированный файл Excellon есть None."
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131

+ 1 - 1
locale_template/strings.pot

@@ -14116,7 +14116,7 @@ msgid "Excellon merging is in progress. Please wait..."
 msgstr ""
 msgstr ""
 
 
 #: flatcamTools/ToolPcbWizard.py:474
 #: flatcamTools/ToolPcbWizard.py:474
-msgid "The imported Excellon file is None."
+msgid "The imported Excellon file is empty."
 msgstr ""
 msgstr ""
 
 
 #: flatcamTools/ToolProperties.py:131
 #: flatcamTools/ToolProperties.py:131