فهرست منبع

- more bugs that were introduced by recent changes done to solve other bugs and so on: fixed issues with the Editors and Delete shortcut

Marius Stanciu 5 سال پیش
والد
کامیت
fdfa6a22be
7فایلهای تغییر یافته به همراه48 افزوده شده و 79 حذف شده
  1. 1 0
      CHANGELOG.md
  2. 37 48
      appEditors/AppExcEditor.py
  3. 0 8
      appEditors/AppGeoEditor.py
  4. 0 12
      appEditors/AppGerberEditor.py
  5. 0 5
      appEditors/appGCodeEditor.py
  6. 1 1
      appTools/ToolPunchGerber.py
  7. 9 5
      app_Main.py

+ 1 - 0
CHANGELOG.md

@@ -17,6 +17,7 @@ CHANGELOG for FlatCAM beta
 - working on solving the lost triggered signals for the Editor Toolbars buttons after changing the layout
 - fixed issue #454; trigger signals for Editor Toolbars lost after changing the layout
 - updated the translation strings
+- more bugs that were introduced by recent changes done to solve other bugs and so on: fixed issues with the Editors and Delete shortcut
 
 29.10.2020
 

+ 37 - 48
appEditors/AppExcEditor.py

@@ -1529,43 +1529,6 @@ class AppExcEditor(QtCore.QObject):
         self.decimals = self.app.decimals
 
         self.e_ui = AppExcEditorUI(app=self.app)
-        
-        # #############################################################################################################
-        # ######################### Excellon Editor Signals ###########################################################
-        # #############################################################################################################
-
-        # connect the toolbar signals
-        self.connect_exc_toolbar_signals()
-
-        self.e_ui.convert_slots_btn.clicked.connect(self.on_slots_conversion)
-        self.app.ui.delete_drill_btn.triggered.connect(self.on_delete_btn)
-        self.e_ui.name_entry.returnPressed.connect(self.on_name_activate)
-        self.e_ui.addtool_btn.clicked.connect(self.on_tool_add)
-        self.e_ui.addtool_entry.editingFinished.connect(self.on_tool_add)
-        self.e_ui.deltool_btn.clicked.connect(self.on_tool_delete)
-        # self.e_ui.tools_table_exc.selectionModel().currentChanged.connect(self.on_row_selected)
-        self.e_ui.tools_table_exc.cellPressed.connect(self.on_row_selected)
-
-        self.e_ui.array_type_combo.currentIndexChanged.connect(self.on_array_type_combo)
-        self.e_ui.slot_array_type_combo.currentIndexChanged.connect(self.on_slot_array_type_combo)
-
-        self.e_ui.drill_axis_radio.activated_custom.connect(self.on_linear_angle_radio)
-        self.e_ui.slot_axis_radio.activated_custom.connect(self.on_slot_angle_radio)
-
-        self.e_ui.slot_array_axis_radio.activated_custom.connect(self.on_slot_array_linear_angle_radio)
-
-        self.app.ui.exc_add_array_drill_menuitem.triggered.connect(self.exc_add_drill_array)
-        self.app.ui.exc_add_drill_menuitem.triggered.connect(self.exc_add_drill)
-
-        self.app.ui.exc_add_array_slot_menuitem.triggered.connect(self.exc_add_slot_array)
-        self.app.ui.exc_add_slot_menuitem.triggered.connect(self.exc_add_slot)
-
-        self.app.ui.exc_resize_drill_menuitem.triggered.connect(self.exc_resize_drills)
-        self.app.ui.exc_copy_drill_menuitem.triggered.connect(self.exc_copy_drills)
-        self.app.ui.exc_delete_drill_menuitem.triggered.connect(self.on_delete_btn)
-
-        self.app.ui.exc_move_drill_menuitem.triggered.connect(self.exc_move_drills)
-        self.e_ui.exit_editor_button.clicked.connect(lambda: self.app.editor2object())
 
         self.exc_obj = None
 
@@ -1679,9 +1642,6 @@ class AppExcEditor(QtCore.QObject):
 
         self.tool_row = 0
 
-        # store the status of the editor so the Delete at object level will not work until the edit is finished
-        self.editor_active = False
-
         # def entry2option(option, entry):
         #     self.options[option] = float(entry.text())
 
@@ -1690,8 +1650,43 @@ class AppExcEditor(QtCore.QObject):
         self.mm = None
         self.mr = None
 
-        # store the status of the editor so the Delete at object level will not work until the edit is finished
-        self.editor_active = False
+        # #############################################################################################################
+        # ######################### Excellon Editor Signals ###########################################################
+        # #############################################################################################################
+
+        # connect the toolbar signals
+        self.connect_exc_toolbar_signals()
+
+        self.e_ui.convert_slots_btn.clicked.connect(self.on_slots_conversion)
+        self.app.ui.delete_drill_btn.triggered.connect(self.on_delete_btn)
+        self.e_ui.name_entry.returnPressed.connect(self.on_name_activate)
+        self.e_ui.addtool_btn.clicked.connect(self.on_tool_add)
+        self.e_ui.addtool_entry.editingFinished.connect(self.on_tool_add)
+        self.e_ui.deltool_btn.clicked.connect(self.on_tool_delete)
+        # self.e_ui.tools_table_exc.selectionModel().currentChanged.connect(self.on_row_selected)
+        self.e_ui.tools_table_exc.cellPressed.connect(self.on_row_selected)
+
+        self.e_ui.array_type_combo.currentIndexChanged.connect(self.on_array_type_combo)
+        self.e_ui.slot_array_type_combo.currentIndexChanged.connect(self.on_slot_array_type_combo)
+
+        self.e_ui.drill_axis_radio.activated_custom.connect(self.on_linear_angle_radio)
+        self.e_ui.slot_axis_radio.activated_custom.connect(self.on_slot_angle_radio)
+
+        self.e_ui.slot_array_axis_radio.activated_custom.connect(self.on_slot_array_linear_angle_radio)
+
+        self.app.ui.exc_add_array_drill_menuitem.triggered.connect(self.exc_add_drill_array)
+        self.app.ui.exc_add_drill_menuitem.triggered.connect(self.exc_add_drill)
+
+        self.app.ui.exc_add_array_slot_menuitem.triggered.connect(self.exc_add_slot_array)
+        self.app.ui.exc_add_slot_menuitem.triggered.connect(self.exc_add_slot)
+
+        self.app.ui.exc_resize_drill_menuitem.triggered.connect(self.exc_resize_drills)
+        self.app.ui.exc_copy_drill_menuitem.triggered.connect(self.exc_copy_drills)
+        self.app.ui.exc_delete_drill_menuitem.triggered.connect(self.on_delete_btn)
+
+        self.app.ui.exc_move_drill_menuitem.triggered.connect(self.exc_move_drills)
+        self.e_ui.exit_editor_button.clicked.connect(lambda: self.app.editor2object())
+
         log.debug("Initialization of the Excellon Editor is finished ...")
 
     def make_callback(self, thetool):
@@ -2295,9 +2290,6 @@ class AppExcEditor(QtCore.QObject):
         self.app.ui.g_editor_cmenu.menuAction().setVisible(False)
         self.app.ui.grb_editor_cmenu.menuAction().setVisible(False)
 
-        # Tell the App that the editor is active
-        self.editor_active = True
-
         # show the UI
         self.e_ui.drills_frame.show()
 
@@ -2330,9 +2322,6 @@ class AppExcEditor(QtCore.QObject):
         self.tool_shape.enabled = False
         # self.app.app_cursor.enabled = False
 
-        # Tell the app that the editor is no longer active
-        self.editor_active = False
-
         self.app.ui.exc_editor_menu.setDisabled(True)
         self.app.ui.exc_editor_menu.menuAction().setVisible(False)
 

+ 0 - 8
appEditors/AppGeoEditor.py

@@ -3455,8 +3455,6 @@ class AppGeoEditor(QtCore.QObject):
         self.mm = None
         self.mr = None
 
-        # store the status of the editor so the Delete at object level will not work until the edit is finished
-        self.editor_active = False
         log.debug("Initialization of the Geometry Editor is finished ...")
 
     def make_callback(self, thetool):
@@ -3661,9 +3659,6 @@ class AppGeoEditor(QtCore.QObject):
         # for w in sel_tab_widget_list:
         #     w.setEnabled(False)
 
-        # Tell the App that the editor is active
-        self.editor_active = True
-
         self.item_selected.connect(self.on_geo_elem_selected)
 
         # ## appGUI Events
@@ -3713,9 +3708,6 @@ class AppGeoEditor(QtCore.QObject):
         self.app.ui.g_editor_cmenu.setEnabled(False)
         self.app.ui.e_editor_cmenu.setEnabled(False)
 
-        # Tell the app that the editor is no longer active
-        self.editor_active = False
-
         self.app.ui.popmenu_disable.setVisible(True)
         self.app.ui.cmenu_newmenu.menuAction().setVisible(True)
         self.app.ui.popmenu_properties.setVisible(True)

+ 0 - 12
appEditors/AppGerberEditor.py

@@ -3034,9 +3034,6 @@ class AppGerberEditor(QtCore.QObject):
         # a QThread for the edit process
         self.thread = QtCore.QThread()
 
-        # store the status of the editor so the Delete at object level will not work until the edit is finished
-        self.editor_active = False
-
         # def entry2option(option, entry):
         #     self.options[option] = float(entry.text())
 
@@ -3090,9 +3087,6 @@ class AppGerberEditor(QtCore.QObject):
 
         self.mp_finished.connect(self.on_multiprocessing_finished)
 
-        # store the status of the editor so the Delete at object level will not work until the edit is finished
-        self.editor_active = False
-
         self.conversion_factor = 1
 
         self.apertures_row = 0
@@ -3730,9 +3724,6 @@ class AppGerberEditor(QtCore.QObject):
         self.app.ui.popmenu_properties.setVisible(False)
         self.app.ui.grb_editor_cmenu.menuAction().setVisible(True)
 
-        # Tell the App that the editor is active
-        self.editor_active = True
-
     def deactivate_grb_editor(self):
         try:
             QtGui.QGuiApplication.restoreOverrideCursor()
@@ -3763,9 +3754,6 @@ class AppGerberEditor(QtCore.QObject):
         self.tool_shape.enabled = False
         # self.app.app_cursor.enabled = False
 
-        # Tell the app that the editor is no longer active
-        self.editor_active = False
-
         self.app.ui.grb_editor_menu.setDisabled(True)
         self.app.ui.grb_editor_menu.menuAction().setVisible(False)
 

+ 0 - 5
appEditors/appGCodeEditor.py

@@ -43,9 +43,6 @@ class AppGCodeEditor(QtCore.QObject):
         self.gcode_obj = None
         self.code_edited = ''
 
-        # store the status of the editor so the Delete at object level will not work until the edit is finished
-        self.editor_active = False
-
         # #################################################################################
         # ################### SIGNALS #####################################################
         # #################################################################################
@@ -611,11 +608,9 @@ class AppGCodeEditor(QtCore.QObject):
                 file.close()
 
     def activate(self):
-        self.editor_active = True
         self.app.call_source = 'gcode_editor'
 
     def deactivate(self):
-        self.editor_active = False
         self.app.call_source = 'app'
 
     def on_name_activate(self):

+ 1 - 1
appTools/ToolPunchGerber.py

@@ -433,7 +433,7 @@ class ToolPunchGerber(AppTool):
                         else:
                             grb_solid_geometry.append(el_geo['solid'])
 
-        target_geometry = MultiPolygon(target_geometry)
+        target_geometry = MultiPolygon(target_geometry).buffer(0)
 
         # create the punched Gerber solid_geometry
         punched_target_geometry = target_geometry.difference(exc_solid_geometry)

+ 9 - 5
app_Main.py

@@ -281,6 +281,11 @@ class App(QtCore.QObject):
 
         self.qapp = qapp
 
+        # App Editors will be instantiated further below
+        self.exc_editor = None
+        self.grb_editor = None
+        self.geo_editor = None
+
         # ############################################################################################################
         # ################# Setup the listening thread for another instance launching with args ######################
         # ############################################################################################################
@@ -3554,7 +3559,7 @@ class App(QtCore.QObject):
         """
 
         # close editors before quiting the app, if they are open
-        if self.geo_editor.editor_active is True:
+        if self.call_source == 'geo_editor':
             self.geo_editor.deactivate()
             try:
                 self.geo_editor.disconnect()
@@ -3562,7 +3567,7 @@ class App(QtCore.QObject):
                 pass
             self.log.debug("App.quit_application() --> Geo Editor deactivated.")
 
-        if self.exc_editor.editor_active is True:
+        if self.call_source == 'exc_editor':
             self.exc_editor.deactivate()
             try:
                 self.grb_editor.disconnect()
@@ -3570,7 +3575,7 @@ class App(QtCore.QObject):
                 pass
             self.log.debug("App.quit_application() --> Excellon Editor deactivated.")
 
-        if self.grb_editor.editor_active is True:
+        if self.call_source == 'grb_editor':
             self.grb_editor.deactivate_grb_editor()
             try:
                 self.exc_editor.disconnect()
@@ -4705,8 +4710,7 @@ class App(QtCore.QObject):
 
         # Make sure that the deletion will happen only after the Editor is no longer active otherwise we might delete
         # a geometry object before we update it.
-        if self.geo_editor.editor_active is False and self.exc_editor.editor_active is False \
-                and self.grb_editor.editor_active is False and self.gcode_editor.editor_active is False:
+        if self.call_source == 'app':
             if self.defaults["global_delete_confirmation"] is True and force_deletion is False:
                 msgbox = QtWidgets.QMessageBox()
                 msgbox.setWindowTitle(_("Delete objects"))