17 |
17 |
18 class LexerProperties(Lexer, QsciLexerProperties): |
18 class LexerProperties(Lexer, QsciLexerProperties): |
19 """ |
19 """ |
20 Subclass to implement some additional lexer dependant methods. |
20 Subclass to implement some additional lexer dependant methods. |
21 """ |
21 """ |
|
22 |
22 def __init__(self, parent=None): |
23 def __init__(self, parent=None): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 |
26 |
26 @param parent parent widget of this lexer |
27 @param parent parent widget of this lexer |
27 """ |
28 """ |
28 QsciLexerProperties.__init__(self, parent) |
29 QsciLexerProperties.__init__(self, parent) |
29 Lexer.__init__(self) |
30 Lexer.__init__(self) |
30 |
31 |
31 self.commentString = "#" |
32 self.commentString = "#" |
32 |
33 |
33 self.keywordSetDescriptions = [] |
34 self.keywordSetDescriptions = [] |
34 |
35 |
35 def initProperties(self): |
36 def initProperties(self): |
36 """ |
37 """ |
37 Public slot to initialize the properties. |
38 Public slot to initialize the properties. |
38 """ |
39 """ |
39 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
40 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
40 with contextlib.suppress(AttributeError): |
41 with contextlib.suppress(AttributeError): |
41 self.setInitialSpaces( |
42 self.setInitialSpaces(Preferences.getEditor("PropertiesInitialSpaces")) |
42 Preferences.getEditor("PropertiesInitialSpaces")) |
43 |
43 |
|
44 def isCommentStyle(self, style): |
44 def isCommentStyle(self, style): |
45 """ |
45 """ |
46 Public method to check, if a style is a comment style. |
46 Public method to check, if a style is a comment style. |
47 |
47 |
48 @param style style to check (integer) |
48 @param style style to check (integer) |
49 @return flag indicating a comment style (boolean) |
49 @return flag indicating a comment style (boolean) |
50 """ |
50 """ |
51 return style in [QsciLexerProperties.Comment] |
51 return style in [QsciLexerProperties.Comment] |
52 |
52 |
53 def isStringStyle(self, style): |
53 def isStringStyle(self, style): |
54 """ |
54 """ |
55 Public method to check, if a style is a string style. |
55 Public method to check, if a style is a string style. |
56 |
56 |
57 @param style style to check (integer) |
57 @param style style to check (integer) |
58 @return flag indicating a string style (boolean) |
58 @return flag indicating a string style (boolean) |
59 """ |
59 """ |
60 return False |
60 return False |
61 |
61 |
62 def defaultKeywords(self, kwSet): |
62 def defaultKeywords(self, kwSet): |
63 """ |
63 """ |
64 Public method to get the default keywords. |
64 Public method to get the default keywords. |
65 |
65 |
66 @param kwSet number of the keyword set (integer) |
66 @param kwSet number of the keyword set (integer) |
67 @return string giving the keywords (string) or None |
67 @return string giving the keywords (string) or None |
68 """ |
68 """ |
69 return QsciLexerProperties.keywords(self, kwSet) |
69 return QsciLexerProperties.keywords(self, kwSet) |