Implement #2790 (Keyboard shortcut for copy in reader)

This commit is contained in:
Kovid Goyal 2009-07-12 21:04:00 -06:00
parent a76c1a428f
commit f1936e18da
2 changed files with 7 additions and 1 deletions

View File

@ -337,6 +337,10 @@ class DocumentView(QWebView):
self.connect(self.document, SIGNAL('animated_scroll_done()'), self.connect(self.document, SIGNAL('animated_scroll_done()'),
self.animated_scroll_done, Qt.QueuedConnection) self.animated_scroll_done, Qt.QueuedConnection)
@property
def copy_action(self):
return self.document.action(QWebPage.Copy)
def animated_scroll_done(self): def animated_scroll_done(self):
if self.manager is not None: if self.manager is not None:
self.manager.scrolled(self.document.scroll_fraction) self.manager.scrolled(self.document.scroll_fraction)

View File

@ -9,7 +9,7 @@ from PyQt4.Qt import QMovie, QApplication, Qt, QIcon, QTimer, QWidget, SIGNAL, \
QDesktopServices, QDoubleSpinBox, QLabel, QTextBrowser, \ QDesktopServices, QDoubleSpinBox, QLabel, QTextBrowser, \
QPainter, QBrush, QColor, QStandardItemModel, QPalette, \ QPainter, QBrush, QColor, QStandardItemModel, QPalette, \
QStandardItem, QUrl, QRegExpValidator, QRegExp, QLineEdit, \ QStandardItem, QUrl, QRegExpValidator, QRegExp, QLineEdit, \
QToolButton, QMenu, QInputDialog, QAction QToolButton, QMenu, QInputDialog, QAction, QKeySequence
from calibre.gui2.viewer.main_ui import Ui_EbookViewer from calibre.gui2.viewer.main_ui import Ui_EbookViewer
from calibre.gui2.viewer.printing import Printing from calibre.gui2.viewer.printing import Printing
@ -285,6 +285,8 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
self.connect(self.action_print, SIGNAL("triggered(bool)"), partial(self.print_book, preview=False)) self.connect(self.action_print, SIGNAL("triggered(bool)"), partial(self.print_book, preview=False))
self.connect(self.print_menu.actions()[0], SIGNAL("triggered(bool)"), partial(self.print_book, preview=True)) self.connect(self.print_menu.actions()[0], SIGNAL("triggered(bool)"), partial(self.print_book, preview=True))
self.set_max_width() self.set_max_width()
ca = self.view.copy_action
ca.setShortcut(QKeySequence.Copy)
def set_max_width(self): def set_max_width(self):