Preferences/ConfigurationPages/EditorHighlightingStylesPage.py

branch
sub_styles
changeset 6855
4d80c8cc99a1
parent 6854
f4dd76230eea
child 6860
50069cc0ee49
--- a/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py	Mon Mar 11 19:50:50 2019 +0100
+++ b/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py	Tue Mar 12 20:00:30 2019 +0100
@@ -134,6 +134,7 @@
         self.__styleAllItems()
         self.styleElementList.setCurrentRow(0)
     
+    # TODO: remove this once done
     def __styleForRow(self, row):
         """
         Private method to get the style number of the item of a given row.
@@ -146,16 +147,32 @@
         itm = self.styleElementList.item(row)
         return itm.data(self.StyleRole)
     
+    def __stylesForRow(self, row):
+        """
+        Private method to get the style and sub-style number of the item of
+        a given row.
+        
+        @param row row number
+        @type int
+        @return tuple containing the style and sub-style numbers
+        @rtype tuple of (int,int)
+        """
+        itm = self.styleElementList.item(row)
+        style = itm.data(self.StyleRole)
+        substyle = itm.data(self.SubstyleRole)
+        
+        return (style, substyle)
+    
     def __styleAllItems(self):
         """
         Private method to style all items of the style element list.
         """
         for row in range(self.styleElementList.count()):
-            style = self.__styleForRow(row)
-            colour = self.lexer.color(style)
-            paper = self.lexer.paper(style)
-            font = self.lexer.font(style)
-            eolfill = self.lexer.eolFill(style)
+            style, substyle = self.__stylesForRow(row)
+            colour = self.lexer.color(style, substyle)
+            paper = self.lexer.paper(style, substyle)
+            font = self.lexer.font(style, substyle)
+            eolfill = self.lexer.eolFill(style, substyle)
             
             itm = self.styleElementList.item(row)
             itm.setFont(font)
@@ -176,7 +193,7 @@
         if row < 0:
             return
         
-        self.style = self.__styleForRow(row)
+        self.style = self.__styleForRow(row)    # TODO: get rid of self.style
         colour = self.lexer.color(self.style)
         paper = self.lexer.paper(self.style)
         eolfill = self.lexer.eolFill(self.style)

eric ide

mercurial