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

- added a new global setting only accessible through the Tcl Shell,
named: global_mouse_pan_button
It can be set through set_sys TclCommand or the value getted through
get_sys TclCommand.
Values are 1 for left mouse button, 2 for middle mouse button and
3 for right mouse button.
It does hurt my hand (wrist) keeping the middle mouse button pressed
when panning and I very much preffer panning with RMB.
The default setting is pan_button = middle mouse button.

Marius Stanciu 7 лет назад
Родитель
Сommit
b63c3219a7
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()