Преглед изворни кода

Merged in marius_stanciu/flatcam_mpl/add_global_setting_global_mouse_pan_button (pull request #105)

New global_variable for mouse_pan_button
Marius Stanciu пре 7 година
родитељ
комит
9211da39c7
2 измењених фајлова са 5 додато и 2 уклоњено
  1. 3 0
      FlatCAMApp.py
  2. 2 2
      PlotCanvas.py

+ 3 - 0
FlatCAMApp.py

@@ -286,6 +286,7 @@ class App(QtCore.QObject):
         self.defaults = LoudDict()
         self.defaults.set_change_callback(self.on_defaults_dict_change)  # When the dictionary changes.
         self.defaults.update({
+            "global_mouse_pan_button": 2,
             "serial": 0,
             "stats": {},
             "units": "IN",
@@ -475,6 +476,8 @@ class App(QtCore.QObject):
 
         self.collection = ObjectCollection.ObjectCollection()
         self.ui.project_tab_layout.addWidget(self.collection.view)
+
+        self.mouse_pan_button = int(self.defaults['global_mouse_pan_button'])
         #### End of Data ####
 
         #### Worker ####

+ 2 - 2
PlotCanvas.py

@@ -445,7 +445,7 @@ class PlotCanvas(QtCore.QObject):
     def on_mouse_press(self, event):
 
         # Check for middle mouse button press
-        if event.button == 2:
+        if event.button == self.app.mouse_pan_button:
 
             # Prepare axes for pan (using 'matplotlib' pan function)
             self.pan_axes = []
@@ -461,7 +461,7 @@ class PlotCanvas(QtCore.QObject):
     def on_mouse_release(self, event):
 
         # Check for middle mouse button release to complete pan procedure
-        if event.button == 2:
+        if event.button == self.app.mouse_pan_button:
             for a in self.pan_axes:
                 a.end_pan()