QScintilla/QsciScintillaCompat.py

branch
Py2 comp.
changeset 2525
8b507a9a2d40
parent 2472
4860fe0ed4a6
child 2538
b2642e7a4c18
equal deleted inserted replaced
2523:139f182b72f6 2525:8b507a9a2d40
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a compatability interface class to QsciScintilla. 7 Module implementing a compatability interface class to QsciScintilla.
8 """ 8 """
9
10 from __future__ import unicode_literals # __IGNORE_WARNING__
9 11
10 from PyQt4.QtCore import pyqtSignal, Qt 12 from PyQt4.QtCore import pyqtSignal, Qt
11 from PyQt4.QtGui import QPalette, QColor, QApplication 13 from PyQt4.QtGui import QPalette, QColor, QApplication
12 from PyQt4.Qsci import QsciScintilla, \ 14 from PyQt4.Qsci import QsciScintilla, \
13 QSCINTILLA_VERSION as QsciQSCINTILLA_VERSION, QSCINTILLA_VERSION_STR, \ 15 QSCINTILLA_VERSION as QsciQSCINTILLA_VERSION, QSCINTILLA_VERSION_STR, \
56 58
57 @param parent parent widget (QWidget) 59 @param parent parent widget (QWidget)
58 @param name name of this instance (string) 60 @param name name of this instance (string)
59 @param flags window flags 61 @param flags window flags
60 """ 62 """
61 super().__init__(parent) 63 super(QsciScintillaCompat, self).__init__(parent)
62 64
63 self.zoom = 0 65 self.zoom = 0
64 66
65 self.__targetSearchFlags = 0 67 self.__targetSearchFlags = 0
66 self.__targetSearchExpr = "" 68 self.__targetSearchExpr = ""
72 """ 74 """
73 Public method to set the lexer. 75 Public method to set the lexer.
74 76
75 @param lex the lexer to be set or None to reset it. 77 @param lex the lexer to be set or None to reset it.
76 """ 78 """
77 super().setLexer(lex) 79 super(QsciScintillaCompat, self).setLexer(lex)
78 if lex is None: 80 if lex is None:
79 self.clearStyles() 81 self.clearStyles()
80 82
81 def clearStyles(self): 83 def clearStyles(self):
82 """ 84 """
314 """ 316 """
315 Public method used to increase the zoom factor. 317 Public method used to increase the zoom factor.
316 318
317 @param zoom zoom factor increment (integer) 319 @param zoom zoom factor increment (integer)
318 """ 320 """
319 super().zoomIn(zoom) 321 super(QsciScintillaCompat, self).zoomIn(zoom)
320 322
321 def zoomOut(self, zoom=1): 323 def zoomOut(self, zoom=1):
322 """ 324 """
323 Public method used to decrease the zoom factor. 325 Public method used to decrease the zoom factor.
324 326
325 @param zoom zoom factor decrement (integer) 327 @param zoom zoom factor decrement (integer)
326 """ 328 """
327 super().zoomOut(zoom) 329 super(QsciScintillaCompat, self).zoomOut(zoom)
328 330
329 def zoomTo(self, zoom): 331 def zoomTo(self, zoom):
330 """ 332 """
331 Public method used to zoom to a specific zoom factor. 333 Public method used to zoom to a specific zoom factor.
332 334
333 @param zoom zoom factor (integer) 335 @param zoom zoom factor (integer)
334 """ 336 """
335 self.zoom = zoom 337 self.zoom = zoom
336 super().zoomTo(zoom) 338 super(QsciScintillaCompat, self).zoomTo(zoom)
337 self.zoomValueChanged.emit(self.zoom) 339 self.zoomValueChanged.emit(self.zoom)
338 340
339 def getZoom(self): 341 def getZoom(self):
340 """ 342 """
341 Public method used to retrieve the current zoom factor. 343 Public method used to retrieve the current zoom factor.
886 888
887 @param style folding style to set (integer) 889 @param style folding style to set (integer)
888 @param margin margin number (integer) 890 @param margin margin number (integer)
889 """ 891 """
890 if style < self.ArrowFoldStyle: 892 if style < self.ArrowFoldStyle:
891 super().setFolding(style, margin) 893 super(QsciScintillaCompat, self).setFolding(style, margin)
892 else: 894 else:
893 super().setFolding( 895 super(QsciScintillaCompat, self).setFolding(
894 QsciScintilla.PlainFoldStyle, margin) 896 QsciScintilla.PlainFoldStyle, margin)
895 897
896 if style == self.ArrowFoldStyle: 898 if style == self.ArrowFoldStyle:
897 self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDER, 899 self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDER,
898 QsciScintilla.SC_MARK_ARROW) 900 QsciScintilla.SC_MARK_ARROW)
992 @param event event object (QFocusEvent) 994 @param event event object (QFocusEvent)
993 """ 995 """
994 if self.isListActive(): 996 if self.isListActive():
995 self.cancelList() 997 self.cancelList()
996 998
997 super().focusOutEvent(event) 999 super(QsciScintillaCompat, self).focusOutEvent(event)
998 1000
999 def event(self, evt): 1001 def event(self, evt):
1000 """ 1002 """
1001 Protected method to handle events. 1003 Protected method to handle events.
1002 1004

eric ide

mercurial