|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Editor Styles configuration page. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from PyQt5.QtCore import pyqtSlot |
|
13 from PyQt5.QtGui import QColor, QPalette |
|
14 from PyQt5.QtWidgets import QColorDialog, QFontDialog |
|
15 from PyQt5.Qsci import QsciScintilla |
|
16 |
|
17 from .ConfigurationPageBase import ConfigurationPageBase |
|
18 from .Ui_EditorStylesPage import Ui_EditorStylesPage |
|
19 |
|
20 import Preferences |
|
21 |
|
22 try: |
|
23 MonospacedFontsOption = QFontDialog.MonospacedFonts |
|
24 except AttributeError: |
|
25 MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10) |
|
26 |
|
27 |
|
28 class EditorStylesPage(ConfigurationPageBase, Ui_EditorStylesPage): |
|
29 """ |
|
30 Class implementing the Editor Styles configuration page. |
|
31 """ |
|
32 def __init__(self): |
|
33 """ |
|
34 Constructor |
|
35 """ |
|
36 super(EditorStylesPage, self).__init__() |
|
37 self.setupUi(self) |
|
38 self.setObjectName("EditorStylesPage") |
|
39 |
|
40 from QScintilla.QsciScintillaCompat import QsciScintillaCompat, \ |
|
41 QSCINTILLA_VERSION |
|
42 self.foldStyles = [ |
|
43 QsciScintilla.PlainFoldStyle, |
|
44 QsciScintilla.CircledFoldStyle, |
|
45 QsciScintilla.BoxedFoldStyle, |
|
46 QsciScintilla.CircledTreeFoldStyle, |
|
47 QsciScintilla.BoxedTreeFoldStyle, |
|
48 QsciScintillaCompat.ArrowFoldStyle, |
|
49 QsciScintillaCompat.ArrowTreeFoldStyle, |
|
50 ] |
|
51 |
|
52 self.edgeModes = [ |
|
53 QsciScintilla.EdgeNone, |
|
54 QsciScintilla.EdgeLine, |
|
55 QsciScintilla.EdgeBackground |
|
56 ] |
|
57 |
|
58 self.wrapModeComboBox.addItem( |
|
59 self.tr("Disabled"), QsciScintilla.WrapNone) |
|
60 self.wrapModeComboBox.addItem( |
|
61 self.tr("Word Boundary"), QsciScintilla.WrapWord) |
|
62 self.wrapModeComboBox.addItem( |
|
63 self.tr("Character Boundary"), QsciScintilla.WrapCharacter) |
|
64 self.wrapVisualComboBox.addItem( |
|
65 self.tr("No Indicator"), QsciScintilla.WrapFlagNone) |
|
66 self.wrapVisualComboBox.addItem( |
|
67 self.tr("Indicator by Text"), QsciScintilla.WrapFlagByText) |
|
68 self.wrapVisualComboBox.addItem( |
|
69 self.tr("Indicator by Margin"), QsciScintilla.WrapFlagByBorder) |
|
70 if QSCINTILLA_VERSION() >= 0x020700: |
|
71 self.wrapVisualComboBox.addItem( |
|
72 self.tr("Indicator in Line Number Margin"), |
|
73 QsciScintilla.WrapFlagInMargin) |
|
74 |
|
75 self.wrapIndentComboBox.addItem( |
|
76 self.tr("Fixed"), QsciScintilla.WrapIndentFixed) |
|
77 self.wrapIndentComboBox.addItem( |
|
78 self.tr("Aligned"), QsciScintilla.WrapIndentSame) |
|
79 self.wrapIndentComboBox.addItem( |
|
80 self.tr("Aligned plus One"), |
|
81 QsciScintilla.WrapIndentIndented) |
|
82 if QSCINTILLA_VERSION() >= 0x020B00: |
|
83 self.wrapIndentComboBox.addItem( |
|
84 self.tr("Aligned plus Two"), |
|
85 QsciScintilla.WrapIndentDeeplyIndented) |
|
86 |
|
87 self.caretlineAlwaysVisibleCheckBox.setEnabled( |
|
88 QSCINTILLA_VERSION() >= 0x020800) |
|
89 self.caretlineFrameWidthSpinBox.setEnabled( |
|
90 QSCINTILLA_VERSION() >= 0x020B00) |
|
91 |
|
92 # set initial values |
|
93 try: |
|
94 self.foldingStyleComboBox.setCurrentIndex( |
|
95 self.foldStyles.index(Preferences.getEditor("FoldingStyle"))) |
|
96 except ValueError: |
|
97 self.foldingStyleComboBox.setCurrentIndex(0) |
|
98 self.marginsFont = Preferences.getEditorOtherFonts("MarginsFont") |
|
99 self.marginsFontSample.setFont(self.marginsFont) |
|
100 self.defaultFont = Preferences.getEditorOtherFonts("DefaultFont") |
|
101 self.defaultFontSample.setFont(self.defaultFont) |
|
102 self.monospacedFont = Preferences.getEditorOtherFonts("MonospacedFont") |
|
103 self.monospacedFontSample.setFont(self.monospacedFont) |
|
104 self.monospacedCheckBox.setChecked( |
|
105 Preferences.getEditor("UseMonospacedFont")) |
|
106 self.linenoCheckBox.setChecked( |
|
107 Preferences.getEditor("LinenoMargin")) |
|
108 self.foldingCheckBox.setChecked( |
|
109 Preferences.getEditor("FoldingMargin")) |
|
110 |
|
111 self.caretlineVisibleCheckBox.setChecked( |
|
112 Preferences.getEditor("CaretLineVisible")) |
|
113 self.caretlineAlwaysVisibleCheckBox.setChecked( |
|
114 Preferences.getEditor("CaretLineAlwaysVisible")) |
|
115 self.caretWidthSpinBox.setValue( |
|
116 Preferences.getEditor("CaretWidth")) |
|
117 self.caretlineFrameWidthSpinBox.setValue( |
|
118 Preferences.getEditor("CaretLineFrameWidth")) |
|
119 self.colourizeSelTextCheckBox.setChecked( |
|
120 Preferences.getEditor("ColourizeSelText")) |
|
121 self.customSelColourCheckBox.setChecked( |
|
122 Preferences.getEditor("CustomSelectionColours")) |
|
123 self.extentSelEolCheckBox.setChecked( |
|
124 Preferences.getEditor("ExtendSelectionToEol")) |
|
125 self.debugMarkerBackgroundCheckBox.setChecked( |
|
126 Preferences.getEditor("LineMarkersBackground")) |
|
127 |
|
128 self.initColour("CaretForeground", self.caretForegroundButton, |
|
129 Preferences.getEditorColour) |
|
130 self.initColour("CaretLineBackground", self.caretlineBackgroundButton, |
|
131 Preferences.getEditorColour, hasAlpha=True) |
|
132 self.initColour("SelectionForeground", self.selectionForegroundButton, |
|
133 Preferences.getEditorColour) |
|
134 self.initColour("SelectionBackground", self.selectionBackgroundButton, |
|
135 Preferences.getEditorColour, hasAlpha=True) |
|
136 self.initColour("CurrentMarker", self.currentLineMarkerButton, |
|
137 Preferences.getEditorColour, hasAlpha=True) |
|
138 self.initColour("ErrorMarker", self.errorMarkerButton, |
|
139 Preferences.getEditorColour, hasAlpha=True) |
|
140 self.initColour("MarginsForeground", self.marginsForegroundButton, |
|
141 Preferences.getEditorColour) |
|
142 self.initColour("MarginsBackground", self.marginsBackgroundButton, |
|
143 Preferences.getEditorColour) |
|
144 self.initColour("FoldmarginBackground", |
|
145 self.foldmarginBackgroundButton, |
|
146 Preferences.getEditorColour) |
|
147 self.initColour("FoldMarkersForeground", |
|
148 self.foldmarkersForegroundButton, |
|
149 Preferences.getEditorColour) |
|
150 self.initColour("FoldMarkersBackground", |
|
151 self.foldmarkersBackgroundButton, |
|
152 Preferences.getEditorColour) |
|
153 |
|
154 self.editorColours = {} |
|
155 self.editorColours["AnnotationsWarningForeground"] = \ |
|
156 QColor(Preferences.getEditorColour("AnnotationsWarningForeground")) |
|
157 self.editorColours["AnnotationsWarningBackground"] = \ |
|
158 QColor(Preferences.getEditorColour("AnnotationsWarningBackground")) |
|
159 self.editorColours["AnnotationsErrorForeground"] = \ |
|
160 QColor(Preferences.getEditorColour("AnnotationsErrorForeground")) |
|
161 self.editorColours["AnnotationsErrorBackground"] = \ |
|
162 QColor(Preferences.getEditorColour("AnnotationsErrorBackground")) |
|
163 self.editorColours["AnnotationsStyleForeground"] = \ |
|
164 QColor(Preferences.getEditorColour("AnnotationsStyleForeground")) |
|
165 self.editorColours["AnnotationsStyleBackground"] = \ |
|
166 QColor(Preferences.getEditorColour("AnnotationsStyleBackground")) |
|
167 |
|
168 self.eolCheckBox.setChecked(Preferences.getEditor("ShowEOL")) |
|
169 self.wrapModeComboBox.setCurrentIndex(self.wrapModeComboBox.findData( |
|
170 Preferences.getEditor("WrapLongLinesMode"))) |
|
171 self.wrapVisualComboBox.setCurrentIndex( |
|
172 self.wrapVisualComboBox.findData( |
|
173 Preferences.getEditor("WrapVisualFlag"))) |
|
174 self.wrapIndentComboBox.setCurrentIndex( |
|
175 self.wrapIndentComboBox.findData( |
|
176 Preferences.getEditor("WrapIndentMode"))) |
|
177 self.wrapStartIndentSpinBox.setValue( |
|
178 Preferences.getEditor("WrapStartIndent")) |
|
179 |
|
180 self.edgeModeCombo.setCurrentIndex( |
|
181 self.edgeModes.index(Preferences.getEditor("EdgeMode"))) |
|
182 self.edgeLineColumnSlider.setValue( |
|
183 Preferences.getEditor("EdgeColumn")) |
|
184 self.initColour( |
|
185 "Edge", self.edgeBackgroundColorButton, |
|
186 Preferences.getEditorColour) |
|
187 |
|
188 self.bracehighlightingCheckBox.setChecked( |
|
189 Preferences.getEditor("BraceHighlighting")) |
|
190 self.initColour("MatchingBrace", self.matchingBracesButton, |
|
191 Preferences.getEditorColour) |
|
192 self.initColour("MatchingBraceBack", self.matchingBracesBackButton, |
|
193 Preferences.getEditorColour) |
|
194 self.initColour("NonmatchingBrace", self.nonmatchingBracesButton, |
|
195 Preferences.getEditorColour) |
|
196 self.initColour("NonmatchingBraceBack", |
|
197 self.nonmatchingBracesBackButton, |
|
198 Preferences.getEditorColour) |
|
199 |
|
200 self.zoomfactorSlider.setValue( |
|
201 Preferences.getEditor("ZoomFactor")) |
|
202 |
|
203 self.whitespaceCheckBox.setChecked( |
|
204 Preferences.getEditor("ShowWhitespace")) |
|
205 self.whitespaceSizeSpinBox.setValue( |
|
206 Preferences.getEditor("WhitespaceSize")) |
|
207 self.initColour("WhitespaceForeground", |
|
208 self.whitespaceForegroundButton, |
|
209 Preferences.getEditorColour) |
|
210 self.initColour("WhitespaceBackground", |
|
211 self.whitespaceBackgroundButton, |
|
212 Preferences.getEditorColour) |
|
213 if not hasattr(QsciScintilla, "setWhitespaceForegroundColor"): |
|
214 self.whitespaceSizeSpinBox.setEnabled(False) |
|
215 self.whitespaceForegroundButton.setEnabled(False) |
|
216 self.whitespaceBackgroundButton.setEnabled(False) |
|
217 |
|
218 self.miniMenuCheckBox.setChecked( |
|
219 Preferences.getEditor("MiniContextMenu")) |
|
220 self.hideFormatButtonsCheckBox.setChecked( |
|
221 Preferences.getEditor("HideFormatButtons")) |
|
222 |
|
223 self.enableAnnotationsCheckBox.setChecked( |
|
224 Preferences.getEditor("AnnotationsEnabled")) |
|
225 |
|
226 self.editAreaOverrideCheckBox.setChecked( |
|
227 Preferences.getEditor("OverrideEditAreaColours")) |
|
228 self.initColour( |
|
229 "EditAreaForeground", self.editAreaForegroundButton, |
|
230 Preferences.getEditorColour) |
|
231 self.initColour( |
|
232 "EditAreaBackground", self.editAreaBackgroundButton, |
|
233 Preferences.getEditorColour) |
|
234 |
|
235 self.enableChangeTraceCheckBox.setChecked( |
|
236 Preferences.getEditor("OnlineChangeTrace")) |
|
237 self.changeTraceTimeoutSpinBox.setValue( |
|
238 Preferences.getEditor("OnlineChangeTraceInterval")) |
|
239 self.initColour("OnlineChangeTraceMarkerUnsaved", |
|
240 self.changeMarkerUnsavedColorButton, |
|
241 Preferences.getEditorColour) |
|
242 self.initColour("OnlineChangeTraceMarkerSaved", |
|
243 self.changeMarkerSavedColorButton, |
|
244 Preferences.getEditorColour) |
|
245 |
|
246 self.markerMapRightCheckBox.setChecked( |
|
247 Preferences.getEditor("ShowMarkerMapOnRight")) |
|
248 self.initColour("BookmarksMap", |
|
249 self.bookmarksMapButton, |
|
250 Preferences.getEditorColour) |
|
251 self.initColour("ErrorsMap", |
|
252 self.errorsMapButton, |
|
253 Preferences.getEditorColour) |
|
254 self.initColour("WarningsMap", |
|
255 self.warningsMapButton, |
|
256 Preferences.getEditorColour) |
|
257 self.initColour("BreakpointsMap", |
|
258 self.breakpointsMapButton, |
|
259 Preferences.getEditorColour) |
|
260 self.initColour("TasksMap", |
|
261 self.tasksMapButton, |
|
262 Preferences.getEditorColour) |
|
263 self.initColour("CoverageMap", |
|
264 self.coverageMapButton, |
|
265 Preferences.getEditorColour) |
|
266 self.initColour("ChangesMap", |
|
267 self.changesMapButton, |
|
268 Preferences.getEditorColour) |
|
269 self.initColour("CurrentMap", |
|
270 self.currentMapButton, |
|
271 Preferences.getEditorColour) |
|
272 self.initColour("SearchMarkersMap", |
|
273 self.searchMarkerMapButton, |
|
274 Preferences.getEditorColour) |
|
275 self.initColour("VcsConflictMarkersMap", |
|
276 self.conflictMarkerMapButton, |
|
277 Preferences.getEditorColour) |
|
278 self.initColour("MarkerMapBackground", |
|
279 self.markerMapBackgroundButton, |
|
280 Preferences.getEditorColour) |
|
281 self.changesMarkerCheckBox.setChecked( |
|
282 Preferences.getEditor("ShowMarkerChanges")) |
|
283 self.coverageMarkerCheckBox.setChecked( |
|
284 Preferences.getEditor("ShowMarkerCoverage")) |
|
285 self.searchMarkerCheckBox.setChecked( |
|
286 Preferences.getEditor("ShowMarkerSearch")) |
|
287 |
|
288 self.indentguidesCheckBox.setChecked( |
|
289 Preferences.getEditor("IndentationGuides")) |
|
290 self.initColour("IndentationGuidesBackground", |
|
291 self.indentationGuidesBackgroundButton, |
|
292 Preferences.getEditorColour) |
|
293 self.initColour("IndentationGuidesForeground", |
|
294 self.indentationGuidesForegroundButton, |
|
295 Preferences.getEditorColour) |
|
296 |
|
297 self.initColour("HighlightMarker", |
|
298 self.highlightingBackgroundButton, |
|
299 Preferences.getEditorColour, |
|
300 hasAlpha=True) |
|
301 |
|
302 def save(self): |
|
303 """ |
|
304 Public slot to save the Editor Styles configuration. |
|
305 """ |
|
306 Preferences.setEditor( |
|
307 "FoldingStyle", |
|
308 self.foldStyles[self.foldingStyleComboBox.currentIndex()]) |
|
309 Preferences.setEditorOtherFonts( |
|
310 "MarginsFont", self.marginsFont) |
|
311 Preferences.setEditorOtherFonts( |
|
312 "DefaultFont", self.defaultFont) |
|
313 Preferences.setEditorOtherFonts( |
|
314 "MonospacedFont", self.monospacedFont) |
|
315 Preferences.setEditor( |
|
316 "UseMonospacedFont", self.monospacedCheckBox.isChecked()) |
|
317 |
|
318 Preferences.setEditor( |
|
319 "LinenoMargin", self.linenoCheckBox.isChecked()) |
|
320 Preferences.setEditor( |
|
321 "FoldingMargin", self.foldingCheckBox.isChecked()) |
|
322 |
|
323 Preferences.setEditor( |
|
324 "CaretLineVisible", self.caretlineVisibleCheckBox.isChecked()) |
|
325 Preferences.setEditor( |
|
326 "CaretLineAlwaysVisible", |
|
327 self.caretlineAlwaysVisibleCheckBox.isChecked()) |
|
328 Preferences.setEditor( |
|
329 "ColourizeSelText", self.colourizeSelTextCheckBox.isChecked()) |
|
330 Preferences.setEditor( |
|
331 "CustomSelectionColours", self.customSelColourCheckBox.isChecked()) |
|
332 Preferences.setEditor( |
|
333 "ExtendSelectionToEol", self.extentSelEolCheckBox.isChecked()) |
|
334 Preferences.setEditor( |
|
335 "LineMarkersBackground", |
|
336 self.debugMarkerBackgroundCheckBox.isChecked()) |
|
337 |
|
338 Preferences.setEditor( |
|
339 "CaretWidth", self.caretWidthSpinBox.value()) |
|
340 Preferences.setEditor( |
|
341 "CaretLineFrameWidth", self.caretlineFrameWidthSpinBox.value()) |
|
342 |
|
343 Preferences.setEditor( |
|
344 "ShowEOL", self.eolCheckBox.isChecked()) |
|
345 Preferences.setEditor( |
|
346 "WrapLongLinesMode", self.wrapModeComboBox.itemData( |
|
347 self.wrapModeComboBox.currentIndex())) |
|
348 Preferences.setEditor( |
|
349 "WrapVisualFlag", self.wrapVisualComboBox.itemData( |
|
350 self.wrapVisualComboBox.currentIndex())) |
|
351 Preferences.setEditor( |
|
352 "WrapIndentMode", self.wrapIndentComboBox.itemData( |
|
353 self.wrapIndentComboBox.currentIndex())) |
|
354 Preferences.setEditor( |
|
355 "WrapStartIndent", self.wrapStartIndentSpinBox.value()) |
|
356 Preferences.setEditor( |
|
357 "EdgeMode", self.edgeModes[self.edgeModeCombo.currentIndex()]) |
|
358 Preferences.setEditor( |
|
359 "EdgeColumn", self.edgeLineColumnSlider.value()) |
|
360 |
|
361 Preferences.setEditor( |
|
362 "BraceHighlighting", self.bracehighlightingCheckBox.isChecked()) |
|
363 |
|
364 Preferences.setEditor( |
|
365 "ZoomFactor", self.zoomfactorSlider.value()) |
|
366 |
|
367 Preferences.setEditor( |
|
368 "ShowWhitespace", self.whitespaceCheckBox.isChecked()) |
|
369 Preferences.setEditor( |
|
370 "WhitespaceSize", self.whitespaceSizeSpinBox.value()) |
|
371 |
|
372 Preferences.setEditor( |
|
373 "MiniContextMenu", self.miniMenuCheckBox.isChecked()) |
|
374 Preferences.setEditor( |
|
375 "HideFormatButtons", self.hideFormatButtonsCheckBox.isChecked()) |
|
376 |
|
377 Preferences.setEditor( |
|
378 "AnnotationsEnabled", self.enableAnnotationsCheckBox.isChecked()) |
|
379 |
|
380 Preferences.setEditor( |
|
381 "OverrideEditAreaColours", |
|
382 self.editAreaOverrideCheckBox.isChecked()) |
|
383 |
|
384 Preferences.setEditor( |
|
385 "OnlineChangeTrace", self.enableChangeTraceCheckBox.isChecked()) |
|
386 Preferences.setEditor( |
|
387 "OnlineChangeTraceInterval", |
|
388 self.changeTraceTimeoutSpinBox.value()) |
|
389 |
|
390 Preferences.setEditor( |
|
391 "IndentationGuides", |
|
392 self.indentguidesCheckBox.isChecked()) |
|
393 |
|
394 Preferences.setEditor( |
|
395 "ShowMarkerMapOnRight", |
|
396 self.markerMapRightCheckBox.isChecked()) |
|
397 Preferences.setEditor( |
|
398 "ShowMarkerChanges", |
|
399 self.changesMarkerCheckBox.isChecked()) |
|
400 Preferences.setEditor( |
|
401 "ShowMarkerCoverage", |
|
402 self.coverageMarkerCheckBox.isChecked()) |
|
403 Preferences.setEditor( |
|
404 "ShowMarkerSearch", |
|
405 self.searchMarkerCheckBox.isChecked()) |
|
406 |
|
407 self.saveColours(Preferences.setEditorColour) |
|
408 for key in list(self.editorColours.keys()): |
|
409 Preferences.setEditorColour(key, self.editorColours[key]) |
|
410 |
|
411 @pyqtSlot() |
|
412 def on_linenumbersFontButton_clicked(self): |
|
413 """ |
|
414 Private method used to select the font for the editor margins. |
|
415 """ |
|
416 self.marginsFont = self.selectFont( |
|
417 self.marginsFontSample, self.marginsFont, |
|
418 options=MonospacedFontsOption) |
|
419 |
|
420 @pyqtSlot() |
|
421 def on_defaultFontButton_clicked(self): |
|
422 """ |
|
423 Private method used to select the default font for the editor. |
|
424 """ |
|
425 self.defaultFont = self.selectFont( |
|
426 self.defaultFontSample, self.defaultFont) |
|
427 |
|
428 @pyqtSlot() |
|
429 def on_monospacedFontButton_clicked(self): |
|
430 """ |
|
431 Private method used to select the font to be used as the monospaced |
|
432 font. |
|
433 """ |
|
434 self.monospacedFont = self.selectFont( |
|
435 self.monospacedFontSample, self.monospacedFont, |
|
436 options=MonospacedFontsOption) |
|
437 |
|
438 def polishPage(self): |
|
439 """ |
|
440 Public slot to perform some polishing actions. |
|
441 """ |
|
442 self.marginsFontSample.setFont(self.marginsFont) |
|
443 self.defaultFontSample.setFont(self.defaultFont) |
|
444 self.monospacedFontSample.setFont(self.monospacedFont) |
|
445 |
|
446 pl = self.annotationsWarningSample.palette() |
|
447 pl.setColor(QPalette.Text, |
|
448 self.editorColours["AnnotationsWarningForeground"]) |
|
449 pl.setColor(QPalette.Base, |
|
450 self.editorColours["AnnotationsWarningBackground"]) |
|
451 self.annotationsWarningSample.setPalette(pl) |
|
452 self.annotationsWarningSample.repaint() |
|
453 |
|
454 pl = self.annotationsErrorSample.palette() |
|
455 pl.setColor(QPalette.Text, |
|
456 self.editorColours["AnnotationsErrorForeground"]) |
|
457 pl.setColor(QPalette.Base, |
|
458 self.editorColours["AnnotationsErrorBackground"]) |
|
459 self.annotationsErrorSample.setPalette(pl) |
|
460 self.annotationsErrorSample.repaint() |
|
461 |
|
462 pl = self.annotationsStyleWarningSample.palette() |
|
463 pl.setColor(QPalette.Text, |
|
464 self.editorColours["AnnotationsStyleForeground"]) |
|
465 pl.setColor(QPalette.Base, |
|
466 self.editorColours["AnnotationsStyleBackground"]) |
|
467 self.annotationsStyleWarningSample.setPalette(pl) |
|
468 self.annotationsStyleWarningSample.repaint() |
|
469 |
|
470 @pyqtSlot() |
|
471 def on_annotationsWarningFgButton_clicked(self): |
|
472 """ |
|
473 Private slot to set the foreground colour of the warning annotations. |
|
474 """ |
|
475 colour = QColorDialog.getColor( |
|
476 self.editorColours["AnnotationsWarningForeground"]) |
|
477 if colour.isValid(): |
|
478 pl = self.annotationsWarningSample.palette() |
|
479 pl.setColor(QPalette.Text, colour) |
|
480 self.annotationsWarningSample.setPalette(pl) |
|
481 self.annotationsWarningSample.repaint() |
|
482 self.editorColours["AnnotationsWarningForeground"] = colour |
|
483 |
|
484 @pyqtSlot() |
|
485 def on_annotationsWarningBgButton_clicked(self): |
|
486 """ |
|
487 Private slot to set the background colour of the warning annotations. |
|
488 """ |
|
489 colour = QColorDialog.getColor( |
|
490 self.editorColours["AnnotationsWarningBackground"]) |
|
491 if colour.isValid(): |
|
492 pl = self.annotationsWarningSample.palette() |
|
493 pl.setColor(QPalette.Base, colour) |
|
494 self.annotationsWarningSample.setPalette(pl) |
|
495 self.annotationsWarningSample.repaint() |
|
496 self.editorColours["AnnotationsWarningBackground"] = colour |
|
497 |
|
498 @pyqtSlot() |
|
499 def on_annotationsErrorFgButton_clicked(self): |
|
500 """ |
|
501 Private slot to set the foreground colour of the error annotations. |
|
502 """ |
|
503 colour = QColorDialog.getColor( |
|
504 self.editorColours["AnnotationsErrorForeground"]) |
|
505 if colour.isValid(): |
|
506 pl = self.annotationsErrorSample.palette() |
|
507 pl.setColor(QPalette.Text, colour) |
|
508 self.annotationsErrorSample.setPalette(pl) |
|
509 self.annotationsErrorSample.repaint() |
|
510 self.editorColours["AnnotationsErrorForeground"] = colour |
|
511 |
|
512 @pyqtSlot() |
|
513 def on_annotationsErrorBgButton_clicked(self): |
|
514 """ |
|
515 Private slot to set the background colour of the error annotations. |
|
516 """ |
|
517 colour = QColorDialog.getColor( |
|
518 self.editorColours["AnnotationsErrorBackground"]) |
|
519 if colour.isValid(): |
|
520 pl = self.annotationsErrorSample.palette() |
|
521 pl.setColor(QPalette.Base, colour) |
|
522 self.annotationsErrorSample.setPalette(pl) |
|
523 self.annotationsErrorSample.repaint() |
|
524 self.editorColours["AnnotationsErrorBackground"] = colour |
|
525 |
|
526 @pyqtSlot() |
|
527 def on_annotationsStyleWarningFgButton_clicked(self): |
|
528 """ |
|
529 Private slot to set the foreground colour of the style annotations. |
|
530 """ |
|
531 colour = QColorDialog.getColor( |
|
532 self.editorColours["AnnotationsStyleForeground"]) |
|
533 if colour.isValid(): |
|
534 pl = self.annotationsStyleWarningSample.palette() |
|
535 pl.setColor(QPalette.Text, colour) |
|
536 self.annotationsStyleWarningSample.setPalette(pl) |
|
537 self.annotationsStyleWarningSample.repaint() |
|
538 self.editorColours["AnnotationsStyleForeground"] = colour |
|
539 |
|
540 @pyqtSlot() |
|
541 def on_annotationsStyleWarningBgButton_clicked(self): |
|
542 """ |
|
543 Private slot to set the background colour of the style annotations. |
|
544 """ |
|
545 colour = QColorDialog.getColor( |
|
546 self.editorColours["AnnotationsStyleBackground"]) |
|
547 if colour.isValid(): |
|
548 pl = self.annotationsStyleWarningSample.palette() |
|
549 pl.setColor(QPalette.Base, colour) |
|
550 self.annotationsStyleWarningSample.setPalette(pl) |
|
551 self.annotationsStyleWarningSample.repaint() |
|
552 self.editorColours["AnnotationsStyleackground"] = colour |
|
553 |
|
554 |
|
555 def create(dlg): |
|
556 """ |
|
557 Module function to create the configuration page. |
|
558 |
|
559 @param dlg reference to the configuration dialog |
|
560 @return reference to the instantiated page (ConfigurationPageBase) |
|
561 """ |
|
562 page = EditorStylesPage() |
|
563 return page |