Merged in marius_stanciu/flatcam_mpl/add_global_setting_global_mouse_pan_button (pull request #105)
New global_variable for mouse_pan_button
This commit is contained in:
@@ -286,6 +286,7 @@ class App(QtCore.QObject):
|
|||||||
self.defaults = LoudDict()
|
self.defaults = LoudDict()
|
||||||
self.defaults.set_change_callback(self.on_defaults_dict_change) # When the dictionary changes.
|
self.defaults.set_change_callback(self.on_defaults_dict_change) # When the dictionary changes.
|
||||||
self.defaults.update({
|
self.defaults.update({
|
||||||
|
"global_mouse_pan_button": 2,
|
||||||
"serial": 0,
|
"serial": 0,
|
||||||
"stats": {},
|
"stats": {},
|
||||||
"units": "IN",
|
"units": "IN",
|
||||||
@@ -475,6 +476,8 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
self.collection = ObjectCollection.ObjectCollection()
|
self.collection = ObjectCollection.ObjectCollection()
|
||||||
self.ui.project_tab_layout.addWidget(self.collection.view)
|
self.ui.project_tab_layout.addWidget(self.collection.view)
|
||||||
|
|
||||||
|
self.mouse_pan_button = int(self.defaults['global_mouse_pan_button'])
|
||||||
#### End of Data ####
|
#### End of Data ####
|
||||||
|
|
||||||
#### Worker ####
|
#### Worker ####
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ class PlotCanvas(QtCore.QObject):
|
|||||||
def on_mouse_press(self, event):
|
def on_mouse_press(self, event):
|
||||||
|
|
||||||
# Check for middle mouse button press
|
# 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)
|
# Prepare axes for pan (using 'matplotlib' pan function)
|
||||||
self.pan_axes = []
|
self.pan_axes = []
|
||||||
@@ -461,7 +461,7 @@ class PlotCanvas(QtCore.QObject):
|
|||||||
def on_mouse_release(self, event):
|
def on_mouse_release(self, event):
|
||||||
|
|
||||||
# Check for middle mouse button release to complete pan procedure
|
# 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:
|
for a in self.pan_axes:
|
||||||
a.end_pan()
|
a.end_pan()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user