Preferences/PreferencesLexer.py

branch
sub_styles
changeset 6854
f4dd76230eea
parent 6853
0922aa829e5e
child 6855
4d80c8cc99a1
equal deleted inserted replaced
6853:0922aa829e5e 6854:f4dd76230eea
93 import QScintilla.Lexers 93 import QScintilla.Lexers
94 self.__lex = QScintilla.Lexers.getLexer(language) 94 self.__lex = QScintilla.Lexers.getLexer(language)
95 if self.__lex is None: 95 if self.__lex is None:
96 raise PreferencesLexerLanguageError(language) 96 raise PreferencesLexerLanguageError(language)
97 97
98 # TODO: get rid of 'styles' and 'ind2style' 98 # read the last stored values from preferences file
99 # define the local store 99 self.__lex.readSettings(Preferences.Prefs.settings, "Scintilla")
100 self.ind2style = {} 100 # TODO: add substyles
101 self.styles = [] 101
102 index = 0 102 def writeSettings(self):
103 """
104 Public method to write the lexer settings.
105 """
106 self.__lex.writeSettings(Preferences.Prefs.settings, "Scintilla")
107 # TODO: add substyles
108
109 def getStyles(self):
110 """
111 Public method to get a list of all supported styles.
112
113 @return list of tuples each containing the description of the style,
114 style number and sub-style number (or -1 for no sub-style)
115 """
116 styles = []
117
103 for i in range(QsciScintillaBase.STYLE_MAX): 118 for i in range(QsciScintillaBase.STYLE_MAX):
104 desc = self.__lex.description(i) 119 desc = self.__lex.description(i)
105 if desc: 120 if desc:
106 self.styles.append(desc) 121 styles.append((desc, i, -1))
107 self.ind2style[index] = i
108 index += 1
109
110 # read the last stored values from preferences file
111 self.__lex.readSettings(Preferences.Prefs.settings, "Scintilla")
112 # TODO: add substyles 122 # TODO: add substyles
113 123
114 def writeSettings(self): 124 return styles
115 """
116 Public method to write the lexer settings.
117 """
118 self.__lex.writeSettings(Preferences.Prefs.settings, "Scintilla")
119 # TODO: add substyles
120 125
121 def defaultColor(self, style): 126 def defaultColor(self, style):
122 """ 127 """
123 Public method to get the default color of a style. 128 Public method to get the default color of a style.
124 129

eric ide

mercurial