From 98ea1d800c77a1f527d1ba1a3ee44120c5873139 Mon Sep 17 00:00:00 2001 From: Nikita Zlobin Date: Sat, 2 Jun 2018 01:13:25 +0500 Subject: [PATCH] More consistent names for some variables Mouse buttons in nix world have numbers 1..3 for 3 primary buttons, but qt has special meaning for numbered names, using symbolics for first standard buttons. --- source/patchcanvas.py | 8 ++++---- source/widgets/draggablegraphicsview.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/patchcanvas.py b/source/patchcanvas.py index ea553c8d0..ab7587294 100644 --- a/source/patchcanvas.py +++ b/source/patchcanvas.py @@ -1214,7 +1214,7 @@ class PatchScene(QGraphicsScene): self.m_ctrl_down = False self.m_mouse_down_init = False self.m_mouse_rubberband = False - self.m_mouse2_down = False + self.m_mid_button_down = False self.pointer_border = QRectF(0.0, 0.0, 1.0, 1.0) self.addRubberBand() @@ -1368,7 +1368,7 @@ class PatchScene(QGraphicsScene): self.m_mouse_down_init = bool(event.button() == Qt.LeftButton) self.m_mouse_rubberband = False if event.button() == Qt.MidButton and self.m_ctrl_down: - self.m_mouse2_down = True + self.m_mid_button_down = True pos = event.scenePos() self.pointer_border.moveTo(floor(pos.x()), floor(pos.y())) @@ -1404,7 +1404,7 @@ class PatchScene(QGraphicsScene): self.m_rubberband.setRect(x, y, abs(pos.x() - self.m_rubberband_orig_point.x()), abs(pos.y() - self.m_rubberband_orig_point.y())) return event.accept() - if self.m_mouse2_down and self.m_ctrl_down: + if self.m_mid_button_down and self.m_ctrl_down: trail = QPolygonF([event.scenePos(), event.lastScenePos(), event.scenePos()]) items = self.items(trail) for item in items: @@ -1415,7 +1415,7 @@ class PatchScene(QGraphicsScene): def mouseReleaseEvent(self, event): if event.button() == Qt.MidButton: - self.m_mouse2_down = False + self.m_mid_button_down = False return event.accept() if self.m_rubberband_selection: diff --git a/source/widgets/draggablegraphicsview.py b/source/widgets/draggablegraphicsview.py index 255377a1c..b75a210dc 100644 --- a/source/widgets/draggablegraphicsview.py +++ b/source/widgets/draggablegraphicsview.py @@ -40,7 +40,7 @@ class DraggableGraphicsView(QGraphicsView): QGraphicsView.__init__(self, parent) self.fPanning = False - self.m_ctrl_down = False + self.fCtrlDown = False try: self.fMiddleButton = Qt.MiddleButton @@ -48,7 +48,7 @@ class DraggableGraphicsView(QGraphicsView): self.fMiddleButton = Qt.MidButton def mousePressEvent(self, event): - if event.button() == self.fMiddleButton and not self.m_ctrl_down: + if event.button() == self.fMiddleButton and not self.fCtrlDown: self.fPanning = True self.setDragMode(QGraphicsView.ScrollHandDrag) event = QMouseEvent(event.type(), event.pos(), Qt.LeftButton, Qt.LeftButton, event.modifiers())