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


Python Qt.Key_C方法代码示例

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


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

示例1: test_command

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [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

示例2: __init__

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

示例3: filterKeyPressInHostsTableView

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def filterKeyPressInHostsTableView(self, key, receiver):
        if not receiver.selectionModel().selectedRows():
            return True

        index = receiver.selectionModel().selectedRows()[0].row()

        if key == Qt.Key_Down:
            new_index = index + 1
            receiver.selectRow(new_index)
            receiver.clicked.emit(receiver.selectionModel().selectedRows()[0])
        elif key == Qt.Key_Up:
            new_index = index - 1
            receiver.selectRow(new_index)
            receiver.clicked.emit(receiver.selectionModel().selectedRows()[0])
        elif QApplication.keyboardModifiers() == Qt.ControlModifier and key == Qt.Key_C:
            selected = receiver.selectionModel().currentIndex()
            clipboard = QApplication.clipboard()
            clipboard.setText(selected.data().toString())
        return True 
开发者ID:GoVanguard,项目名称:legion,代码行数:21,代码来源:eventfilter.py

示例4: test_eventFilter_whenKeyCPressed_SelectsPreviousRowAndEmitsClickEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def test_eventFilter_whenKeyCPressed_SelectsPreviousRowAndEmitsClickEvent(
            self, hosts_table_view, selection_model, selected_row, mock_clipboard):
        expected_data = MagicMock()
        expected_data.toString = Mock(return_value="some clipboard data")
        control_modifier = mock.patch.object(QApplication, 'keyboardModifiers', return_value=Qt.ControlModifier)
        clipboard = mock.patch.object(QApplication, 'clipboard', return_value=mock_clipboard)

        self.mock_view.ui.HostsTableView = hosts_table_view
        event_filter = MyEventFilter(self.mock_view, self.mock_main_window)
        self.simulateKeyPress(Qt.Key_C)
        self.mock_receiver = hosts_table_view
        selected_row.data = Mock(return_value=expected_data)
        selection_model.currentIndex = Mock(return_value=selected_row)
        self.mock_receiver.selectionModel = Mock(return_value=selection_model)

        with control_modifier, clipboard:
            result = event_filter.eventFilter(self.mock_receiver, self.mock_event)
            self.assertTrue(result)
            mock_clipboard.setText.assert_called_once_with("some clipboard data") 
开发者ID:GoVanguard,项目名称:legion,代码行数:21,代码来源:test_eventfilter.py

示例5: test_PythonProcessPane_parse_input_ctrl_c

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def test_PythonProcessPane_parse_input_ctrl_c(qtapp):
    """
    Control-C (SIGINT / KeyboardInterrupt) character is typed.
    """
    ppp = mu.interface.panes.PythonProcessPane()
    ppp.process = mock.MagicMock()
    ppp.process.processId.return_value = 123
    ppp.running = True
    key = Qt.Key_C
    text = ""
    modifiers = Qt.ControlModifier
    mock_kill = mock.MagicMock()
    mock_timer = mock.MagicMock()
    with mock.patch("mu.interface.panes.os.kill", mock_kill), mock.patch(
        "mu.interface.panes.QTimer", mock_timer
    ), mock.patch("mu.interface.panes.platform.system", return_value="win32"):
        ppp.parse_input(key, text, modifiers)
    mock_kill.assert_called_once_with(123, signal.SIGINT)
    ppp.process.readAll.assert_called_once_with()
    mock_timer.singleShot.assert_called_once_with(1, ppp.on_process_halt) 
开发者ID:mu-editor,项目名称:mu,代码行数:22,代码来源:test_panes.py

示例6: test_PythonProcessPane_parse_input_ctrl_c_after_process_finished

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def test_PythonProcessPane_parse_input_ctrl_c_after_process_finished(qtapp):
    """
    Control-C (SIGINT / KeyboardInterrupt) character is typed.
    """
    ppp = mu.interface.panes.PythonProcessPane()
    ppp.process = mock.MagicMock()
    ppp.process.processId.return_value = 123
    ppp.running = False
    key = Qt.Key_C
    text = ""
    modifiers = Qt.ControlModifier
    mock_kill = mock.MagicMock()
    with mock.patch("mu.interface.panes.os.kill", mock_kill), mock.patch(
        "mu.interface.panes.platform.system", return_value="win32"
    ):
        ppp.parse_input(key, text, modifiers)
    assert mock_kill.call_count == 0 
开发者ID:mu-editor,项目名称:mu,代码行数:19,代码来源:test_panes.py

示例7: test_count_42_invalid

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def test_count_42_invalid(self, handle_text, prompt_keyparser):
        # Invalid call with ccx gets ignored
        handle_text(prompt_keyparser,
                    Qt.Key_4, Qt.Key_2, Qt.Key_C, Qt.Key_C, Qt.Key_X)
        assert not prompt_keyparser.execute.called
        assert not prompt_keyparser._sequence
        # Valid call with ccc gets the correct count
        handle_text(prompt_keyparser,
                    Qt.Key_2, Qt.Key_3, Qt.Key_C, Qt.Key_C, Qt.Key_C)
        prompt_keyparser.execute.assert_called_once_with(
            'message-info ccc', 23)
        assert not prompt_keyparser._sequence 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:14,代码来源:test_basekeyparser.py

示例8: test_init

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

示例9: test_iter

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [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

示例10: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def keyPressEvent(self, e):
        """Override keyPressEvent to handle special keypresses."""
        if e.key() == Qt.Key_Up:
            self.history_prev()
            e.accept()
        elif e.key() == Qt.Key_Down:
            self.history_next()
            e.accept()
        elif e.modifiers() & Qt.ControlModifier and e.key() == Qt.Key_C:
            self.setText('')
            e.accept()
        else:
            super().keyPressEvent(e) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:15,代码来源:consolewidget.py

示例11: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def keyPressEvent(self, event):
        super(TableView, self).keyPressEvent(event)
        # Ctrl + C
        if event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_C:
            self.copyData() 
开发者ID:PyQt5,项目名称:PyQt,代码行数:7,代码来源:CopyContent.py

示例12: test_MicroPythonREPLPane_keyPressEvent_CTRL_C_Darwin

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def test_MicroPythonREPLPane_keyPressEvent_CTRL_C_Darwin(qtapp):
    """
    Ensure end key in the REPL is handled correctly.
    """
    mock_serial = mock.MagicMock()
    rp = mu.interface.panes.MicroPythonREPLPane(mock_serial)
    rp.copy = mock.MagicMock()
    data = mock.MagicMock()
    data.key = mock.MagicMock(return_value=Qt.Key_C)
    data.text = mock.MagicMock(return_value="1b")
    data.modifiers.return_value = Qt.ControlModifier | Qt.ShiftModifier
    rp.keyPressEvent(data)
    rp.copy.assert_called_once_with() 
开发者ID:mu-editor,项目名称:mu,代码行数:15,代码来源:test_panes.py

示例13: test_PythonProcessPane_parse_input_copy

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def test_PythonProcessPane_parse_input_copy(qtapp):
    """
    Control-Shift-C (copy) character causes copy to happen.
    """
    ppp = mu.interface.panes.PythonProcessPane()
    key = Qt.Key_C
    text = ""
    modifiers = Qt.ControlModifier | Qt.ShiftModifier
    ppp.copy = mock.MagicMock()
    ppp.parse_input(key, text, modifiers)
    ppp.copy.assert_called_once_with() 
开发者ID:mu-editor,项目名称:mu,代码行数:13,代码来源:test_panes.py

示例14: keyPressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Key_C [as 别名]
def keyPressEvent(self, event):
        print(event.key())
        if event.key() == Qt.Key_M:
            self.send_flag = False
            self.com.write(b"m")
            self.send_flag = False
        elif event.key() == Qt.Key_Return or event.key()==Qt.Key_Enter:
            self.send_flag = False
            self.com.write(b"m")
            self.send_flag = False
        elif event.key() == Qt.Key_N or event.key() == 92:
            self.send_flag = False
            self.com.write(b"n")
            self.send_flag = False
        elif event.key() == Qt.Key_Minus:
            self.send_flag = False
            self.com.write(b"-")
            self.send_flag = False
        elif event.key() == Qt.Key_Equal:
            self.send_flag = False
            self.com.write(b"=")
            self.send_flag = False
        elif event.key() == Qt.Key_W or event.key() == Qt.Key_Up:
            self.send_flag = True
            self.key.append(b"w")
        elif event.key() == Qt.Key_A or event.key() == Qt.Key_Left:
            self.send_flag = True
            self.key.append(b"a")
        elif event.key() == Qt.Key_S or event.key() == Qt.Key_Down:
            self.send_flag = True
            self.key.append(b"s")
        elif event.key() == Qt.Key_D or event.key() == Qt.Key_Right:
            self.send_flag = True
            self.key.append(b"d")
        elif event.key() == Qt.Key_J:
            self.send_flag = True
            self.key.append(b"j")
        elif event.key() == Qt.Key_K:
            self.send_flag = True
            self.key.append(b"k")
        elif event.key() == Qt.Key_Escape:
            self.send_flag = False
            self.com.write(b"\x03")
        elif event.key() == Qt.Key_Control:
            self.keyControlPressed = True
        elif event.key() == Qt.Key_C:
            if self.keyControlPressed:
                self.send_flag = False
                self.com.write(b"\x03")
        # self.key_label.setText(self.key.decode()) 
开发者ID:sipeed,项目名称:MaixPy_scripts,代码行数:52,代码来源:forward_keyboard.py


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