Python PyQt5.QtCore.Qt.Key_D() Examples
The following are 9
code examples of PyQt5.QtCore.Qt.Key_D().
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: dataframe_viewer.py From pandasgui with MIT License | 6 votes |
def keyPressEvent(self, event): QtWidgets.QWidget.keyPressEvent(self, event) if event.matches(QtGui.QKeySequence.Copy): print('Ctrl + C') self.dataView.copy() if event.matches(QtGui.QKeySequence.Paste): self.dataView.paste() print('Ctrl + V') if event.key() == Qt.Key_P and (event.modifiers() & Qt.ControlModifier): self.dataView.print() print('Ctrl + P') if event.key() == Qt.Key_D and (event.modifiers() & Qt.ControlModifier): self.debug() print('Ctrl + D')
Example #2
Source File: test_panes.py From mu with GNU General Public License v3.0 | 6 votes |
def test_PythonProcessPane_parse_input_ctrl_d(qtapp): """ Control-D (Kill process) character is typed. """ ppp = mu.interface.panes.PythonProcessPane() ppp.process = mock.MagicMock() ppp.running = True key = Qt.Key_D text = "" modifiers = Qt.ControlModifier mock_timer = mock.MagicMock() with mock.patch( "mu.interface.panes.platform.system", return_value="win32" ), mock.patch("mu.interface.panes.QTimer", mock_timer): ppp.parse_input(key, text, modifiers) ppp.process.kill.assert_called_once_with() ppp.process.readAll.assert_called_once_with() mock_timer.singleShot.assert_called_once_with(1, ppp.on_process_halt)
Example #3
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 #4
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 #5
Source File: client.py From SunFounder_PiCar-V with GNU General Public License v2.0 | 5 votes |
def keyPressEvent(self, event): """Keyboard press event Effective key: W, A, S, D, ↑, ↓, ←, → Press a key on keyboard, the function will get an event, if the condition is met, call the function run_action(). Args: event, this argument will get when an event of keyboard pressed occured """ key_press = event.key() # don't need autorepeat, while haven't released, just run once if not event.isAutoRepeat(): if key_press == Qt.Key_Up: # up run_action('camup') elif key_press == Qt.Key_Right: # right run_action('camright') elif key_press == Qt.Key_Down: # down run_action('camdown') elif key_press == Qt.Key_Left: # left run_action('camleft') elif key_press == Qt.Key_W: # W run_action('forward') elif key_press == Qt.Key_A: # A run_action('fwleft') elif key_press == Qt.Key_S: # S run_action('backward') elif key_press == Qt.Key_D: # D run_action('fwright')
Example #6
Source File: client.py From SunFounder_PiCar-V with GNU General Public License v2.0 | 5 votes |
def keyReleaseEvent(self, event): """Keyboard released event Effective key: W,A,S,D, ↑, ↓, ←, → Release a key on keyboard, the function will get an event, if the condition is met, call the function run_action(). Args: event, this argument will get when an event of keyboard release occured """ # don't need autorepeat, while haven't pressed, just run once key_release = event.key() if not event.isAutoRepeat(): if key_release == Qt.Key_Up: # up run_action('camready') elif key_release == Qt.Key_Right: # right run_action('camready') elif key_release == Qt.Key_Down: # down run_action('camready') elif key_release == Qt.Key_Left: # left run_action('camready') elif key_release == Qt.Key_W: # W run_action('stop') elif key_release == Qt.Key_A: # A run_action('fwstraight') elif key_release == Qt.Key_S: # S run_action('stop') elif key_release == Qt.Key_D: # D run_action('fwstraight')
Example #7
Source File: test_panes.py From mu with GNU General Public License v3.0 | 5 votes |
def test_PythonProcessPane_parse_input_ctrl_d_after_process_finished(qtapp): """ Control-D (Kill process) character is typed. """ ppp = mu.interface.panes.PythonProcessPane() ppp.process = mock.MagicMock() ppp.running = False key = Qt.Key_D text = "" modifiers = Qt.ControlModifier with mock.patch( "mu.interface.panes.platform.system", return_value="win32" ): ppp.parse_input(key, text, modifiers) assert ppp.process.kill.call_count == 0
Example #8
Source File: client.py From SunFounder_PiCar-V with GNU General Public License v2.0 | 4 votes |
def keyPressEvent(self, event): """Keyboard press event Press a key on keyboard, the function will get an event, if the condition is met, call the function run_action(). In camera calibration mode, Effective key: W,A,S,D, ↑, ↓, ←, →, ESC In front wheel calibration mode, Effective key: A, D, ←, →, ESC In back wheel calibration mode, Effective key: A, D, ←, →, ESC Args: event, this argument will get when an event of keyboard pressed occured """ key_press = event.key() if key_press in (Qt.Key_Up, Qt.Key_W): # UP if self.calibration_status == 1: cali_action('camcaliup') elif self.calibration_status == 2: pass elif self.calibration_status == 3: pass elif key_press in (Qt.Key_Right, Qt.Key_D): # RIGHT if self.calibration_status == 1: cali_action('camcaliright') elif self.calibration_status == 2: cali_action('fwcaliright') elif self.calibration_status == 3: cali_action('bwcaliright') elif key_press in (Qt.Key_Down, Qt.Key_S): # DOWN if self.calibration_status == 1: cali_action('camcalidown') elif self.calibration_status == 2: pass elif self.calibration_status == 3: pass elif key_press in (Qt.Key_Left, Qt.Key_A): # LEFT if self.calibration_status == 1: cali_action('camcalileft') elif self.calibration_status == 2: cali_action('fwcalileft') elif self.calibration_status == 3: cali_action('bwcalileft') cali_action('forward') elif key_press == Qt.Key_Escape: # ESC run_action('stop') self.close()
Example #9
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())