Answer the question
In order to leave comments, you need to log in
How to completely cancel text highlighting before it starts?
There is a syntax selection menu. The user takes a file.ru from the explorer
and applies it, hoping that it is a file with syntax. It may be a different file.
Then you need to return the old syntax.
Now it looks like this:
try:
self. Highlighter = myHighlighter(doc, new_syntax)
except:
self. Highlighter = myHighlighter(doc, old_syntax)
class myHighlighter(QSyntaxHighlighter):
def __init__(self, doc, syntax):
QSyntaxHighlighter.__init__(self, doc)
self.rules_from_syntax(syntax)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question