From 7a6f5b2c1d83fe62c62f0c30cad28eb091d52dfe Mon Sep 17 00:00:00 2001 From: necoro <> Date: Fri, 20 Apr 2007 14:44:45 +0000 Subject: Made qt plugin-ready; lots of documentation --- portato/gui/qt/highlighter.py | 74 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 8 deletions(-) (limited to 'portato/gui/qt/highlighter.py') diff --git a/portato/gui/qt/highlighter.py b/portato/gui/qt/highlighter.py index 5572930..74d9ac9 100644 --- a/portato/gui/qt/highlighter.py +++ b/portato/gui/qt/highlighter.py @@ -19,30 +19,59 @@ from portato.helper import debug import re # prefer Python-Module over Qt-one class EbuildHighlighter (Qt.QSyntaxHighlighter): + """A QSyntaxHighlighter implementation for the use with ebuild-syntax.""" NORMAL_STATE = 0 STRING_STATE = 1 def __init__ (self, edit): + """Constructor. + + @param edit: the EditWidget to use the highlighter with + @type edit: Qt.QTextEdit""" + Qt.QSyntaxHighlighter.__init__(self, edit) + # + # the regular expressions ... *muahahaha* + # + + # comments self.comment = self.__create(r'#.*', color = "steelblue", italic = True) + + # bash variables self.bashVar = self.__create(r'(\$\{.+?\})|(\$\w+)', color = "green") + # a string + self.string = self.__create(r'(?