5 |
5 |
6 """ |
6 """ |
7 Module implementing the Editor Highlighting Styles configuration page. |
7 Module implementing the Editor Highlighting Styles configuration page. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSlot, QFileInfo, QFile, QIODevice |
10 from PyQt4.QtCore import pyqtSlot, Qt, QFileInfo, QFile, QIODevice |
11 from PyQt4.QtGui import QPalette, QColorDialog, QFontDialog, \ |
11 from PyQt4.QtGui import QPalette, QColorDialog, QFontDialog, \ |
12 QInputDialog, QFont, QMenu |
12 QInputDialog, QFont, QMenu |
13 |
13 |
14 from .ConfigurationPageBase import ConfigurationPageBase |
14 from .ConfigurationPageBase import ConfigurationPageBase |
15 from .Ui_EditorHighlightingStylesPage import Ui_EditorHighlightingStylesPage |
15 from .Ui_EditorHighlightingStylesPage import Ui_EditorHighlightingStylesPage |
117 for row in range(self.styleElementList.count()): |
117 for row in range(self.styleElementList.count()): |
118 style = self.lexer.ind2style[row] |
118 style = self.lexer.ind2style[row] |
119 colour = self.lexer.color(style) |
119 colour = self.lexer.color(style) |
120 paper = self.lexer.paper(style) |
120 paper = self.lexer.paper(style) |
121 font = self.lexer.font(style) |
121 font = self.lexer.font(style) |
|
122 eolfill = self.lexer.eolFill(style) |
122 |
123 |
123 itm = self.styleElementList.item(row) |
124 itm = self.styleElementList.item(row) |
124 itm.setFont(font) |
125 itm.setFont(font) |
125 itm.setBackground(paper) |
126 itm.setBackground(paper) |
126 itm.setForeground(colour) |
127 itm.setForeground(colour) |
|
128 if eolfill: |
|
129 itm.setCheckState(Qt.Checked) |
|
130 else: |
|
131 itm.setCheckState(Qt.Unchecked) |
127 |
132 |
128 def on_styleElementList_currentRowChanged(self, index): |
133 def on_styleElementList_currentRowChanged(self, index): |
129 """ |
134 """ |
130 Private method to set up the style element part of the source page. |
135 Private method to set up the style element part of the source page. |
131 |
136 |
300 |
305 |
301 familyOnly = act.data() in [self.FAMILYANDSIZE, self.FAMILYONLY] |
306 familyOnly = act.data() in [self.FAMILYANDSIZE, self.FAMILYONLY] |
302 sizeOnly = act.data() in [self.FAMILYANDSIZE, self.SIZEONLY] |
307 sizeOnly = act.data() in [self.FAMILYANDSIZE, self.SIZEONLY] |
303 self.__changeFont(True, familyOnly, sizeOnly) |
308 self.__changeFont(True, familyOnly, sizeOnly) |
304 |
309 |
305 def on_eolfillCheckBox_toggled(self, b): |
310 def on_eolfillCheckBox_toggled(self, on): |
306 """ |
311 """ |
307 Private method used to set the eolfill for the selected style and |
312 Private method used to set the eolfill for the selected style and |
308 lexer. |
313 lexer. |
309 |
314 |
310 @param b Flag indicating enabled or disabled state. |
315 @param on flag indicating enabled or disabled state (boolean) |
311 """ |
316 """ |
312 self.lexer.setEolFill(b, self.style) |
317 self.lexer.setEolFill(on, self.style) |
|
318 checkState = Qt.Checked if on else Qt.Unchecked |
|
319 self.styleElementList.currentItem().setCheckState(checkState) |
313 |
320 |
314 @pyqtSlot() |
321 @pyqtSlot() |
315 def on_allEolFillButton_clicked(self): |
322 def on_allEolFillButton_clicked(self): |
316 """ |
323 """ |
317 Private method used to set the eolfill for all styles of a selected |
324 Private method used to set the eolfill for all styles of a selected |
328 if ok: |
335 if ok: |
329 enabled = selection == on |
336 enabled = selection == on |
330 self.eolfillCheckBox.setChecked(enabled) |
337 self.eolfillCheckBox.setChecked(enabled) |
331 for style in list(self.lexer.ind2style.values()): |
338 for style in list(self.lexer.ind2style.values()): |
332 self.lexer.setEolFill(enabled, style) |
339 self.lexer.setEolFill(enabled, style) |
|
340 self.__styleAllItems() |
333 |
341 |
334 @pyqtSlot() |
342 @pyqtSlot() |
335 def on_defaultButton_clicked(self): |
343 def on_defaultButton_clicked(self): |
336 """ |
344 """ |
337 Private method to set the current style to its default values. |
345 Private method to set the current style to its default values. |