[PyQt] Probleme with the metho description of QSciScintlla

projetmbc projetmbc at club-internet.fr
Thu Jun 25 19:13:00 BST 2009


Phil Thompson a écrit :
> On Mon, 15 Jun 2009 19:02:58 +0200, projetmbc <projetmbc at club-internet.fr>
> wrote:
>   
>> Hello,
>> I'm always trying to make my own lexer but I don't have enough 
>> informtaion to start easily.
>>
>> I have to implement some methods but what have I to do with the method 
>> description.
>>     
>
> What part of...
>
> http://www.riverbankcomputing.com/static/Docs/QScintilla2/classQsciLexer.html#dd9c20adb43bc38d1a0ca3083ac3e6fa
>
> ...is causing you a problem?
>
> Phil
>   
A lot of questions about the documentation...

    * Am I right if I define my own lexer by the following way ?

=========================================
class myLexer(Qsci.QsciLexerCustom):
# Struggle for a lexer.
    def description(self, style):
        .........
    def styleText(self, start, end):
        .........
    def setStyling(self, lenght):
        .........
    def startStyling(self, pos):
        .........

class myApplication(QtGui.QMainWindow, Ui_window):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        Ui_window_LecteurCodePython_HTML.__init__(self)
        self.setupUi(self)
        self.textScintilla_Principal.setLexer(myLexer())
    .........
=========================================

    * The method styleText works line by line. Is it right ? How can we
      read the characters of the line so as to analyse them ? What is
      the self.method to use ?
    * When a word is detected, is its highlighting made by doing
      something like ?

=========================================
    def styleText(self, start, end):
        .........
        self.startStyling(posOfTheFisrtCharacterOfTheWord)
        self.setStyling(lenghtOfTheWord)
        .........
=========================================

    * This near to be the last question is to know how to acess to the
      color and the font properties of a character.
    * Is there some signal to do or not ? Have we have acces to some
      signal to know that something has been highlighted ?

Best regards.
Christophe who feels like a galley slave...  :-)



More information about the PyQt mailing list