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


Python Main.keyPressEvent方法代码示例

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


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

示例1: keyPressEvent

# 需要导入模块: from calibre.gui2.viewer.ui import Main [as 别名]
# 或者: from calibre.gui2.viewer.ui.Main import keyPressEvent [as 别名]
 def keyPressEvent(self, event):
     if event.key() == Qt.Key_Escape:
         if self.metadata.isVisible():
             self.metadata.setVisible(False)
             event.accept()
             return
         if self.isFullScreen():
             self.action_full_screen.trigger()
             event.accept()
             return
     try:
         key = self.view.shortcuts.get_match(event)
     except AttributeError:
         return MainWindow.keyPressEvent(self, event)
     try:
         bac = self.bookmarks_menu.actions()[0]
     except (AttributeError, TypeError, IndexError, KeyError):
         bac = None
     action = {
         'Quit':self.action_quit,
         'Show metadata':self.action_metadata,
         'Copy':self.view.copy_action,
         'Font larger': self.action_font_size_larger,
         'Font smaller': self.action_font_size_smaller,
         'Fullscreen': self.action_full_screen,
         'Find next': self.action_find_next,
         'Find previous': self.action_find_previous,
         'Search online': self.view.search_online_action,
         'Lookup word': self.view.dictionary_action,
         'Next occurrence': self.view.search_action,
         'Bookmark': bac,
         'Reload': self.action_reload,
         'Table of Contents': self.action_table_of_contents,
         'Print': self.action_print,
     }.get(key, None)
     if action is not None:
         event.accept()
         action.trigger()
         return
     if key == 'Focus Search':
         self.search.setFocus(Qt.OtherFocusReason)
         return
     if not self.view.handle_key_press(event):
         event.ignore()
开发者ID:Solertis,项目名称:calibre,代码行数:46,代码来源:main.py

示例2: keyPressEvent

# 需要导入模块: from calibre.gui2.viewer.ui import Main [as 别名]
# 或者: from calibre.gui2.viewer.ui.Main import keyPressEvent [as 别名]
 def keyPressEvent(self, event):
     if event.key() == Qt.Key_Escape:
         if self.metadata.isVisible():
             self.metadata.setVisible(False)
             event.accept()
             return
         if self.isFullScreen():
             self.action_full_screen.trigger()
             event.accept()
             return
     try:
         key = self.view.shortcuts.get_match(event)
     except AttributeError:
         return MainWindow.keyPressEvent(self, event)
     try:
         bac = self.bookmarks_menu.actions()[0]
     except (AttributeError, TypeError, IndexError, KeyError):
         bac = None
     action = {
         "Quit": self.action_quit,
         "Show metadata": self.action_metadata,
         "Copy": self.view.copy_action,
         "Font larger": self.action_font_size_larger,
         "Font smaller": self.action_font_size_smaller,
         "Fullscreen": self.action_full_screen,
         "Find next": self.action_find_next,
         "Find previous": self.action_find_previous,
         "Search online": self.view.search_online_action,
         "Lookup word": self.view.dictionary_action,
         "Next occurrence": self.view.search_action,
         "Bookmark": bac,
         "Reload": self.action_reload,
         "Table of Contents": self.action_table_of_contents,
     }.get(key, None)
     if action is not None:
         event.accept()
         action.trigger()
         return
     if key == "Focus Search":
         self.search.setFocus(Qt.OtherFocusReason)
         return
     if not self.view.handle_key_press(event):
         event.ignore()
开发者ID:pft,项目名称:calibre,代码行数:45,代码来源:main.py


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