Skip to content

Commit

Permalink
pyqt6: Fix some keyboard modifiers checks in the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jan 3, 2022
1 parent acfbd90 commit adba00e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/calibre/gui2/tweak_book/editor/smarts/html.py
Expand Up @@ -732,10 +732,10 @@ def handle_key_press(self, ev, editor):

if key in (Qt.Key.Key_BraceLeft, Qt.Key.Key_BraceRight):
mods = ev.modifiers()
if int(mods & Qt.KeyboardModifier.ControlModifier):
if mods & Qt.KeyboardModifier.ControlModifier:
if self.jump_to_enclosing_tag(editor, key == Qt.Key.Key_BraceLeft):
return True
if key == Qt.Key.Key_T and int(ev.modifiers() & (Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.AltModifier)):
if key == Qt.Key.Key_T and ev.modifiers() & (Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.AltModifier):
return self.select_tag_contents(editor)

return False
Expand Down
4 changes: 2 additions & 2 deletions src/calibre/gui2/tweak_book/editor/smarts/utils.py
Expand Up @@ -43,15 +43,15 @@ def get_leading_whitespace_on_block(editor, previous=False):
def no_modifiers(ev, *args):
mods = ev.modifiers()
for mod_mask in args:
if int(mods & mod_mask):
if mods & mod_mask:
return False
return True


def test_modifiers(ev, *args):
mods = ev.modifiers()
for mod_mask in args:
if not int(mods & mod_mask):
if not mods & mod_mask:
return False
return True

Expand Down

0 comments on commit adba00e

Please sign in to comment.