~ubuntu-branches/ubuntu/karmic/eric/karmic

« back to all changes in this revision

Viewing changes to eric/QScintilla/QextScintillaCompat.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-01-28 18:02:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080128180225-6nrox6yrworh2c4v
Tags: 4.0.4-1ubuntu1
* Add python-qt3 to build-depends becuase that's where Ubuntu puts 
  pyqtconfig
* Change maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
 
3
 
# Copyright (c) 2004 - 2007 Detlev Offenbach <detlev@die-offenbachs.de>
4
 
#
5
 
 
6
 
"""
7
 
Module implementing a compatability interface class to QextScintilla.
8
 
"""
9
 
 
10
 
import sys
11
 
 
12
 
from qt import Qt, QKeyEvent, QEvent, qApp, SIGNAL
13
 
from qtext import QextScintilla, \
14
 
    QSCINTILLA_VERSION as QextQSCINTILLA_VERSION, QSCINTILLA_VERSION_STR
15
 
 
16
 
 
17
 
#####################################################################################
18
 
# enums below have been added to QScintilla starting with version after 1.6
19
 
#####################################################################################
20
 
    
21
 
if "WrapFlagNone" not in QextScintilla.__dict__:
22
 
    QextScintilla.WrapFlagNone = 0
23
 
    QextScintilla.WrapFlagByText = 1
24
 
    QextScintilla.WrapFlagByBorder = 2
25
 
    
26
 
if "AcsAll" not in QextScintilla.__dict__:
27
 
    QextScintilla.AcsAll = QextScintilla.AcsDocument
28
 
    # identical to AcsDocument for older QScintilla versions
29
 
 
30
 
#####################################################################################
31
 
 
32
 
def QSCINTILLA_VERSION():
33
 
    """
34
 
    Module function to return the QScintilla version.
35
 
    
36
 
    If the installed QScintilla is a snapshot version, then assume it is
37
 
    of the latest release and return a version number of 0x99999.
38
 
    
39
 
    @return QScintilla version (integer)
40
 
    """
41
 
    if QSCINTILLA_VERSION_STR.startswith('snapshot') or \
42
 
       QSCINTILLA_VERSION_STR.startswith('1-snapshot'):
43
 
        return 0x99999
44
 
    else:
45
 
        return QextQSCINTILLA_VERSION
46
 
    
47
 
#####################################################################################
48
 
 
49
 
class QextScintillaCompat(QextScintilla):
50
 
    """
51
 
    Class implementing a compatability interface to QextScintilla.
52
 
    
53
 
    This class implements all the functions, that were added to
54
 
    QextScintilla incrementally. This class ensures compatibility
55
 
    to older versions of QextScintilla.
56
 
    """
57
 
    def __init__(self, parent=None, name=None, flags=0):
58
 
        """
59
 
        Constructor
60
 
        
61
 
        @param parent parent widget (QWidget)
62
 
        @param name name of this instance (string or QString)
63
 
        @param flags window flags
64
 
        """
65
 
        QextScintilla.__init__(self, parent, name, flags)
66
 
        self.zoom = 0
67
 
        
68
 
        # compatibility code for QScintilla < 1.7
69
 
        if QSCINTILLA_VERSION < 0x010700:
70
 
            self.autoCompleteFromAll = self.autoCompleteFromDocument
71
 
        
72
 
        # workaround for a bug in version <= 1.5.1
73
 
        self._modified = 0
74
 
        self.connect(self, SIGNAL('modificationChanged(bool)'), 
75
 
                    self._handleModificationChanged)
76
 
        
77
 
        # workaround for an initialization bug in version <= 1.4
78
 
        self.clearStyles()
79
 
    
80
 
    # workaround for a bug in version <= 1.5.1
81
 
    def _handleModificationChanged(self, m):
82
 
        """
83
 
        Private slot to handle the modificationChanged signal. 
84
 
        
85
 
        It emits the signal modificationStatusChanged with parameters
86
 
        m and self.
87
 
        
88
 
        @param m modification status
89
 
        """
90
 
        self._modified = m
91
 
        
92
 
    def isModified(self):
93
 
        """
94
 
        Public method to retrieve the modification status.
95
 
        
96
 
        @return flag indicating the modification status (boolean)
97
 
        """
98
 
        return self._modified
99
 
        
100
 
    def setModified(self, m):
101
 
        """
102
 
        Public method to set the modification status.
103
 
        
104
 
        @param m flag indicating the new modification status
105
 
        """
106
 
        self._modified = m
107
 
        QextScintilla.setModified(self, m)
108
 
    
109
 
    # workaround for a bug in setLexer() in version <= 1.4
110
 
    def setLexer(self, lex = None):
111
 
        """
112
 
        Public method to set the lexer.
113
 
        
114
 
        @param lex the lexer to be set or None to reset it.
115
 
        """
116
 
        QextScintilla.setLexer(self, lex)
117
 
        if lex is None:
118
 
            self.clearStyles()
119
 
        
120
 
    def clearStyles(self):
121
 
        """
122
 
        Public method to set the styles according the selected Qt style.
123
 
        """
124
 
        colorGroup = qApp.palette().active()
125
 
        self.SendScintilla(QextScintilla.SCI_STYLESETFORE,
126
 
            QextScintilla.STYLE_DEFAULT, colorGroup.text())
127
 
        self.SendScintilla(QextScintilla.SCI_STYLESETBACK,
128
 
            QextScintilla.STYLE_DEFAULT, colorGroup.base())
129
 
        self.SendScintilla(QextScintilla.SCI_STYLECLEARALL)
130
 
        self.SendScintilla(QextScintilla.SCI_CLEARDOCUMENTSTYLE)
131
 
        
132
 
        self.setMarginsForegroundColor(colorGroup.foreground())
133
 
        self.setMarginsBackgroundColor(colorGroup.background())
134
 
        self.setFoldMarginColors(colorGroup.mid(),
135
 
                                 colorGroup.mid())
136
 
        
137
 
    def monospacedStyles(self, font):
138
 
        """
139
 
        Public method to set the current style to be monospaced.
140
 
        
141
 
        @param font font to be used (QFont)
142
 
        """
143
 
        try:
144
 
            rangeLow = range(self.STYLE_DEFAULT)
145
 
        except AttributeError:
146
 
            rangeLow = range(32)
147
 
        try:
148
 
            rangeHigh = range(self.STYLE_LASTPREDEFINED + 1,
149
 
                              self.STYLE_MAX + 1)
150
 
        except AttributeError:
151
 
            rangeHigh = range(40, 128)
152
 
            
153
 
        f = font.family().latin1()
154
 
        ps = font.pointSize()
155
 
        for style in rangeLow + rangeHigh:
156
 
            self.SendScintilla(QextScintilla.SCI_STYLESETFONT, style, f)
157
 
            self.SendScintilla(QextScintilla.SCI_STYLESETSIZE, style, ps)
158
 
        
159
 
    def lineAt(self, pos):
160
 
        """
161
 
        Public method to calculate the line at a position.
162
 
        
163
 
        This variant is able to calculate the line for positions in the
164
 
        margins and for empty lines.
165
 
        
166
 
        @param pos position to calculate the line for (QPoint)
167
 
        @return linenumber at position or -1, if there is no line at pos
168
 
            (integer, zero based)
169
 
        """
170
 
        scipos = self.SendScintilla(QextScintilla.SCI_POSITIONFROMPOINT, pos.x(), pos.y())
171
 
        line = self.SendScintilla(QextScintilla.SCI_LINEFROMPOSITION, scipos)
172
 
        if line >= self.lines():
173
 
            line = -1
174
 
        return line
175
 
    
176
 
    #####################################################################################
177
 
    # methods below are missing from QScintilla
178
 
    #####################################################################################
179
 
 
180
 
    def zoomIn(self, zoom = 1):
181
 
        """
182
 
        Public method used to increase the zoom factor.
183
 
        
184
 
        @param zoom zoom factor increment
185
 
        """
186
 
        self.zoom += zoom
187
 
        QextScintilla.zoomIn(self, zoom)
188
 
        
189
 
    def zoomOut(self, zoom = 1):
190
 
        """
191
 
        Public method used to decrease the zoom factor.
192
 
        
193
 
        @param zoom zoom factor decrement
194
 
        """
195
 
        self.zoom -= zoom
196
 
        QextScintilla.zoomOut(self, zoom)
197
 
        
198
 
    def zoomTo(self, zoom):
199
 
        """
200
 
        Public method used to zoom to a specific zoom factor.
201
 
        
202
 
        @param zoom zoom factor
203
 
        """
204
 
        self.zoom = zoom
205
 
        QextScintilla.zoomTo(self, zoom)
206
 
        
207
 
    def getZoom(self):
208
 
        """
209
 
        Public method used to retrieve the current zoom factor.
210
 
        
211
 
        @return zoom factor (int)
212
 
        """
213
 
        return self.zoom
214
 
        
215
 
    def editorCommand(self, cmd):
216
 
        """
217
 
        Public method to perform a simple editor command.
218
 
        
219
 
        @param cmd the scintilla command to be performed
220
 
        """
221
 
        self.SendScintilla(cmd)
222
 
        
223
 
    def scrollVertical(self, lines):
224
 
        """
225
 
        Public method to scroll the text area.
226
 
        
227
 
        @param lines number of lines to scroll (negative scrolls up,
228
 
            positive scrolls down) (integer)
229
 
        """
230
 
        self.SendScintilla(QextScintilla.SCI_LINESCROLL, 0, lines)
231
 
        
232
 
    def moveCursorToEOL(self):
233
 
        """
234
 
        Public method to move the cursor to the end of line.
235
 
        """
236
 
        self.SendScintilla(QextScintilla.SCI_LINEEND)
237
 
        
238
 
    def moveCursorLeft(self):
239
 
        """
240
 
        Public method to move the cursor left.
241
 
        """
242
 
        self.SendScintilla(QextScintilla.SCI_CHARLEFT)
243
 
        
244
 
    def moveCursorRight(self):
245
 
        """
246
 
        Public method to move the cursor right.
247
 
        """
248
 
        self.SendScintilla(QextScintilla.SCI_CHARRIGHT)
249
 
        
250
 
    def moveCursorWordLeft(self):
251
 
        """
252
 
        Public method to move the cursor left one word.
253
 
        """
254
 
        self.SendScintilla(QextScintilla.SCI_WORDLEFT)
255
 
        
256
 
    def moveCursorWordRight(self):
257
 
        """
258
 
        Public method to move the cursor right one word.
259
 
        """
260
 
        self.SendScintilla(QextScintilla.SCI_WORDRIGHT)
261
 
        
262
 
    def deleteBack(self):
263
 
        """
264
 
        Public method to delete the character to the left of the cursor.
265
 
        """
266
 
        self.SendScintilla(QextScintilla.SCI_DELETEBACK)
267
 
        
268
 
    def delete(self):
269
 
        """
270
 
        Public method to delete the character to the right of the cursor.
271
 
        """
272
 
        self.SendScintilla(QextScintilla.SCI_CLEAR)
273
 
        
274
 
    def deleteWordLeft(self):
275
 
        """
276
 
        Public method to delete the word to the left of the cursor.
277
 
        """
278
 
        self.SendScintilla(QextScintilla.SCI_DELWORDLEFT)
279
 
        
280
 
    def deleteWordRight(self):
281
 
        """
282
 
        Public method to delete the word to the right of the cursor.
283
 
        """
284
 
        self.SendScintilla(QextScintilla.SCI_DELWORDRIGHT)
285
 
        
286
 
    def deleteLineLeft(self):
287
 
        """
288
 
        Public method to delete the line to the left of the cursor.
289
 
        """
290
 
        self.SendScintilla(QextScintilla.SCI_DELLINELEFT)
291
 
        
292
 
    def deleteLineRight(self):
293
 
        """
294
 
        Public method to delete the line to the right of the cursor.
295
 
        """
296
 
        self.SendScintilla(QextScintilla.SCI_DELLINERIGHT)
297
 
        
298
 
    def extendSelectionLeft(self):
299
 
        """
300
 
        Public method to extend the selection one character to the left.
301
 
        """
302
 
        self.SendScintilla(QextScintilla.SCI_CHARLEFTEXTEND)
303
 
        
304
 
    def extendSelectionRight(self):
305
 
        """
306
 
        Public method to extend the selection one character to the right.
307
 
        """
308
 
        self.SendScintilla(QextScintilla.SCI_CHARRIGHTEXTEND)
309
 
        
310
 
    def extendSelectionWordLeft(self):
311
 
        """
312
 
        Public method to extend the selection one word to the left.
313
 
        """
314
 
        self.SendScintilla(QextScintilla.SCI_WORDLEFTEXTEND)
315
 
        
316
 
    def extendSelectionWordRight(self):
317
 
        """
318
 
        Public method to extend the selection one word to the right.
319
 
        """
320
 
        self.SendScintilla(QextScintilla.SCI_WORDRIGHTEXTEND)
321
 
        
322
 
    def extendSelectionToBOL(self):
323
 
        """
324
 
        Public method to extend the selection to the beginning of the line.
325
 
        """
326
 
        self.SendScintilla(QextScintilla.SCI_VCHOMEEXTEND)
327
 
        
328
 
    def extendSelectionToEOL(self):
329
 
        """
330
 
        Public method to extend the selection to the end of the line.
331
 
        """
332
 
        self.SendScintilla(QextScintilla.SCI_LINEENDEXTEND)
333
 
    
334
 
    #####################################################################################
335
 
    # methods below have been added to QScintilla starting with version after 1.6
336
 
    #####################################################################################
337
 
    
338
 
    if "setAutoCompletionFillupsEnabled" not in QextScintilla.__dict__:
339
 
        def setAutoCompletionFillupsEnabled(self, on):
340
 
            """
341
 
            Public method to enable the use of autocompletion fillup characters.
342
 
            
343
 
            @param on flag indicating the usage of autocompletion fillup 
344
 
                characters (boolean)
345
 
            """
346
 
            if on:
347
 
                self.setAutoCompletionFillups("(")
348
 
            else:
349
 
                self.setAutoCompletionFillups("")
350
 
        
351
 
    if "isCalltipActive" not in QextScintilla.__dict__:
352
 
        def isCallTipActive(self):
353
 
            """
354
 
            Public method to check, if a call tip is active.
355
 
            
356
 
            @return flag indicating call tip active state (boolean)
357
 
            """
358
 
            return self.SendScintilla(QextScintilla.SCI_CALLTIPACTIVE)
359
 
        
360
 
    if "isListActive" not in QextScintilla.__dict__:
361
 
        def isListActive(self):
362
 
            """
363
 
            Public method to check, if autocompletion or user-defined list is active.
364
 
            
365
 
            @return flag indicating autocompletion active state (boolean)
366
 
            """
367
 
            return self.SendScintilla(QextScintilla.SCI_AUTOCACTIVE)
368
 
        
369
 
    if "cancelList" not in QextScintilla.__dict__:
370
 
        def cancelList(self):
371
 
            """
372
 
            Public method to cancel autocompletion list or user-defined list.
373
 
            """
374
 
            self.SendScintilla(QextScintilla.SCI_AUTOCCANCEL)
375
 
        
376
 
    if "showUserList" not in QextScintilla.__dict__:
377
 
        def showUserList(self, id, userlist):
378
 
            """
379
 
            Public method to show a user list.
380
 
            
381
 
            @param id id of the list to be shown (integer)
382
 
            @param userlist list of items to be shown (QStringList)
383
 
            """
384
 
            if id <= 0:
385
 
                return
386
 
            
387
 
            liststring = str(userlist.join(' '))
388
 
            self.SendScintilla(QextScintilla.SCI_USERLISTSHOW, id, liststring)
389
 
        
390
 
    if "firstVisibleLine" not in QextScintilla.__dict__:
391
 
        def firstVisibleLine(self):
392
 
            """
393
 
            Public method to get the line number of the first visible line.
394
 
            
395
 
            @return number of the first visible line (integer)
396
 
            """
397
 
            return self.SendScintilla(QextScintilla.SCI_GETFIRSTVISIBLELINE)
398
 
        
399
 
    if "textHeight" not in QextScintilla.__dict__:
400
 
        def textHeight(self, linenr):
401
 
            """
402
 
            Public method to get the text height of a line.
403
 
            
404
 
            @param linenr number of the line (integer)
405
 
            @return text height (integer)
406
 
            """
407
 
            return self.SendScintilla(QextScintilla.SCI_TEXTHEIGHT, linenr)
408
 
        
409
 
    if "setWrapVisualFlags" not in QextScintilla.__dict__:
410
 
        def setWrapVisualFlags(self, eflag, sflag = QextScintilla.WrapFlagNone,
411
 
            sindent = 0):
412
 
            """
413
 
            Public method to set the visual flags for wrapped lines.
414
 
            
415
 
            @param eflag determines if and where the flag at the end of a line
416
 
                is displayed
417
 
            @param sflag determines if and where the flag at the start of a line
418
 
                is displayed
419
 
            @param sindent is the number of characters a wrapped line is indented by
420
 
            """
421
 
            flags = QextScintilla.SC_WRAPVISUALFLAG_NONE
422
 
            loc = QextScintilla.SC_WRAPVISUALFLAGLOC_DEFAULT
423
 
            
424
 
            if eflag == QextScintilla.WrapFlagByText:
425
 
                flags |= QextScintilla.SC_WRAPVISUALFLAG_END
426
 
                loc |= QextScintilla.SC_WRAPVISUALFLAGLOC_END_BY_TEXT
427
 
            elif eflag == QextScintilla.WrapFlagByBorder:
428
 
                flags |= QextScintilla.SC_WRAPVISUALFLAG_END
429
 
            
430
 
            if sflag == QextScintilla.WrapFlagByText:
431
 
                flags |= QextScintilla.SC_WRAPVISUALFLAG_START
432
 
                loc |= QextScintilla.SC_WRAPVISUALFLAGLOC_START_BY_TEXT
433
 
            elif sflag == QextScintilla.WrapFlagByBorder:
434
 
                flags |= QextScintilla.SC_WRAPVISUALFLAG_START
435
 
            
436
 
            self.SendScintilla(QextScintilla.SCI_SETWRAPVISUALFLAGS, flags)
437
 
            self.SendScintilla(QextScintilla.SCI_SETWRAPVISUALFLAGSLOCATION, loc)
438
 
            self.SendScintilla(QextScintilla.SCI_SETWRAPSTARTINDENT, sindent)
439
 
            
440
 
        def setLayoutCache(self, cacheMode):
441
 
            """
442
 
            Public method to set the layout cache mode.
443
 
            
444
 
            @param cacheMode layout cache mode to be set
445
 
            """
446
 
            self.SendScintilla(QextScintilla.SCI_SETLAYOUTCACHE, cacheMode)
447
 
    else:
448
 
        def setLayoutCache(self, cacheMode):
449
 
            """
450
 
            Public method to set the layout cache mode.
451
 
            
452
 
            @param cacheMode layout cache mode to be set
453
 
            """
454
 
            # do nothing, it is handled by QextScintilla
455
 
            pass
456
 
    
457
 
    #####################################################################################
458
 
    # methods below have been added to QScintilla starting with version after 1.3
459
 
    #####################################################################################
460
 
    
461
 
    if "setEdgeMode" not in QextScintilla.__dict__:
462
 
        def setEdgeMode(self, edgeMode):
463
 
            """
464
 
            Public method to set the edge mode.
465
 
            
466
 
            @param edgeMode mode to be set
467
 
            """
468
 
            self.SendScintilla(QextScintilla.SCI_SETEDGEMODE, edgeMode)
469
 
        
470
 
    if "setEdgeColumn" not in QextScintilla.__dict__:
471
 
        def setEdgeColumn(self, column):
472
 
            """
473
 
            Public method to set the edge column.
474
 
            
475
 
            @param column column number to be set for the edge mode (integer)
476
 
            """
477
 
            self.SendScintilla(QextScintilla.SCI_SETEDGECOLUMN, column)
478
 
        
479
 
    if "setEdgeColor" not in QextScintilla.__dict__:
480
 
        def setEdgeColor(self, colour):
481
 
            """
482
 
            Public method to set the color of the edge mode highlight.
483
 
            
484
 
            @param colour colour to be set (QColor)
485
 
            """
486
 
            self.SendScintilla(QextScintilla.SCI_SETEDGECOLOUR, colour)
487
 
        
488
 
    if "setWrapMode" not in QextScintilla.__dict__:
489
 
        def setWrapMode(self, mode):
490
 
            """
491
 
            Public slot to set the wrap mode of the text display.
492
 
            
493
 
            @param mode wrap mode (QextScintilla.WrapNone or
494
 
                QextScintilla.WrapWord)
495
 
            """
496
 
            self.SendScintilla(QextScintilla.SCI_SETWRAPMODE, mode)
497
 
        
498
 
    if "resetSelectionForegroundColor" not in QextScintilla.__dict__:
499
 
        def resetSelectionForegroundColor(self):
500
 
            """
501
 
            Public method to reset the foreground color of the selection.
502
 
            """
503
 
            self.SendScintilla(QextScintilla.SCI_SETSELFORE, 0)
504
 
        
505
 
        # compatibility method to correct a bug under win32
506
 
        if sys.platform == "win32":
507
 
            def keyPressEvent(self, event):
508
 
                """
509
 
                Workaround for QScintilla <= 1.3 bug w/ keyboard layouts 
510
 
                having a AltGr key in win32: 
511
 
                AltGr is reported as state == Qt.ControlButton | Qt.AltButton,
512
 
                but QScintilla expects (Unix-style) Qt.MetaButton. Just 
513
 
                translate states for infected QScintilla versions.
514
 
                
515
 
                Reimplemented from QextScintilla.keyPressEvent
516
 
                
517
 
                @param event reference to the key press event (QKeyEvent)
518
 
                @author Torsten Marek, 2004-08-22
519
 
                """
520
 
                if event.state() == Qt.AltButton | Qt.ControlButton:
521
 
                    newevent = QKeyEvent(QEvent.KeyPress,
522
 
                                         event.key(),
523
 
                                         event.ascii(),
524
 
                                         Qt.MetaButton,
525
 
                                         event.text())
526
 
                    event = newevent
527
 
                QextScintilla.keyPressEvent(self, event)
528
 
 
529
 
    #####################################################################################
530
 
    # methods below have been added to QScintilla starting with version after 1.2
531
 
    #####################################################################################
532
 
    
533
 
    if "setSelectionBackgroundColor" not in QextScintilla.__dict__:
534
 
        def setSelectionBackgroundColor(self, colour):
535
 
            """
536
 
            Public method to set the background color of the selection.
537
 
            
538
 
            @param colour colour to be set (QColor)
539
 
            """
540
 
            self.SendScintilla(QextScintilla.SCI_SETSELBACK, 1, colour)
541
 
        
542
 
    if "setSelectionForegroundColor" not in QextScintilla.__dict__:
543
 
        def setSelectionForegroundColor(self, colour):
544
 
            """
545
 
            Public method to set the foreground color of the selection.
546
 
            
547
 
            @param colour colour to be set (QColor)
548
 
            """
549
 
            self.SendScintilla(QextScintilla.SCI_SETSELFORE, 1, colour)
550
 
        
551
 
    if "setCaretForegroundColor" not in QextScintilla.__dict__:
552
 
        def setCaretForegroundColor(self, colour):
553
 
            """
554
 
            Public method to set the foreground color of the caret.
555
 
            
556
 
            @param colour colour to be set (QColor)
557
 
            """
558
 
            self.SendScintilla(QextScintilla.SCI_SETCARETFORE, colour)
559
 
        
560
 
    if "setCaretLineBackgroundColor" not in QextScintilla.__dict__:
561
 
        def setCaretLineBackgroundColor(self, colour):
562
 
            """
563
 
            Public method to set the background color of the caret line.
564
 
            
565
 
            @param colour colour to be set (QColor)
566
 
            """
567
 
            self.SendScintilla(QextScintilla.SCI_SETCARETLINEBACK, colour)
568
 
        
569
 
    if "setCaretLineVisible" not in QextScintilla.__dict__:
570
 
        def setCaretLineVisible(self, enable):
571
 
            """
572
 
            Public method to enable the highlighting of the caret line.
573
 
            
574
 
            @param enable flag indicating the highlighting state to be set (boolean)
575
 
            """
576
 
            self.SendScintilla(QextScintilla.SCI_SETCARETLINEVISIBLE, enable)
577
 
        
578
 
    if "setCaretWidth" not in QextScintilla.__dict__:
579
 
        def setCaretWidth(self, width):
580
 
            """
581
 
            Public method to enable the highlighting of the caret line.
582
 
            
583
 
            @param width width of the caret (integer - 0, 1, 2 or 3)
584
 
            """
585
 
            if width < 0:
586
 
                width = 0
587
 
            elif width > 3:
588
 
                width = 3
589
 
            self.SendScintilla(QextScintilla.SCI_SETCARETWIDTH, width)
590
 
        
591
 
    if "recolor" not in QextScintilla.__dict__:
592
 
        def recolor(self, start = 0, end = -1):
593
 
            """
594
 
            Public method to recolor the given region.
595
 
            
596
 
            @param start linenumber where to start recolourisation (integer)
597
 
            @param end linenumber where to end recolourisation (integer)
598
 
            """
599
 
            self.SendScintilla(QextScintilla.SCI_COLOURISE, start, end)
600
 
 
601
 
    #####################################################################################
602
 
    # interface methods to the standard keyboard command set
603
 
    #####################################################################################
604
 
    
605
 
    def clearAlternateKeys(self):
606
 
        """
607
 
        Protected method to clear the alternate key commands.
608
 
        """
609
 
        if "clearAlternateKeys" not in self.standardCommands().__dict__:
610
 
            # clear each alternate key for QScintilla versions <= 1.3
611
 
            for cmd in self.standardCommands().commands():
612
 
                cmd.setAlternateKey(0)
613
 
        else:
614
 
            # call into the QextScintillaCommandSet
615
 
            self.standardCommands().clearAlternateKeys()