On Friday, January 27, 2017 at 11:26:25 AM UTC-6, Edward K. Ream wrote: The LeoQtColorizer class is collapsing in complexity. It might disappear > entirely! >
Done in the color branch. *tl;dr:* The QScintilla colorizer works! See the summary for details. The LeoQtColorizer has been folded into the JEditColorizer class as follows: - The BaseColorizer class now contains updateSyntaxColorer and its helpers. Leo's core calls updateSyntaxColorer in various places. This won't change. - The confusing ColorizerMixin class is gone. - All colorizer classes now derive from BaseColorizer. - The confusing colorizer.color ivar (redirection) is gone. - As a result, the JEditColorizer init logic is quite a bit simpler. Leo's core has changed as follows: - Removed several no-longer-needed hooks in Leo's core. - The JEditColorizer class no longer has a colorize method(!) - Calls *to* colorizer.colorize still exist in Leo's core, protected by hasattr. These calls support the Scintilla colorizer, which is fully operational, but... *Alas, QsciDocument is not a QTextDocument* And not even close. So it's not possible to attach a QSyntaxHighlighter to a QScintilla widget. As a result, Leo's QScintilla widget uses *scintilla's* lexers, not Leo's colorizers. It *might* be possible to create an adapter class that is a subclass of *both* QsciDocument and QTextDocument. But not likely. The net is saying it can't be done. QsciDocument probably receives nothing like the events that QTextDocument needs. Previous attempts at providing a custom python lexer (the PythonLexer class) failed because there was no way to force a recolor. But this was before stack overflow :-) I'll look into this just a bit more. Still, what we *really *want is the oh-so-good JEditColorizer class. In short, using Leo's colorizers on QScintilla widgets is a longshot. We are likely stuck using QScintilla's lexers, *maybe* customized for Leo. *Summary*- The code in leoColorizer.py is now much cleaner. - Various hooks in Leo's core have been eliminated or simplified. - Leo's QScintilla widget works, using *scintilla's* lexers, not Leo's colorizers. Alas, this state of affairs is not likely to change. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
