- fix for contextual menus on canvas when using PyQt versions > 5.12.1
- decision on which mouse button to use for panning is done now once when setting the plotcanvas
This commit is contained in:
@@ -69,5 +69,5 @@ if __name__ == '__main__':
|
|||||||
app.setStyle(style)
|
app.setStyle(style)
|
||||||
|
|
||||||
fc = App()
|
fc = App()
|
||||||
|
# sys.exit(app.exec_())
|
||||||
sys.exit(app.exec_())
|
app.exec_()
|
||||||
@@ -5328,12 +5328,14 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
# quit app by signalling for self.kill_app() method
|
# quit app by signalling for self.kill_app() method
|
||||||
# self.close_app_signal.emit()
|
# self.close_app_signal.emit()
|
||||||
|
|
||||||
QtWidgets.qApp.quit()
|
QtWidgets.qApp.quit()
|
||||||
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
|
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
|
||||||
# we use the following command
|
# we use the following command
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def kill_app(self):
|
def kill_app(self):
|
||||||
|
# QtCore.QCoreApplication.quit()
|
||||||
QtWidgets.qApp.quit()
|
QtWidgets.qApp.quit()
|
||||||
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
|
# When the main event loop is not started yet in which case the qApp.quit() will do nothing
|
||||||
# we use the following command
|
# we use the following command
|
||||||
@@ -8667,8 +8669,8 @@ class App(QtCore.QObject):
|
|||||||
def populate_cmenu_grids(self):
|
def populate_cmenu_grids(self):
|
||||||
units = self.defaults['units'].lower()
|
units = self.defaults['units'].lower()
|
||||||
|
|
||||||
for act in self.ui.cmenu_gridmenu.actions():
|
# for act in self.ui.cmenu_gridmenu.actions():
|
||||||
act.triggered.disconnect()
|
# act.triggered.disconnect()
|
||||||
self.ui.cmenu_gridmenu.clear()
|
self.ui.cmenu_gridmenu.clear()
|
||||||
|
|
||||||
sorted_list = sorted(self.defaults["global_grid_context_menu"][str(units)])
|
sorted_list = sorted(self.defaults["global_grid_context_menu"][str(units)])
|
||||||
@@ -8807,13 +8809,13 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
if self.is_legacy is False:
|
if self.is_legacy is False:
|
||||||
event_pos = event.pos
|
event_pos = event.pos
|
||||||
pan_button = 2 if self.defaults["global_pan_button"] == '2'else 3
|
# pan_button = 2 if self.defaults["global_pan_button"] == '2'else 3
|
||||||
# Set the mouse button for panning
|
# # Set the mouse button for panning
|
||||||
self.plotcanvas.view.camera.pan_button_setting = pan_button
|
# self.plotcanvas.view.camera.pan_button_setting = pan_button
|
||||||
else:
|
else:
|
||||||
event_pos = (event.xdata, event.ydata)
|
event_pos = (event.xdata, event.ydata)
|
||||||
# Matplotlib has the middle and right buttons mapped in reverse compared with VisPy
|
# Matplotlib has the middle and right buttons mapped in reverse compared with VisPy
|
||||||
pan_button = 3 if self.defaults["global_pan_button"] == '2' else 2
|
# pan_button = 3 if self.defaults["global_pan_button"] == '2' else 2
|
||||||
|
|
||||||
# So it can receive key presses
|
# So it can receive key presses
|
||||||
self.plotcanvas.native.setFocus()
|
self.plotcanvas.native.setFocus()
|
||||||
@@ -8873,9 +8875,14 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
self.ui.popMenu.mouse_is_panning = False
|
self.ui.popMenu.mouse_is_panning = False
|
||||||
|
|
||||||
if not origin_click:
|
if origin_click is None:
|
||||||
# if the RMB is clicked and mouse is moving over plot then 'panning_action' is True
|
# if the RMB is clicked and mouse is moving over plot then 'panning_action' is True
|
||||||
if event.button == pan_button and self.event_is_dragging == 1:
|
if event.button == pan_button and self.event_is_dragging == 1:
|
||||||
|
|
||||||
|
# if a popup menu is active don't change mouse_is_panning variable because is not True
|
||||||
|
if self.ui.popMenu.popup_active:
|
||||||
|
self.ui.popMenu.popup_active = False
|
||||||
|
return
|
||||||
self.ui.popMenu.mouse_is_panning = True
|
self.ui.popMenu.mouse_is_panning = True
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -8977,6 +8984,8 @@ class App(QtCore.QObject):
|
|||||||
# if the released mouse button was RMB then test if it was a panning motion or not, if not it was a context
|
# if the released mouse button was RMB then test if it was a panning motion or not, if not it was a context
|
||||||
# canvas menu
|
# canvas menu
|
||||||
if event.button == right_button and self.ui.popMenu.mouse_is_panning is False: # right click
|
if event.button == right_button and self.ui.popMenu.mouse_is_panning is False: # right click
|
||||||
|
self.ui.popMenu.mouse_is_panning = False
|
||||||
|
|
||||||
self.cursor = QtGui.QCursor()
|
self.cursor = QtGui.QCursor()
|
||||||
self.populate_cmenu_grids()
|
self.populate_cmenu_grids()
|
||||||
self.ui.popMenu.popup(self.cursor.pos())
|
self.ui.popMenu.popup(self.cursor.pos())
|
||||||
@@ -12465,6 +12474,11 @@ class App(QtCore.QObject):
|
|||||||
# So it can receive key presses
|
# So it can receive key presses
|
||||||
self.plotcanvas.native.setFocus()
|
self.plotcanvas.native.setFocus()
|
||||||
|
|
||||||
|
if self.is_legacy is False:
|
||||||
|
pan_button = 2 if self.defaults["global_pan_button"] == '2'else 3
|
||||||
|
# Set the mouse button for panning
|
||||||
|
self.plotcanvas.view.camera.pan_button_setting = pan_button
|
||||||
|
|
||||||
self.mm = self.plotcanvas.graph_event_connect('mouse_move', self.on_mouse_move_over_plot)
|
self.mm = self.plotcanvas.graph_event_connect('mouse_move', self.on_mouse_move_over_plot)
|
||||||
self.mp = self.plotcanvas.graph_event_connect('mouse_press', self.on_mouse_click_over_plot)
|
self.mp = self.plotcanvas.graph_event_connect('mouse_press', self.on_mouse_click_over_plot)
|
||||||
self.mr = self.plotcanvas.graph_event_connect('mouse_release', self.on_mouse_click_release_over_plot)
|
self.mr = self.plotcanvas.graph_event_connect('mouse_release', self.on_mouse_click_release_over_plot)
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
|
|
||||||
- made sure that the HDPI scaling attribute is set before the QApplication is started
|
- made sure that the HDPI scaling attribute is set before the QApplication is started
|
||||||
- made sure that when saving a project, the app will try to update the active object from UI form only if there is an active object
|
- made sure that when saving a project, the app will try to update the active object from UI form only if there is an active object
|
||||||
|
- fix for contextual menus on canvas when using PyQt versions > 5.12.1
|
||||||
|
- decision on which mouse button to use for panning is done now once when setting the plotcanvas
|
||||||
|
|
||||||
4.04.2020
|
4.04.2020
|
||||||
|
|
||||||
|
|||||||
@@ -1419,10 +1419,12 @@ class FCMenu(QtWidgets.QMenu):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.mouse_is_panning = False
|
self.mouse_is_panning = False
|
||||||
|
self.popup_active = False
|
||||||
|
|
||||||
def popup(self, pos, action=None):
|
def popup(self, pos, action=None):
|
||||||
self.mouse_is_panning = False
|
|
||||||
super().popup(pos)
|
super().popup(pos)
|
||||||
|
self.mouse_is_panning = False
|
||||||
|
self.popup_active = True
|
||||||
|
|
||||||
|
|
||||||
class FCTab(QtWidgets.QTabWidget):
|
class FCTab(QtWidgets.QTabWidget):
|
||||||
|
|||||||
Reference in New Issue
Block a user