diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py index 4b7c804ac9..0691a9deb8 100644 --- a/src/calibre/gui2/viewer/documentview.py +++ b/src/calibre/gui2/viewer/documentview.py @@ -640,6 +640,7 @@ class DocumentView(QWebView): # {{{ self.document.font_magnification_step) def contextMenuEvent(self, ev): + from_touch = ev.reason() == ev.Other mf = self.document.mainFrame() r = mf.hitTestContent(ev.pos()) img = r.pixmap() @@ -705,13 +706,16 @@ class DocumentView(QWebView): # {{{ for plugin in self.document.all_viewer_plugins: plugin.customize_context_menu(menu, ev, r) - if ev.reason() == ev.Other: - # Triggered by a touch event + + if from_touch: from calibre.constants import plugins pi = plugins['progress_indicator'][0] for x in (menu, self.goto_location_menu): if hasattr(pi, 'set_touch_menu_style'): pi.set_touch_menu_style(x) + helpt = QAction(QIcon(I('help.png')), _('Show supported touch screen gestures'), menu) + helpt.triggered.connect(self.gesture_handler.show_help) + menu.insertAction(menu.actions()[0], helpt) else: self.goto_location_menu.setStyle(self.style()) self.context_menu = menu diff --git a/src/calibre/gui2/viewer/gestures.py b/src/calibre/gui2/viewer/gestures.py index d5e58b0869..751f4383ed 100644 --- a/src/calibre/gui2/viewer/gestures.py +++ b/src/calibre/gui2/viewer/gestures.py @@ -10,7 +10,7 @@ import time, ctypes, sys from functools import partial from PyQt4.Qt import ( QObject, QPointF, pyqtSignal, QEvent, QApplication, QMouseEvent, Qt, - QContextMenuEvent) + QContextMenuEvent, QDialog, QDialogButtonBox, QLabel, QVBoxLayout) from calibre.constants import iswindows @@ -36,6 +36,56 @@ Tap, TapAndHold, Pinch, Swipe, SwipeAndHold = 'Tap', 'TapAndHold', 'Pinch', 'Swi Left, Right, Up, Down = 'Left', 'Right', 'Up', 'Down' In, Out = 'In', 'Out' +class Help(QDialog): # {{{ + + def __init__(self, parent=None): + QDialog.__init__(self, parent=parent) + self.l = l = QVBoxLayout(self) + self.setLayout(l) + + self.la = la = QLabel( + ''' + + + ''' + _( + ''' +