Allow right-clicking for scribbling
parent
b7eba38f0f
commit
de5af7cb44
|
@ -64,6 +64,7 @@ class AnimBox(QGraphicsObject):
|
||||||
|
|
||||||
self.line_order = [self.up, self.right, self.down, self.left]
|
self.line_order = [self.up, self.right, self.down, self.left]
|
||||||
|
|
||||||
|
self.accepted_buttons = Qt.LeftButton
|
||||||
self.set_freeze(False)
|
self.set_freeze(False)
|
||||||
|
|
||||||
self.length = 0
|
self.length = 0
|
||||||
|
@ -85,7 +86,7 @@ class AnimBox(QGraphicsObject):
|
||||||
self.setAcceptedMouseButtons(Qt.NoButton)
|
self.setAcceptedMouseButtons(Qt.NoButton)
|
||||||
self.setAcceptHoverEvents(False)
|
self.setAcceptHoverEvents(False)
|
||||||
else:
|
else:
|
||||||
self.setAcceptedMouseButtons(Qt.LeftButton)
|
self.setAcceptedMouseButtons(self.accepted_buttons)
|
||||||
self.setAcceptHoverEvents(True)
|
self.setAcceptHoverEvents(True)
|
||||||
|
|
||||||
def toggle_anim(self, toggling):
|
def toggle_anim(self, toggling):
|
||||||
|
@ -216,6 +217,7 @@ class RingButton(AnimBox):
|
||||||
super().__init__(x, y, width, height, parent=parent)
|
super().__init__(x, y, width, height, parent=parent)
|
||||||
self.text = text
|
self.text = text
|
||||||
self.transparent = False
|
self.transparent = False
|
||||||
|
self.accepted_buttons = self.accepted_buttons | Qt.RightButton
|
||||||
|
|
||||||
def set_transparent(self, state):
|
def set_transparent(self, state):
|
||||||
"""Make the button transparent
|
"""Make the button transparent
|
||||||
|
@ -252,7 +254,7 @@ class RingButton(AnimBox):
|
||||||
"""
|
"""
|
||||||
event.accept()
|
event.accept()
|
||||||
self.toggle_anim(False)
|
self.toggle_anim(False)
|
||||||
self.buttonClicked.emit(self.text)
|
self.buttonClicked.emit(self.text, event.button())
|
||||||
|
|
||||||
|
|
||||||
class MenuButton(AnimBox):
|
class MenuButton(AnimBox):
|
||||||
|
|
|
@ -465,7 +465,7 @@ class NumberRing(BaseSudokuItem):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def send_button_press(self, val):
|
def send_button_press(self, val, btn):
|
||||||
"""Emits the keyPressed signal if any of the buttons is pressed, and attempts to close the ring
|
"""Emits the keyPressed signal if any of the buttons is pressed, and attempts to close the ring
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
@ -473,8 +473,10 @@ class NumberRing(BaseSudokuItem):
|
||||||
val : str
|
val : str
|
||||||
The digit to be emitted
|
The digit to be emitted
|
||||||
"""
|
"""
|
||||||
self.keyPressed.emit(val, self.scribbling)
|
scribble = btn == 2
|
||||||
self.close_menu()
|
self.keyPressed.emit(val, scribble)
|
||||||
|
if not scribble:
|
||||||
|
self.close_menu()
|
||||||
|
|
||||||
def freeze_buttons(self, freeze):
|
def freeze_buttons(self, freeze):
|
||||||
"""Freezes the button
|
"""Freezes the button
|
||||||
|
|
Loading…
Reference in New Issue