64 |
64 |
65 @param style style number (integer) |
65 @param style style number (integer) |
66 @return style name string (string) |
66 @return style name string (string) |
67 """ |
67 """ |
68 buf = "" |
68 buf = "" |
|
69 if style >= 0: |
|
70 start = ord('a') |
|
71 else: |
|
72 start = ord('A') |
|
73 style = abs(style) |
|
74 |
69 if style == 0: |
75 if style == 0: |
70 buf = "a" |
76 buf = "a" |
71 else: |
77 else: |
72 while style > 0: |
78 while style > 0: |
73 buf += chr(ord('a') + (style % self.CHARZ)) |
79 buf += chr(start + (style % self.CHARZ)) |
74 style //= self.CHARZ |
80 style //= self.CHARZ |
75 return buf |
81 return buf |
76 |
82 |
77 def __defineTexStyle(self, font, color, paper, file, istyle): |
83 def __defineTexStyle(self, font, color, paper, file, istyle): |
78 """ |
84 """ |
186 colour = lex.color(istyle) |
192 colour = lex.color(istyle) |
187 paper = lex.paper(istyle) |
193 paper = lex.paper(istyle) |
188 |
194 |
189 self.__defineTexStyle( |
195 self.__defineTexStyle( |
190 font, colour, paper, f, istyle) |
196 font, colour, paper, f, istyle) |
|
197 # get substyles |
|
198 subs_start, subs_count = ( |
|
199 self.editor.getSubStyleRange(istyle) |
|
200 ) |
|
201 for subs_idx in range(subs_count): |
|
202 font = lex.font(subs_start + subs_idx) |
|
203 colour = lex.color( |
|
204 subs_start + subs_idx) |
|
205 paper = lex.paper( |
|
206 subs_start + subs_idx) |
|
207 |
|
208 self.__defineTexStyle( |
|
209 font, colour, paper, f, |
|
210 subs_idx - subs_start) |
|
211 |
191 istyle += 1 |
212 istyle += 1 |
192 else: |
213 else: |
193 colour = self.editor.color() |
214 colour = self.editor.color() |
194 paper = self.editor.paper() |
215 paper = self.editor.paper() |
195 font = Preferences.getEditorOtherFonts("DefaultFont") |
216 font = Preferences.getEditorOtherFonts("DefaultFont") |