当前位置: 首页>>代码示例>>Python>>正文


Python Qt.NoModifier方法代码示例

本文整理汇总了Python中PyQt5.QtCore.Qt.NoModifier方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.NoModifier方法的具体用法?Python Qt.NoModifier怎么用?Python Qt.NoModifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.Qt的用法示例。


在下文中一共展示了Qt.NoModifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_partial_keychain_timeout

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [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 == [''] 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:26,代码来源:test_modeparsers.py

示例2: test_command

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [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)] 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:24,代码来源:test_modeparsers.py

示例3: test_Editor_connect_margin_1_works

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [as 别名]
def test_Editor_connect_margin_1_works(qtapp):
    """
    Ensure that the margin click handler is called if margin 1 is clicked.
    """
    mock_fn = mock.MagicMock()
    ep = mu.interface.editor.EditorPane("/foo/bar.py", "baz")
    ep.connect_margin(mock_fn)
    margin = 1
    line = 0
    modifiers = Qt.NoModifier
    ep.marginClicked.emit(margin, line, modifiers)

    assert mock_fn.call_count == 1
    args, _kwargs = mock_fn.call_args
    call_margin, call_line, _call_modifiers = args
    assert margin == call_margin
    assert line == call_line
    # Don't assert _call_modifiers value: not used in implementation and seems
    # to fail intermittently on macOS. 
开发者ID:mu-editor,项目名称:mu,代码行数:21,代码来源:test_editor.py

示例4: test_EditorPane_drop_event

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [as 别名]
def test_EditorPane_drop_event(qtapp):
    """
    If there's a drop event associated with files, cause them to be passed into
    Mu's existing file loading code.
    """
    ep = mu.interface.editor.EditorPane(None, "baz")
    m = mock.MagicMock()
    ep.open_file = mock.MagicMock()
    ep.open_file.emit = m
    data = QMimeData()
    data.setUrls(
        [
            QUrl("file://test/path.py"),
            QUrl("file://test/path.hex"),
            QUrl("file://test/path.txt"),
        ]
    )
    evt = QDropEvent(
        QPointF(0, 0), Qt.CopyAction, data, Qt.LeftButton, Qt.NoModifier
    )
    ep.dropEvent(evt)
    # Upstream _load will handle invalid file type (.txt).
    assert m.call_count == 3 
开发者ID:mu-editor,项目名称:mu,代码行数:25,代码来源:test_editor.py

示例5: handle_text

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [as 别名]
def handle_text():
    """Helper function to handle multiple fake keypresses."""
    def func(kp, *args):
        for key in args:
            info = keyutils.KeyInfo(key, Qt.NoModifier)
            kp.handle(info.to_event())
    return func 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:9,代码来源:test_basekeyparser.py

示例6: test_valid_key_count

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [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) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:13,代码来源:test_basekeyparser.py

示例7: test_dry_run

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [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 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:11,代码来源:test_basekeyparser.py

示例8: test_dry_run_count

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [as 别名]
def test_dry_run_count(self, prompt_keyparser):
        info = keyutils.KeyInfo(Qt.Key_9, Qt.NoModifier)
        prompt_keyparser.handle(info.to_event(), dry_run=True)
        assert not prompt_keyparser._count 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:6,代码来源:test_basekeyparser.py

示例9: test_invalid_key

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [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 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:8,代码来源:test_basekeyparser.py

示例10: test_partial_before_full_match

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [as 别名]
def test_partial_before_full_match(self, keyparser, config_stub):
        """Make sure full matches always take precedence over partial ones."""
        config_stub.val.bindings.commands = {
            'normal': {
                'ab': 'message-info bar',
                'a': 'message-info foo'
            }
        }
        info = keyutils.KeyInfo(Qt.Key_A, Qt.NoModifier)
        keyparser.handle(info.to_event())
        keyparser.execute.assert_called_once_with('message-info foo', None) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:13,代码来源:test_basekeyparser.py

示例11: test_numpad

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [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) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:11,代码来源:test_basekeyparser.py

示例12: test_key_data_modifiers

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [as 别名]
def test_key_data_modifiers():
    """Make sure all possible modifiers are in key_data.MODIFIERS."""
    mod_names = {name[:-len("Modifier")]
                 for name, value in sorted(vars(Qt).items())
                 if isinstance(value, Qt.KeyboardModifier) and
                 value not in [Qt.NoModifier, Qt.KeyboardModifierMask]}
    mod_data_names = {mod.attribute for mod in sorted(key_data.MODIFIERS)}
    diff = mod_names - mod_data_names
    assert not diff 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:11,代码来源:test_keyutils.py

示例13: test_iter

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [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 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:14,代码来源:test_keyutils.py

示例14: test_getitem

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [as 别名]
def test_getitem(self):
        seq = keyutils.KeySequence.parse('ab')
        expected = keyutils.KeyInfo(Qt.Key_B, Qt.NoModifier)
        assert seq[1] == expected 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:6,代码来源:test_keyutils.py

示例15: test_append_event_invalid

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoModifier [as 别名]
def test_append_event_invalid(self, key):
        seq = keyutils.KeySequence()
        event = QKeyEvent(QKeyEvent.KeyPress, key, Qt.NoModifier, '')
        with pytest.raises(keyutils.KeyParseError):
            seq.append_event(event) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:7,代码来源:test_keyutils.py


注:本文中的PyQt5.QtCore.Qt.NoModifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。