eric6/QScintilla/Lexers/LexerProperties.py

changeset 6942
2602857055c5
parent 6874
5a3a39442711
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2005 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a Properties lexer with some additional methods.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.Qsci import QsciLexerProperties
13
14 from .Lexer import Lexer
15 import Preferences
16
17
18 class LexerProperties(Lexer, QsciLexerProperties):
19 """
20 Subclass to implement some additional lexer dependant methods.
21 """
22 def __init__(self, parent=None):
23 """
24 Constructor
25
26 @param parent parent widget of this lexer
27 """
28 QsciLexerProperties.__init__(self, parent)
29 Lexer.__init__(self)
30
31 self.commentString = "#"
32
33 self.keywordSetDescriptions = []
34
35 def initProperties(self):
36 """
37 Public slot to initialize the properties.
38 """
39 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
40 try:
41 self.setInitialSpaces(
42 Preferences.getEditor("PropertiesInitialSpaces"))
43 except AttributeError:
44 pass
45
46 def isCommentStyle(self, style):
47 """
48 Public method to check, if a style is a comment style.
49
50 @param style style to check (integer)
51 @return flag indicating a comment style (boolean)
52 """
53 return style in [QsciLexerProperties.Comment]
54
55 def isStringStyle(self, style):
56 """
57 Public method to check, if a style is a string style.
58
59 @param style style to check (integer)
60 @return flag indicating a string style (boolean)
61 """
62 return False
63
64 def defaultKeywords(self, kwSet):
65 """
66 Public method to get the default keywords.
67
68 @param kwSet number of the keyword set (integer)
69 @return string giving the keywords (string) or None
70 """
71 return QsciLexerProperties.keywords(self, kwSet)

eric ide

mercurial