本文整理汇总了Python中PyQt5.QtCore.Qt.Key_A方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Key_A方法的具体用法?Python Qt.Key_A怎么用?Python Qt.Key_A使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.Key_A方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_MicroPythonREPLPane_keyPressEvent_meta
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [as 别名]
def test_MicroPythonREPLPane_keyPressEvent_meta(qtapp):
"""
Ensure backspaces in the REPL are handled correctly.
"""
mock_serial = mock.MagicMock()
rp = mu.interface.panes.MicroPythonREPLPane(mock_serial)
data = mock.MagicMock
data.key = mock.MagicMock(return_value=Qt.Key_M)
data.text = mock.MagicMock(return_value="a")
if platform.system() == "Darwin":
data.modifiers = mock.MagicMock(return_value=Qt.MetaModifier)
else:
data.modifiers = mock.MagicMock(return_value=Qt.ControlModifier)
rp.keyPressEvent(data)
expected = 1 + Qt.Key_M - Qt.Key_A
mock_serial.write.assert_called_once_with(bytes([expected]))
示例2: left
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [as 别名]
def left(self):
self.widget.switch_page(right=False)
#def keyPressEvent(self, event):
#这里event.key()显示的是按键的编码
#print("按下:" + str(event.key()))
# 举例,这里Qt.Key_A注意虽然字母大写,但按键事件对大小写不敏感
#if (event.key() == Qt.Key_Left):
# self.widget.switch_page(right=False)
#elif (event.key() == Qt.Key_Right):
# self.widget.switch_page(right=True)
#elif (event.modifiers() == Qt.CTRL and event.key() == Qt.Key_Plus):
# self.widget.zoom_book(plus=True)
#elif (event.modifiers() == Qt.CTRL and event.key() == Qt.Key_Minus):
# self.widget.zoom_book(plus=False)
示例3: test_valid_key
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [as 别名]
def test_valid_key(self, prompt_keyparser, handle_text):
modifier = Qt.MetaModifier if utils.is_mac else Qt.ControlModifier
infos = [
keyutils.KeyInfo(Qt.Key_A, modifier),
keyutils.KeyInfo(Qt.Key_X, modifier),
]
for info in infos:
prompt_keyparser.handle(info.to_event())
prompt_keyparser.execute.assert_called_once_with(
'message-info ctrla', None)
assert not prompt_keyparser._sequence
示例4: test_valid_key_count
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [as 别名]
def test_valid_key_count(self, prompt_keyparser):
modifier = Qt.MetaModifier if utils.is_mac else Qt.ControlModifier
infos = [
keyutils.KeyInfo(Qt.Key_5, Qt.NoModifier),
keyutils.KeyInfo(Qt.Key_A, modifier),
]
for info in infos:
prompt_keyparser.handle(info.to_event())
prompt_keyparser.execute.assert_called_once_with(
'message-info ctrla', 5)
示例5: test_dry_run
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [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
示例6: test_valid_keychain
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [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_mapping_in_key_chain
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [as 别名]
def test_mapping_in_key_chain(self, config_stub, handle_text, keyparser):
"""A mapping should work even as part of a keychain."""
config_stub.val.bindings.commands = {'normal':
{'aa': 'message-info aa'}}
handle_text(keyparser, Qt.Key_A, Qt.Key_X)
keyparser.execute.assert_called_once_with('message-info aa', None)
示例8: test_no_count
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [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_0
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [as 别名]
def test_count_0(self, handle_text, prompt_keyparser):
handle_text(prompt_keyparser, Qt.Key_0, Qt.Key_B, Qt.Key_A)
calls = [mock.call('message-info 0', None),
mock.call('message-info ba', None)]
prompt_keyparser.execute.assert_has_calls(calls)
assert not prompt_keyparser._sequence
示例10: test_count_42
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [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
示例11: test_superscript
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [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)
示例12: test_numpad
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [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)
示例13: test_missing
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [as 别名]
def test_missing(self, monkeypatch):
monkeypatch.delattr(keyutils.Qt, 'Key_AltGr')
# We don't want to test the key which is actually missing - we only
# want to know if the mapping still behaves properly.
assert keyutils._key_to_string(Qt.Key_A) == 'A'
示例14: test_init
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [as 别名]
def test_init(self):
seq = keyutils.KeySequence(Qt.Key_A, Qt.Key_B, Qt.Key_C, Qt.Key_D,
Qt.Key_E)
assert len(seq._sequences) == 2
assert len(seq._sequences[0]) == 4
assert len(seq._sequences[1]) == 1
示例15: test_iter
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_A [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