Python PyQt5.QtCore.Qt.Key_C() Examples
The following are 14
code examples of PyQt5.QtCore.Qt.Key_C().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: test_modeparsers.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
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)]
Example #2
Source File: MWTrackerViewer.py From tierpsy-tracker with MIT License | 6 votes |
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))
Example #3
Source File: eventfilter.py From legion with GNU General Public License v3.0 | 6 votes |
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
Example #4
Source File: test_eventfilter.py From legion with GNU General Public License v3.0 | 6 votes |
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")
Example #5
Source File: test_panes.py From mu with GNU General Public License v3.0 | 6 votes |
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)
Example #6
Source File: test_panes.py From mu with GNU General Public License v3.0 | 6 votes |
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
Example #7
Source File: test_basekeyparser.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
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
Example #8
Source File: test_keyutils.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
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
Example #9
Source File: test_keyutils.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
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
Example #10
Source File: consolewidget.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
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)
Example #11
Source File: CopyContent.py From PyQt with GNU General Public License v3.0 | 5 votes |
def keyPressEvent(self, event): super(TableView, self).keyPressEvent(event) # Ctrl + C if event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_C: self.copyData()
Example #12
Source File: test_panes.py From mu with GNU General Public License v3.0 | 5 votes |
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()
Example #13
Source File: test_panes.py From mu with GNU General Public License v3.0 | 5 votes |
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()
Example #14
Source File: forward_keyboard.py From MaixPy_scripts with MIT License | 4 votes |
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())