On Tue, Aug 26, 2014 at 8:33 AM, 'Terry Brown' via leo-editor <[email protected]> wrote: > On Tue, 26 Aug 2014 05:04:59 -0700 (PDT) > "Edward K. Ream" <[email protected]> wrote: > >> The only solution is to transliterate QSyntaxHighlighter into Python! > > Which part of the job is QSyntaxHighlighter doing? Working out how to > color the text, or applying the colors to the text in the QTextEditor?
The latter. QSH doesn't do all that much, but what it does is tricky. Leo's own python code determines the colors to apply to the document. Eventually, all that computation comes down to calling QSH.setFormat on a range of text. > Because http://pygments.org/ is an option for the first part, although > maybe Leo already does the first part itself anyway? pygments is interesting, but it doesn't solve any of our problems :-) Most importantly, no matter what pygments produces, it would still have to interact with Qt *somehow*. In effect, the interface would be what I am going to develop: a Python version of QSH. Really, there is no way around the fundamental tasks that must be done: 1. Any syntax colorer must interact with QTextDocument (or equivalently, QTextEdit). That's what QSH.applyFormatChanges does. 2. Any syntax colorer must interact with Leo's existing state-oriented and pattern-oriented code. That's what QSH.reformatBlocks does. 3. We want our syntax colorer to divvy up work for idle time. That's what the new PQSH.reformatBlocks will do. 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 http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
