Preferences/PreferencesLexer.py

branch
sub_styles
changeset 6854
f4dd76230eea
parent 6853
0922aa829e5e
child 6855
4d80c8cc99a1
--- a/Preferences/PreferencesLexer.py	Mon Mar 11 19:15:34 2019 +0100
+++ b/Preferences/PreferencesLexer.py	Mon Mar 11 19:50:50 2019 +0100
@@ -95,18 +95,6 @@
         if self.__lex is None:
             raise PreferencesLexerLanguageError(language)
         
-        # TODO: get rid of 'styles' and 'ind2style'
-        # define the local store
-        self.ind2style = {}
-        self.styles = []
-        index = 0
-        for i in range(QsciScintillaBase.STYLE_MAX):
-            desc = self.__lex.description(i)
-            if desc:
-                self.styles.append(desc)
-                self.ind2style[index] = i
-                index += 1
-        
         # read the last stored values from preferences file
         self.__lex.readSettings(Preferences.Prefs.settings, "Scintilla")
         # TODO: add substyles
@@ -118,6 +106,23 @@
         self.__lex.writeSettings(Preferences.Prefs.settings, "Scintilla")
         # TODO: add substyles
     
+    def getStyles(self):
+        """
+        Public method to get a list of all supported styles.
+        
+        @return list of tuples each containing the description of the style,
+            style number and sub-style number (or -1 for no sub-style)
+        """
+        styles = []
+        
+        for i in range(QsciScintillaBase.STYLE_MAX):
+            desc = self.__lex.description(i)
+            if desc:
+                styles.append((desc, i, -1))
+        # TODO: add substyles
+        
+        return styles
+    
     def defaultColor(self, style):
         """
         Public method to get the default color of a style.

eric ide

mercurial