Python源码示例:PyQt5.QtCore.Qt.Key_F5()
示例1
def key_handler(self, key_event, state, card, replay_audio):
"""
Examines the key event to see if the user has triggered one of
the shortcut options.
If we do not handle the key here, then it is passed through to
the normal Anki Reviewer implementation.
As a special case, if the user sets his/her shortcut to one of
the built-in audio shorts (i.e. R, F5), will play ALL sounds,
starting with the built-in ones.
"""
if state not in ['answer', 'question']:
return False
combo = key_event_combo(key_event)
if not combo:
return False
handled = False
if combo in [Qt.Key_R, Qt.Key_F5]:
replay_audio()
handled = True
question_combo = self._addon.config['tts_key_q']
if question_combo and combo == question_combo:
self._play_html('front', card.q(),
self._addon.player.otf_shortcut, self._mw)
handled = True
answer_combo = self._addon.config['tts_key_a']
if state == 'answer' and answer_combo and combo == answer_combo:
self._play_html('back', self._get_answer(card),
self._addon.player.otf_shortcut, self._mw)
handled = True
return handled
示例2
def keyPressEvent(self, e):
if e.key() == Qt.Key_A: # Ctrl/Alt + A 全选
if e.modifiers() and Qt.ControlModifier:
self.select_all_btn()
elif e.key() == Qt.Key_F5: # 刷新
self.call_change_tab()
示例3
def _setup_menu(self):
""" Build Menus
"""
process_menu = QMenu('&Process')
process_menu.addAction('Resume', self._on_proc_resume, Qt.Key_F5)
process_menu.addAction('Restart', self._on_proc_restart, Qt.Key_F9)
process_menu.addAction('Detach', self._on_detach, Qt.Key_F10)
process_menu.addSeparator()
process_menu.addAction('Step', lambda: self.dwarf.dwarf_api('_step'), Qt.Key_F7)
process_menu.addAction('Step call', lambda: self.dwarf.dwarf_api('_step', 'call'), Qt.Key_F8)
process_menu.addAction('Step block', lambda: self.dwarf.dwarf_api('_step', 'block'))
self._menu.append(process_menu)