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

- added mouse events disconnect in the quit_application() method

Marius Stanciu 5 лет назад
Родитель
Сommit
951744d6fa
2 измененных файлов с 17 добавлено и 0 удалено
  1. 1 0
      CHANGELOG.md
  2. 16 0
      app_Main.py

+ 1 - 0
CHANGELOG.md

@@ -15,6 +15,7 @@ CHANGELOG for FlatCAM beta
 - Tool Calculators: allowed comma to be used as decimal separator
 - Tool Calculators: allowed comma to be used as decimal separator
 - changed how the import of svg.path module is done in the ParseSVG.py file
 - changed how the import of svg.path module is done in the ParseSVG.py file
 - Tool Isolation - new feature that allow to isolate interiors of polygons (holes in polygons). It is possible that the isolation to be reported as successful (internal limitations) but some interiors to not be isolated. This way the user get to fix the isolation by doing an extra isolation.
 - Tool Isolation - new feature that allow to isolate interiors of polygons (holes in polygons). It is possible that the isolation to be reported as successful (internal limitations) but some interiors to not be isolated. This way the user get to fix the isolation by doing an extra isolation.
+- added mouse events disconnect in the quit_application() method
 
 
 4.06.2020
 4.06.2020
 
 

+ 16 - 0
app_Main.py

@@ -3219,6 +3219,22 @@ class App(QtCore.QObject):
                 pass
                 pass
             log.debug("App.quit_application() --> Gerber Editor deactivated.")
             log.debug("App.quit_application() --> Gerber Editor deactivated.")
 
 
+        # disconnect the mouse events
+        if self.is_legacy:
+            self.plotcanvas.graph_event_disconnect(self.mm)
+            self.plotcanvas.graph_event_disconnect(self.mp)
+            self.plotcanvas.graph_event_disconnect(self.mr)
+            self.plotcanvas.graph_event_disconnect(self.mdc)
+            self.plotcanvas.graph_event_disconnect(self.kp)
+
+        else:
+            self.mm = self.plotcanvas.graph_event_disconnect('mouse_move', self.on_mouse_move_over_plot)
+            self.mp = self.plotcanvas.graph_event_disconnect('mouse_press', self.on_mouse_click_over_plot)
+            self.mr = self.plotcanvas.graph_event_disconnect('mouse_release', self.on_mouse_click_release_over_plot)
+            self.mdc = self.plotcanvas.graph_event_disconnect('mouse_double_click',
+                                                              self.on_mouse_double_click_over_plot)
+            self.kp = self.plotcanvas.graph_event_disconnect('key_press', self.ui.keyPressEvent)
+
         self.preferencesUiManager.save_defaults(silent=True)
         self.preferencesUiManager.save_defaults(silent=True)
         log.debug("App.quit_application() --> App Defaults saved.")
         log.debug("App.quit_application() --> App Defaults saved.")