9 |
9 |
10 import sys |
10 import sys |
11 import os |
11 import os |
12 import re |
12 import re |
13 |
13 |
14 from PyQt4.QtCore import QSignalMapper, QTimer, QByteArray, QProcess, Qt |
14 from PyQt4.QtCore import QSignalMapper, QTimer, QByteArray, QProcess, Qt, QEvent |
15 from PyQt4.QtGui import QDialog, QInputDialog, QApplication, QMenu, QPalette, QFont |
15 from PyQt4.QtGui import QDialog, QInputDialog, QApplication, QMenu, 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 |
19 |
19 |
170 for ascii_number, letter in enumerate("abcdefghijklmnopqrstuvwxyz"): |
170 for ascii_number, letter in enumerate("abcdefghijklmnopqrstuvwxyz"): |
171 self.__ctrl[letter] = chr(ascii_number + 1) |
171 self.__ctrl[letter] = chr(ascii_number + 1) |
172 |
172 |
173 self.__lastPos = (0, 0) |
173 self.__lastPos = (0, 0) |
174 |
174 |
|
175 self.grabGesture(Qt.PinchGesture) |
|
176 |
175 self.__startShell() |
177 self.__startShell() |
176 |
178 |
177 def __readOutput(self): |
179 def __readOutput(self): |
178 """ |
180 """ |
179 Private method to process the output of the shell. |
181 Private method to process the output of the shell. |
497 evt.accept() |
499 evt.accept() |
498 return |
500 return |
499 |
501 |
500 super().wheelEvent(evt) |
502 super().wheelEvent(evt) |
501 |
503 |
|
504 |
|
505 def event(self, evt): |
|
506 """ |
|
507 Protected method handling events. |
|
508 |
|
509 @param evt reference to the event (QEvent) |
|
510 @return flag indicating, if the event was handled (boolean) |
|
511 """ |
|
512 if evt.type() == QEvent.Gesture: |
|
513 self.gestureEvent(evt) |
|
514 return True |
|
515 |
|
516 return super().event(evt) |
|
517 |
|
518 def gestureEvent(self, evt): |
|
519 """ |
|
520 Protected method handling gesture events. |
|
521 |
|
522 @param evt reference to the gesture event (QGestureEvent |
|
523 """ |
|
524 pinch = evt.gesture(Qt.PinchGesture) |
|
525 if pinch: |
|
526 if pinch.state() == Qt.GestureStarted: |
|
527 zoom = (self.getZoom() + 10) / 10.0 |
|
528 pinch.setScaleFactor(zoom) |
|
529 else: |
|
530 zoom = int(pinch.scaleFactor() * 10) - 10 |
|
531 if zoom <= -9: |
|
532 zoom = -9 |
|
533 pinch.setScaleFactor(0.1) |
|
534 elif zoom >= 20: |
|
535 zoom = 20 |
|
536 pinch.setScaleFactor(3.0) |
|
537 self.zoomTo(zoom) |
|
538 evt.accept() |
502 def editorCommand(self, cmd): |
539 def editorCommand(self, cmd): |
503 """ |
540 """ |
504 Public method to perform an editor command. |
541 Public method to perform an editor command. |
505 |
542 |
506 @param cmd the scintilla command to be performed |
543 @param cmd the scintilla command to be performed |