Preferences/ConfigurationPages/EditorHighlightingStylesPage.py

branch
sub_styles
changeset 6855
4d80c8cc99a1
parent 6854
f4dd76230eea
child 6860
50069cc0ee49
equal deleted inserted replaced
6854:f4dd76230eea 6855:4d80c8cc99a1
132 itm.setData(self.SubstyleRole, subStyleNo) 132 itm.setData(self.SubstyleRole, subStyleNo)
133 # TODO: add substyle handling 133 # TODO: add substyle handling
134 self.__styleAllItems() 134 self.__styleAllItems()
135 self.styleElementList.setCurrentRow(0) 135 self.styleElementList.setCurrentRow(0)
136 136
137 # TODO: remove this once done
137 def __styleForRow(self, row): 138 def __styleForRow(self, row):
138 """ 139 """
139 Private method to get the style number of the item of a given row. 140 Private method to get the style number of the item of a given row.
140 141
141 @param row row number 142 @param row row number
144 @rtype int 145 @rtype int
145 """ 146 """
146 itm = self.styleElementList.item(row) 147 itm = self.styleElementList.item(row)
147 return itm.data(self.StyleRole) 148 return itm.data(self.StyleRole)
148 149
150 def __stylesForRow(self, row):
151 """
152 Private method to get the style and sub-style number of the item of
153 a given row.
154
155 @param row row number
156 @type int
157 @return tuple containing the style and sub-style numbers
158 @rtype tuple of (int,int)
159 """
160 itm = self.styleElementList.item(row)
161 style = itm.data(self.StyleRole)
162 substyle = itm.data(self.SubstyleRole)
163
164 return (style, substyle)
165
149 def __styleAllItems(self): 166 def __styleAllItems(self):
150 """ 167 """
151 Private method to style all items of the style element list. 168 Private method to style all items of the style element list.
152 """ 169 """
153 for row in range(self.styleElementList.count()): 170 for row in range(self.styleElementList.count()):
154 style = self.__styleForRow(row) 171 style, substyle = self.__stylesForRow(row)
155 colour = self.lexer.color(style) 172 colour = self.lexer.color(style, substyle)
156 paper = self.lexer.paper(style) 173 paper = self.lexer.paper(style, substyle)
157 font = self.lexer.font(style) 174 font = self.lexer.font(style, substyle)
158 eolfill = self.lexer.eolFill(style) 175 eolfill = self.lexer.eolFill(style, substyle)
159 176
160 itm = self.styleElementList.item(row) 177 itm = self.styleElementList.item(row)
161 itm.setFont(font) 178 itm.setFont(font)
162 itm.setBackground(paper) 179 itm.setBackground(paper)
163 itm.setForeground(colour) 180 itm.setForeground(colour)
174 @type int 191 @type int
175 """ 192 """
176 if row < 0: 193 if row < 0:
177 return 194 return
178 195
179 self.style = self.__styleForRow(row) 196 self.style = self.__styleForRow(row) # TODO: get rid of self.style
180 colour = self.lexer.color(self.style) 197 colour = self.lexer.color(self.style)
181 paper = self.lexer.paper(self.style) 198 paper = self.lexer.paper(self.style)
182 eolfill = self.lexer.eolFill(self.style) 199 eolfill = self.lexer.eolFill(self.style)
183 font = self.lexer.font(self.style) 200 font = self.lexer.font(self.style)
184 201

eric ide

mercurial