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