本文整理汇总了Python中PyQt5.QtCore.Qt.Key_B方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Key_B方法的具体用法?Python Qt.Key_B怎么用?Python Qt.Key_B使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.Key_B方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_partial_keychain_timeout
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_partial_keychain_timeout(self, keyparser, config_stub,
qtbot, commandrunner):
"""Test partial keychain timeout."""
config_stub.val.input.partial_timeout = 100
timer = keyparser._partial_timer
assert not timer.isActive()
# Press 'b' for a partial match.
# Then we check if the timer has been set up correctly
keyparser.handle(keyutils.KeyInfo(Qt.Key_B, Qt.NoModifier).to_event())
assert timer.isSingleShot()
assert timer.interval() == 100
assert timer.isActive()
assert not commandrunner.commands
assert keyparser._sequence == keyutils.KeySequence.parse('b')
# Now simulate a timeout and check the keystring has been cleared.
with qtbot.wait_signal(keyparser.keystring_updated) as blocker:
timer.timeout.emit()
assert not commandrunner.commands
assert not keyparser._sequence
assert blocker.args == ['']
示例2: test_command
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_command(self, keyparser, config_stub, hintmanager, commandrunner):
config_stub.val.bindings.commands = {
'hint': {'abc': 'message-info abc'}
}
keyparser.update_bindings(['xabcy'])
steps = [
(Qt.Key_X, QKeySequence.PartialMatch, 'x'),
(Qt.Key_A, QKeySequence.PartialMatch, ''),
(Qt.Key_B, QKeySequence.PartialMatch, ''),
(Qt.Key_C, QKeySequence.ExactMatch, ''),
]
for key, expected_match, keystr in steps:
info = keyutils.KeyInfo(key, Qt.NoModifier)
match = keyparser.handle(info.to_event())
assert match == expected_match
assert hintmanager.keystr == keystr
if key != Qt.Key_C:
assert not commandrunner.commands
assert commandrunner.commands == [('message-info abc', None)]
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def __init__(self, ui):
super().__init__(ui)
self.wlab = WLAB
self.label_type = 'worm_label'
self.ui.pushButton_U.clicked.connect(
partial(self._h_tag_worm, self.wlab['U']))
self.ui.pushButton_W.clicked.connect(
partial(self._h_tag_worm, self.wlab['WORM']))
self.ui.pushButton_WS.clicked.connect(
partial(self._h_tag_worm, self.wlab['WORMS']))
self.ui.pushButton_B.clicked.connect(
partial(self._h_tag_worm, self.wlab['BAD']))
self.ui.pushButton_W.setShortcut(QKeySequence(Qt.Key_W))
self.ui.pushButton_U.setShortcut(QKeySequence(Qt.Key_U))
self.ui.pushButton_WS.setShortcut(QKeySequence(Qt.Key_C))
self.ui.pushButton_B.setShortcut(QKeySequence(Qt.Key_B))
示例4: test_dry_run
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_dry_run(self, prompt_keyparser):
b_info = keyutils.KeyInfo(Qt.Key_B, Qt.NoModifier)
prompt_keyparser.handle(b_info.to_event())
a_info = keyutils.KeyInfo(Qt.Key_A, Qt.NoModifier)
prompt_keyparser.handle(a_info.to_event(), dry_run=True)
assert not prompt_keyparser.execute.called
assert prompt_keyparser._sequence
示例5: test_invalid_key
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_invalid_key(self, prompt_keyparser):
keys = [Qt.Key_B, 0x0]
for key in keys:
info = keyutils.KeyInfo(key, Qt.NoModifier)
prompt_keyparser.handle(info.to_event())
assert not prompt_keyparser._sequence
示例6: test_valid_keychain
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_valid_keychain(self, handle_text, prompt_keyparser):
handle_text(prompt_keyparser,
# Press 'x' which is ignored because of no match
Qt.Key_X,
# Then start the real chain
Qt.Key_B, Qt.Key_A)
prompt_keyparser.execute.assert_called_with('message-info ba', None)
assert not prompt_keyparser._sequence
示例7: test_binding_and_mapping
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_binding_and_mapping(self, config_stub, handle_text, prompt_keyparser):
"""with a conflicting binding/mapping, the binding should win."""
handle_text(prompt_keyparser, Qt.Key_B)
assert not prompt_keyparser.execute.called
示例8: test_no_count
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_no_count(self, handle_text, prompt_keyparser):
"""Test with no count added."""
handle_text(prompt_keyparser, Qt.Key_B, Qt.Key_A)
prompt_keyparser.execute.assert_called_once_with(
'message-info ba', None)
assert not prompt_keyparser._sequence
示例9: test_count_42
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_count_42(self, handle_text, prompt_keyparser):
handle_text(prompt_keyparser, Qt.Key_4, Qt.Key_2, Qt.Key_B, Qt.Key_A)
prompt_keyparser.execute.assert_called_once_with('message-info ba', 42)
assert not prompt_keyparser._sequence
示例10: test_superscript
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_superscript(self, handle_text, prompt_keyparser):
# https://github.com/qutebrowser/qutebrowser/issues/3743
handle_text(prompt_keyparser, Qt.Key_twosuperior, Qt.Key_B, Qt.Key_A)
示例11: test_numpad
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_numpad(self, prompt_keyparser):
"""Make sure we can enter a count via numpad."""
for key, modifiers in [(Qt.Key_4, Qt.KeypadModifier),
(Qt.Key_2, Qt.KeypadModifier),
(Qt.Key_B, Qt.NoModifier),
(Qt.Key_A, Qt.NoModifier)]:
info = keyutils.KeyInfo(key, modifiers)
prompt_keyparser.handle(info.to_event())
prompt_keyparser.execute.assert_called_once_with('message-info ba', 42)
示例12: test_iter
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_iter(self):
seq = keyutils.KeySequence(Qt.Key_A | Qt.ControlModifier,
Qt.Key_B | Qt.ShiftModifier,
Qt.Key_C,
Qt.Key_D,
Qt.Key_E)
expected = [keyutils.KeyInfo(Qt.Key_A, Qt.ControlModifier),
keyutils.KeyInfo(Qt.Key_B, Qt.ShiftModifier),
keyutils.KeyInfo(Qt.Key_C, Qt.NoModifier),
keyutils.KeyInfo(Qt.Key_D, Qt.NoModifier),
keyutils.KeyInfo(Qt.Key_E, Qt.NoModifier)]
assert list(seq) == expected
示例13: test_repr
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_repr(self):
seq = keyutils.KeySequence(Qt.Key_A | Qt.ControlModifier,
Qt.Key_B | Qt.ShiftModifier)
assert repr(seq) == ("<qutebrowser.keyinput.keyutils.KeySequence "
"keys='<Ctrl+a>B'>")
示例14: test_getitem
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def test_getitem(self):
seq = keyutils.KeySequence.parse('ab')
expected = keyutils.KeyInfo(Qt.Key_B, Qt.NoModifier)
assert seq[1] == expected
示例15: keyPressEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_B [as 别名]
def keyPressEvent(self, event):
if (
self.completer
and self.completer.popup()
and self.completer.popup().isVisible()
):
if event.key() in (
Qt.Key_Enter,
Qt.Key_Return,
Qt.Key_Escape,
Qt.Key_Tab,
Qt.Key_Backtab,
):
event.ignore()
return
isShortcut = event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_B
if not self.completer or not isShortcut:
QPlainTextEdit.keyPressEvent(self.editor, event)
completionPrefix = self.textUnderCursor()
if not isShortcut:
if self.completer.popup():
self.completer.popup().hide()
return
self.completer.setCompletionPrefix(completionPrefix)
popup = self.completer.popup()
popup.setFont(self.font)
popup.setCurrentIndex(self.completer.completionModel().index(0, 0))
cr = self.editor.cursorRect()
cr.translate(QPoint(10, 10))
cr.setWidth(
self.completer.popup().sizeHintForColumn(0)
+ self.completer.popup().verticalScrollBar().sizeHint().width()
)
self.completer.complete(cr)