Preferences/ConfigurationPages/EditorHighlightingStylesPage.py

changeset 945
8cd4d08fa9f6
parent 882
34b86be88bf0
child 1131
7781e396c903
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
19 from E5XML.HighlightingStylesWriter import HighlightingStylesWriter 19 from E5XML.HighlightingStylesWriter import HighlightingStylesWriter
20 from E5XML.HighlightingStylesReader import HighlightingStylesReader 20 from E5XML.HighlightingStylesReader import HighlightingStylesReader
21 21
22 import Preferences 22 import Preferences
23 23
24 class EditorHighlightingStylesPage(ConfigurationPageBase, 24
25 class EditorHighlightingStylesPage(ConfigurationPageBase,
25 Ui_EditorHighlightingStylesPage): 26 Ui_EditorHighlightingStylesPage):
26 """ 27 """
27 Class implementing the Editor Highlighting Styles configuration page. 28 Class implementing the Editor Highlighting Styles configuration page.
28 """ 29 """
29 FAMILYONLY = 0 30 FAMILYONLY = 0
30 SIZEONLY = 1 31 SIZEONLY = 1
31 FAMILYANDSIZE = 2 32 FAMILYANDSIZE = 2
32 FONT = 99 33 FONT = 99
33 34
34 def __init__(self, lexers): 35 def __init__(self, lexers):
35 """ 36 """
36 Constructor 37 Constructor
37 38
133 self.eolfillCheckBox.setChecked(eolfill) 134 self.eolfillCheckBox.setChecked(eolfill)
134 135
135 @pyqtSlot() 136 @pyqtSlot()
136 def on_foregroundButton_clicked(self): 137 def on_foregroundButton_clicked(self):
137 """ 138 """
138 Private method used to select the foreground colour of the selected style 139 Private method used to select the foreground colour of the selected style
139 and lexer. 140 and lexer.
140 """ 141 """
141 colour = QColorDialog.getColor(self.lexer.color(self.style)) 142 colour = QColorDialog.getColor(self.lexer.color(self.style))
142 if colour.isValid(): 143 if colour.isValid():
143 pl = self.sampleText.palette() 144 pl = self.sampleText.palette()
152 self.lexer.setColor(colour, self.style) 153 self.lexer.setColor(colour, self.style)
153 154
154 @pyqtSlot() 155 @pyqtSlot()
155 def on_backgroundButton_clicked(self): 156 def on_backgroundButton_clicked(self):
156 """ 157 """
157 Private method used to select the background colour of the selected style 158 Private method used to select the background colour of the selected style
158 and lexer. 159 and lexer.
159 """ 160 """
160 colour = QColorDialog.getColor(self.lexer.paper(self.style)) 161 colour = QColorDialog.getColor(self.lexer.paper(self.style))
161 if colour.isValid(): 162 if colour.isValid():
162 pl = self.sampleText.palette() 163 pl = self.sampleText.palette()
171 self.lexer.setPaper(colour, self.style) 172 self.lexer.setPaper(colour, self.style)
172 173
173 @pyqtSlot() 174 @pyqtSlot()
174 def on_allBackgroundColoursButton_clicked(self): 175 def on_allBackgroundColoursButton_clicked(self):
175 """ 176 """
176 Private method used to select the background colour of all styles of a 177 Private method used to select the background colour of all styles of a
177 selected lexer. 178 selected lexer.
178 """ 179 """
179 colour = QColorDialog.getColor(self.lexer.paper(self.style)) 180 colour = QColorDialog.getColor(self.lexer.paper(self.style))
180 if colour.isValid(): 181 if colour.isValid():
181 pl = self.sampleText.palette() 182 pl = self.sampleText.palette()
286 off = self.trUtf8("Disabled") 287 off = self.trUtf8("Disabled")
287 selection, ok = QInputDialog.getItem( 288 selection, ok = QInputDialog.getItem(
288 self, 289 self,
289 self.trUtf8("Fill to end of line"), 290 self.trUtf8("Fill to end of line"),
290 self.trUtf8("Select fill to end of line for all styles"), 291 self.trUtf8("Select fill to end of line for all styles"),
291 [on, off], 292 [on, off],
292 0, False) 293 0, False)
293 if ok: 294 if ok:
294 enabled = selection == on 295 enabled = selection == on
295 self.eolfillCheckBox.setChecked(enabled) 296 self.eolfillCheckBox.setChecked(enabled)
296 for style in list(self.lexer.ind2style.values()): 297 for style in list(self.lexer.ind2style.values()):
332 @pyqtSlot() 333 @pyqtSlot()
333 def on_importCurrentButton_clicked(self): 334 def on_importCurrentButton_clicked(self):
334 """ 335 """
335 Private slot to import the styles of the current lexer. 336 Private slot to import the styles of the current lexer.
336 """ 337 """
337 self.__importStyles({self.lexer.language() : self.lexer}) 338 self.__importStyles({self.lexer.language(): self.lexer})
338 339
339 @pyqtSlot() 340 @pyqtSlot()
340 def on_exportCurrentButton_clicked(self): 341 def on_exportCurrentButton_clicked(self):
341 """ 342 """
342 Private slot to export the styles of the current lexer. 343 Private slot to export the styles of the current lexer.
456 """ 457 """
457 self.lexerLanguageComboBox.setCurrentIndex(state[0]) 458 self.lexerLanguageComboBox.setCurrentIndex(state[0])
458 self.on_lexerLanguageComboBox_activated(self.lexerLanguageComboBox.currentText()) 459 self.on_lexerLanguageComboBox_activated(self.lexerLanguageComboBox.currentText())
459 self.styleElementList.setCurrentRow(state[1]) 460 self.styleElementList.setCurrentRow(state[1])
460 461
462
461 def create(dlg): 463 def create(dlg):
462 """ 464 """
463 Module function to create the configuration page. 465 Module function to create the configuration page.
464 466
465 @param dlg reference to the configuration dialog 467 @param dlg reference to the configuration dialog

eric ide

mercurial