瀏覽代碼

- added mouse events disconnect in the quit_application() method

Marius Stanciu 5 年之前
父節點
當前提交
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
 - 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.
+- added mouse events disconnect in the quit_application() method
 
 4.06.2020
 

+ 16 - 0
app_Main.py

@@ -3219,6 +3219,22 @@ class App(QtCore.QObject):
                 pass
             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)
         log.debug("App.quit_application() --> App Defaults saved.")