1
# -*- coding: utf-8 -*-
3
# Copyright (c) 2007 Detlev Offenbach <detlev@die-offenbachs.de>
7
Module implementing a base class for all typing completers.
9
Typing completers are classes that implement some convenience actions,
10
that are performed while the user is typing (e.g. insert ')' when the
14
from PyQt4.QtCore import QObject, SIGNAL
16
class CompleterBase(QObject):
18
Class implementing the base class for all completers.
20
def __init__(self, editor, parent = None):
24
@param editor reference to the editor object (QScintilla.Editor)
25
@param parent reference to the parent object (QObject)
26
If parent is None, we set the editor as the parent.
31
QObject.__init__(self, parent)
36
def setEnabled(self, enable):
38
Public slot to set the enabled state.
40
@param enabled flag indicating the new state (boolean)
44
self.connect(self.editor, SIGNAL("SCN_CHARADDED(int)"), self.charAdded)
47
self.disconnect(self.editor, SIGNAL("SCN_CHARADDED(int)"), self.charAdded)
50
def charAdded(self, charNumber):
52
Public slot called to handle the user entering a character.
54
Note 1: this slot must be overridden by subclasses implementing the
55
specific behavior for the language.
57
Note 2: charNumber can be greater than 255 because the editor is
58
in UTF-8 mode by default.
60
@param charNumber value of the character entered (integer)
62
pass # just do nothing
64
def readSettings(self):
66
Public slot called to reread the configuration parameters.
68
Note: this slot should be overridden by subclasses having
69
configurable parameters.
71
pass # just do nothing