8 """ |
8 """ |
9 |
9 |
10 import sys |
10 import sys |
11 import re |
11 import re |
12 |
12 |
13 from PyQt4.QtCore import QFileInfo, Qt |
13 from PyQt4.QtCore import QFileInfo, Qt, QEvent |
14 from PyQt4.QtGui import QDialog, QInputDialog, QApplication, QClipboard, QMenu, \ |
14 from PyQt4.QtGui import QDialog, QInputDialog, QApplication, QClipboard, QMenu, \ |
15 QPalette, QFont |
15 QPalette, QFont |
16 from PyQt4.Qsci import QsciScintilla |
16 from PyQt4.Qsci import QsciScintilla |
17 |
17 |
18 from E5Gui.E5Application import e5App |
18 from E5Gui.E5Application import e5App |
213 QsciScintilla.SCI_WORDRIGHTEXTEND: self.extendSelectionWordRight, |
213 QsciScintilla.SCI_WORDRIGHTEXTEND: self.extendSelectionWordRight, |
214 QsciScintilla.SCI_VCHOMEEXTEND: self.__QScintillaVCHomeExtend, |
214 QsciScintilla.SCI_VCHOMEEXTEND: self.__QScintillaVCHomeExtend, |
215 QsciScintilla.SCI_LINEENDEXTEND: self.extendSelectionToEOL, |
215 QsciScintilla.SCI_LINEENDEXTEND: self.extendSelectionToEOL, |
216 } |
216 } |
217 |
217 |
|
218 self.grabGesture(Qt.PinchGesture) |
|
219 |
218 def closeShell(self): |
220 def closeShell(self): |
219 """ |
221 """ |
220 Public method to shutdown the shell. |
222 Public method to shutdown the shell. |
221 """ |
223 """ |
222 for key in list(self.historyLists.keys()): |
224 for key in list(self.historyLists.keys()): |
737 self.zoomIn() |
739 self.zoomIn() |
738 evt.accept() |
740 evt.accept() |
739 return |
741 return |
740 |
742 |
741 super().wheelEvent(evt) |
743 super().wheelEvent(evt) |
|
744 |
|
745 def event(self, evt): |
|
746 """ |
|
747 Protected method handling events. |
|
748 |
|
749 @param evt reference to the event (QEvent) |
|
750 @return flag indicating, if the event was handled (boolean) |
|
751 """ |
|
752 if evt.type() == QEvent.Gesture: |
|
753 self.gestureEvent(evt) |
|
754 return True |
|
755 |
|
756 return super().event(evt) |
|
757 |
|
758 def gestureEvent(self, evt): |
|
759 """ |
|
760 Protected method handling gesture events. |
|
761 |
|
762 @param evt reference to the gesture event (QGestureEvent |
|
763 """ |
|
764 pinch = evt.gesture(Qt.PinchGesture) |
|
765 if pinch: |
|
766 if pinch.state() == Qt.GestureStarted: |
|
767 zoom = (self.getZoom() + 10) / 10.0 |
|
768 pinch.setScaleFactor(zoom) |
|
769 else: |
|
770 zoom = int(pinch.scaleFactor() * 10) - 10 |
|
771 if zoom <= -9: |
|
772 zoom = -9 |
|
773 pinch.setScaleFactor(0.1) |
|
774 elif zoom >= 20: |
|
775 zoom = 20 |
|
776 pinch.setScaleFactor(3.0) |
|
777 self.zoomTo(zoom) |
|
778 evt.accept() |
742 |
779 |
743 def editorCommand(self, cmd): |
780 def editorCommand(self, cmd): |
744 """ |
781 """ |
745 Public method to perform an editor command. |
782 Public method to perform an editor command. |
746 |
783 |