Preferences/ConfigurationPages/EditorStylesPage.py

changeset 2905
a1ae4b297bc0
parent 2640
dedcd4f987e0
child 2964
84b65fb9e780
child 3056
9986ec0e559a
equal deleted inserted replaced
2904:1da821da961e 2905:a1ae4b297bc0
27 """ 27 """
28 super().__init__() 28 super().__init__()
29 self.setupUi(self) 29 self.setupUi(self)
30 self.setObjectName("EditorStylesPage") 30 self.setObjectName("EditorStylesPage")
31 31
32 from QScintilla.QsciScintillaCompat import QsciScintillaCompat, QSCINTILLA_VERSION 32 from QScintilla.QsciScintillaCompat import (
33 QsciScintillaCompat, QSCINTILLA_VERSION)
33 self.foldStyles = [ 34 self.foldStyles = [
34 QsciScintilla.PlainFoldStyle, 35 QsciScintilla.PlainFoldStyle,
35 QsciScintilla.CircledFoldStyle, 36 QsciScintilla.CircledFoldStyle,
36 QsciScintilla.BoxedFoldStyle, 37 QsciScintilla.BoxedFoldStyle,
37 QsciScintilla.CircledTreeFoldStyle, 38 QsciScintilla.CircledTreeFoldStyle,
44 QsciScintilla.EdgeNone, 45 QsciScintilla.EdgeNone,
45 QsciScintilla.EdgeLine, 46 QsciScintilla.EdgeLine,
46 QsciScintilla.EdgeBackground 47 QsciScintilla.EdgeBackground
47 ] 48 ]
48 49
49 self.wrapModeComboBox.addItem(self.trUtf8("Disabled"), 50 self.wrapModeComboBox.addItem(
50 QsciScintilla.WrapNone) 51 self.trUtf8("Disabled"), QsciScintilla.WrapNone)
51 self.wrapModeComboBox.addItem(self.trUtf8("Word Boundary"), 52 self.wrapModeComboBox.addItem(
52 QsciScintilla.WrapWord) 53 self.trUtf8("Word Boundary"), QsciScintilla.WrapWord)
53 self.wrapModeComboBox.addItem(self.trUtf8("Character Boundary"), 54 self.wrapModeComboBox.addItem(
54 QsciScintilla.WrapCharacter) 55 self.trUtf8("Character Boundary"), QsciScintilla.WrapCharacter)
55 self.wrapVisualComboBox.addItem(self.trUtf8("No Indicator"), 56 self.wrapVisualComboBox.addItem(
56 QsciScintilla.WrapFlagNone) 57 self.trUtf8("No Indicator"), QsciScintilla.WrapFlagNone)
57 self.wrapVisualComboBox.addItem(self.trUtf8("Indicator by Text"), 58 self.wrapVisualComboBox.addItem(
58 QsciScintilla.WrapFlagByText) 59 self.trUtf8("Indicator by Text"), QsciScintilla.WrapFlagByText)
59 self.wrapVisualComboBox.addItem(self.trUtf8("Indicator by Margin"), 60 self.wrapVisualComboBox.addItem(
60 QsciScintilla.WrapFlagByBorder) 61 self.trUtf8("Indicator by Margin"), QsciScintilla.WrapFlagByBorder)
61 if QSCINTILLA_VERSION() >= 0x020700: 62 if QSCINTILLA_VERSION() >= 0x020700:
62 self.wrapVisualComboBox.addItem( 63 self.wrapVisualComboBox.addItem(
63 self.trUtf8("Indicator in Line Number Margin"), 64 self.trUtf8("Indicator in Line Number Margin"),
64 QsciScintilla.WrapFlagInMargin) 65 QsciScintilla.WrapFlagInMargin)
65 66
94 Preferences.getEditor("CustomSelectionColours")) 95 Preferences.getEditor("CustomSelectionColours"))
95 self.extentSelEolCheckBox.setChecked( 96 self.extentSelEolCheckBox.setChecked(
96 Preferences.getEditor("ExtendSelectionToEol")) 97 Preferences.getEditor("ExtendSelectionToEol"))
97 98
98 self.initColour("CaretForeground", self.caretForegroundButton, 99 self.initColour("CaretForeground", self.caretForegroundButton,
99 Preferences.getEditorColour) 100 Preferences.getEditorColour)
100 self.initColour("CaretLineBackground", self.caretlineBackgroundButton, 101 self.initColour("CaretLineBackground", self.caretlineBackgroundButton,
101 Preferences.getEditorColour, hasAlpha=True) 102 Preferences.getEditorColour, hasAlpha=True)
102 self.initColour("SelectionForeground", self.selectionForegroundButton, 103 self.initColour("SelectionForeground", self.selectionForegroundButton,
103 Preferences.getEditorColour) 104 Preferences.getEditorColour)
104 self.initColour("SelectionBackground", self.selectionBackgroundButton, 105 self.initColour("SelectionBackground", self.selectionBackgroundButton,
105 Preferences.getEditorColour, hasAlpha=True) 106 Preferences.getEditorColour, hasAlpha=True)
106 self.initColour("CurrentMarker", self.currentLineMarkerButton, 107 self.initColour("CurrentMarker", self.currentLineMarkerButton,
107 Preferences.getEditorColour, hasAlpha=True) 108 Preferences.getEditorColour, hasAlpha=True)
108 self.initColour("ErrorMarker", self.errorMarkerButton, 109 self.initColour("ErrorMarker", self.errorMarkerButton,
109 Preferences.getEditorColour, hasAlpha=True) 110 Preferences.getEditorColour, hasAlpha=True)
110 self.initColour("MarginsForeground", self.marginsForegroundButton, 111 self.initColour("MarginsForeground", self.marginsForegroundButton,
111 Preferences.getEditorColour) 112 Preferences.getEditorColour)
112 self.initColour("MarginsBackground", self.marginsBackgroundButton, 113 self.initColour("MarginsBackground", self.marginsBackgroundButton,
113 Preferences.getEditorColour) 114 Preferences.getEditorColour)
114 self.initColour("FoldmarginBackground", self.foldmarginBackgroundButton, 115 self.initColour("FoldmarginBackground",
115 Preferences.getEditorColour) 116 self.foldmarginBackgroundButton,
116 self.initColour("FoldMarkersForeground", self.foldmarkersForegroundButton, 117 Preferences.getEditorColour)
117 Preferences.getEditorColour) 118 self.initColour("FoldMarkersForeground",
118 self.initColour("FoldMarkersBackground", self.foldmarkersBackgroundButton, 119 self.foldmarkersForegroundButton,
119 Preferences.getEditorColour) 120 Preferences.getEditorColour)
121 self.initColour("FoldMarkersBackground",
122 self.foldmarkersBackgroundButton,
123 Preferences.getEditorColour)
120 124
121 self.editorColours = {} 125 self.editorColours = {}
122 self.editorColours["AnnotationsWarningForeground"] = \ 126 self.editorColours["AnnotationsWarningForeground"] = \
123 QColor(Preferences.getEditorColour("AnnotationsWarningForeground")) 127 QColor(Preferences.getEditorColour("AnnotationsWarningForeground"))
124 self.editorColours["AnnotationsWarningBackground"] = \ 128 self.editorColours["AnnotationsWarningBackground"] = \
125 QColor(Preferences.getEditorColour("AnnotationsWarningBackground")) 129 QColor(Preferences.getEditorColour("AnnotationsWarningBackground"))
126 self.editorColours["AnnotationsErrorForeground"] = \ 130 self.editorColours["AnnotationsErrorForeground"] = \
127 QColor(Preferences.getEditorColour("AnnotationsErrorForeground")) 131 QColor(Preferences.getEditorColour("AnnotationsErrorForeground"))
128 self.editorColours["AnnotationsErrorBackground"] = \ 132 self.editorColours["AnnotationsErrorBackground"] = \
129 QColor(Preferences.getEditorColour("AnnotationsErrorBackground")) 133 QColor(Preferences.getEditorColour("AnnotationsErrorBackground"))
134 self.editorColours["AnnotationsStyleForeground"] = \
135 QColor(Preferences.getEditorColour("AnnotationsStyleForeground"))
136 self.editorColours["AnnotationsStyleBackground"] = \
137 QColor(Preferences.getEditorColour("AnnotationsStyleBackground"))
130 138
131 self.eolCheckBox.setChecked(Preferences.getEditor("ShowEOL")) 139 self.eolCheckBox.setChecked(Preferences.getEditor("ShowEOL"))
132 self.wrapModeComboBox.setCurrentIndex(self.wrapModeComboBox.findData( 140 self.wrapModeComboBox.setCurrentIndex(self.wrapModeComboBox.findData(
133 Preferences.getEditor("WrapLongLinesMode"))) 141 Preferences.getEditor("WrapLongLinesMode")))
134 self.wrapVisualComboBox.setCurrentIndex(self.wrapVisualComboBox.findData( 142 self.wrapVisualComboBox.setCurrentIndex(
135 Preferences.getEditor("WrapVisualFlag"))) 143 self.wrapVisualComboBox.findData(
144 Preferences.getEditor("WrapVisualFlag")))
136 145
137 self.edgeModeCombo.setCurrentIndex( 146 self.edgeModeCombo.setCurrentIndex(
138 self.edgeModes.index(Preferences.getEditor("EdgeMode"))) 147 self.edgeModes.index(Preferences.getEditor("EdgeMode")))
139 self.edgeLineColumnSlider.setValue( 148 self.edgeLineColumnSlider.setValue(
140 Preferences.getEditor("EdgeColumn")) 149 Preferences.getEditor("EdgeColumn"))
141 self.initColour("Edge", self.edgeBackgroundColorButton, 150 self.initColour(
151 "Edge", self.edgeBackgroundColorButton,
142 Preferences.getEditorColour) 152 Preferences.getEditorColour)
143 153
144 self.bracehighlightingCheckBox.setChecked( 154 self.bracehighlightingCheckBox.setChecked(
145 Preferences.getEditor("BraceHighlighting")) 155 Preferences.getEditor("BraceHighlighting"))
146 self.initColour("MatchingBrace", self.matchingBracesButton, 156 self.initColour("MatchingBrace", self.matchingBracesButton,
147 Preferences.getEditorColour) 157 Preferences.getEditorColour)
148 self.initColour("MatchingBraceBack", self.matchingBracesBackButton, 158 self.initColour("MatchingBraceBack", self.matchingBracesBackButton,
149 Preferences.getEditorColour) 159 Preferences.getEditorColour)
150 self.initColour("NonmatchingBrace", self.nonmatchingBracesButton, 160 self.initColour("NonmatchingBrace", self.nonmatchingBracesButton,
151 Preferences.getEditorColour) 161 Preferences.getEditorColour)
152 self.initColour("NonmatchingBraceBack", self.nonmatchingBracesBackButton, 162 self.initColour("NonmatchingBraceBack",
153 Preferences.getEditorColour) 163 self.nonmatchingBracesBackButton,
164 Preferences.getEditorColour)
154 165
155 self.zoomfactorSlider.setValue( 166 self.zoomfactorSlider.setValue(
156 Preferences.getEditor("ZoomFactor")) 167 Preferences.getEditor("ZoomFactor"))
157 168
158 self.whitespaceCheckBox.setChecked( 169 self.whitespaceCheckBox.setChecked(
159 Preferences.getEditor("ShowWhitespace")) 170 Preferences.getEditor("ShowWhitespace"))
160 self.whitespaceSizeSpinBox.setValue( 171 self.whitespaceSizeSpinBox.setValue(
161 Preferences.getEditor("WhitespaceSize")) 172 Preferences.getEditor("WhitespaceSize"))
162 self.initColour("WhitespaceForeground", self.whitespaceForegroundButton, 173 self.initColour("WhitespaceForeground",
163 Preferences.getEditorColour) 174 self.whitespaceForegroundButton,
164 self.initColour("WhitespaceBackground", self.whitespaceBackgroundButton, 175 Preferences.getEditorColour)
165 Preferences.getEditorColour) 176 self.initColour("WhitespaceBackground",
177 self.whitespaceBackgroundButton,
178 Preferences.getEditorColour)
166 if not hasattr(QsciScintilla, "setWhitespaceForegroundColor"): 179 if not hasattr(QsciScintilla, "setWhitespaceForegroundColor"):
167 self.whitespaceSizeSpinBox.setEnabled(False) 180 self.whitespaceSizeSpinBox.setEnabled(False)
168 self.whitespaceForegroundButton.setEnabled(False) 181 self.whitespaceForegroundButton.setEnabled(False)
169 self.whitespaceBackgroundButton.setEnabled(False) 182 self.whitespaceBackgroundButton.setEnabled(False)
170 183
174 self.enableAnnotationsCheckBox.setChecked( 187 self.enableAnnotationsCheckBox.setChecked(
175 Preferences.getEditor("AnnotationsEnabled")) 188 Preferences.getEditor("AnnotationsEnabled"))
176 189
177 self.editAreaOverrideCheckBox.setChecked( 190 self.editAreaOverrideCheckBox.setChecked(
178 Preferences.getEditor("OverrideEditAreaColours")) 191 Preferences.getEditor("OverrideEditAreaColours"))
179 self.initColour("EditAreaForeground", self.editAreaForegroundButton, 192 self.initColour(
193 "EditAreaForeground", self.editAreaForegroundButton,
180 Preferences.getEditorColour) 194 Preferences.getEditorColour)
181 self.initColour("EditAreaBackground", self.editAreaBackgroundButton, 195 self.initColour(
196 "EditAreaBackground", self.editAreaBackgroundButton,
182 Preferences.getEditorColour) 197 Preferences.getEditorColour)
183 198
184 self.enableChangeTraceCheckBox.setChecked( 199 self.enableChangeTraceCheckBox.setChecked(
185 Preferences.getEditor("OnlineChangeTrace")) 200 Preferences.getEditor("OnlineChangeTrace"))
186 self.changeTraceTimeoutSpinBox.setValue( 201 self.changeTraceTimeoutSpinBox.setValue(
187 Preferences.getEditor("OnlineChangeTraceInterval")) 202 Preferences.getEditor("OnlineChangeTraceInterval"))
188 self.initColour("OnlineChangeTraceMarkerUnsaved", 203 self.initColour("OnlineChangeTraceMarkerUnsaved",
189 self.changeMarkerUnsavedColorButton, 204 self.changeMarkerUnsavedColorButton,
190 Preferences.getEditorColour) 205 Preferences.getEditorColour)
191 self.initColour("OnlineChangeTraceMarkerSaved", 206 self.initColour("OnlineChangeTraceMarkerSaved",
192 self.changeMarkerSavedColorButton, 207 self.changeMarkerSavedColorButton,
193 Preferences.getEditorColour) 208 Preferences.getEditorColour)
194 209
195 def save(self): 210 def save(self):
196 """ 211 """
197 Public slot to save the Editor Styles configuration. 212 Public slot to save the Editor Styles configuration.
198 """ 213 """
199 Preferences.setEditor("FoldingStyle", 214 Preferences.setEditor(
215 "FoldingStyle",
200 self.foldStyles[self.foldingStyleComboBox.currentIndex()]) 216 self.foldStyles[self.foldingStyleComboBox.currentIndex()])
201 Preferences.setEditorOtherFonts("MarginsFont", self.marginsFont) 217 Preferences.setEditorOtherFonts(
202 Preferences.setEditorOtherFonts("DefaultFont", self.defaultFont) 218 "MarginsFont", self.marginsFont)
203 Preferences.setEditorOtherFonts("MonospacedFont", self.monospacedFont) 219 Preferences.setEditorOtherFonts(
204 Preferences.setEditor("UseMonospacedFont", 220 "DefaultFont", self.defaultFont)
205 self.monospacedCheckBox.isChecked()) 221 Preferences.setEditorOtherFonts(
206 222 "MonospacedFont", self.monospacedFont)
207 Preferences.setEditor("LinenoMargin", 223 Preferences.setEditor(
208 self.linenoCheckBox.isChecked()) 224 "UseMonospacedFont", self.monospacedCheckBox.isChecked())
209 Preferences.setEditor("FoldingMargin", 225
210 self.foldingCheckBox.isChecked()) 226 Preferences.setEditor(
211 Preferences.setEditor("UnifiedMargins", 227 "LinenoMargin", self.linenoCheckBox.isChecked())
212 self.unifiedMarginsCheckBox.isChecked()) 228 Preferences.setEditor(
213 229 "FoldingMargin", self.foldingCheckBox.isChecked())
214 Preferences.setEditor("CaretLineVisible", 230 Preferences.setEditor(
215 self.caretlineVisibleCheckBox.isChecked()) 231 "UnifiedMargins", self.unifiedMarginsCheckBox.isChecked())
216 Preferences.setEditor("ColourizeSelText", 232
217 self.colourizeSelTextCheckBox.isChecked()) 233 Preferences.setEditor(
218 Preferences.setEditor("CustomSelectionColours", 234 "CaretLineVisible", self.caretlineVisibleCheckBox.isChecked())
219 self.customSelColourCheckBox.isChecked()) 235 Preferences.setEditor(
220 Preferences.setEditor("ExtendSelectionToEol", 236 "ColourizeSelText", self.colourizeSelTextCheckBox.isChecked())
221 self.extentSelEolCheckBox.isChecked()) 237 Preferences.setEditor(
222 238 "CustomSelectionColours", self.customSelColourCheckBox.isChecked())
223 Preferences.setEditor("CaretWidth", 239 Preferences.setEditor(
224 self.caretWidthSpinBox.value()) 240 "ExtendSelectionToEol", self.extentSelEolCheckBox.isChecked())
225 241
226 Preferences.setEditor("ShowEOL", 242 Preferences.setEditor(
227 self.eolCheckBox.isChecked()) 243 "CaretWidth", self.caretWidthSpinBox.value())
228 Preferences.setEditor("WrapLongLinesMode", 244
229 self.wrapModeComboBox.itemData(self.wrapModeComboBox.currentIndex())) 245 Preferences.setEditor(
230 Preferences.setEditor("WrapVisualFlag", 246 "ShowEOL", self.eolCheckBox.isChecked())
231 self.wrapVisualComboBox.itemData(self.wrapVisualComboBox.currentIndex())) 247 Preferences.setEditor(
232 Preferences.setEditor("EdgeMode", 248 "WrapLongLinesMode", self.wrapModeComboBox.itemData(
233 self.edgeModes[self.edgeModeCombo.currentIndex()]) 249 self.wrapModeComboBox.currentIndex()))
234 Preferences.setEditor("EdgeColumn", 250 Preferences.setEditor(
235 self.edgeLineColumnSlider.value()) 251 "WrapVisualFlag", self.wrapVisualComboBox.itemData(
236 252 self.wrapVisualComboBox.currentIndex()))
237 Preferences.setEditor("BraceHighlighting", 253 Preferences.setEditor(
238 self.bracehighlightingCheckBox.isChecked()) 254 "EdgeMode", self.edgeModes[self.edgeModeCombo.currentIndex()])
239 255 Preferences.setEditor(
240 Preferences.setEditor("ZoomFactor", 256 "EdgeColumn", self.edgeLineColumnSlider.value())
241 self.zoomfactorSlider.value()) 257
242 258 Preferences.setEditor(
243 Preferences.setEditor("ShowWhitespace", 259 "BraceHighlighting", self.bracehighlightingCheckBox.isChecked())
244 self.whitespaceCheckBox.isChecked()) 260
245 Preferences.setEditor("WhitespaceSize", 261 Preferences.setEditor(
246 self.whitespaceSizeSpinBox.value()) 262 "ZoomFactor", self.zoomfactorSlider.value())
247 263
248 Preferences.setEditor("MiniContextMenu", 264 Preferences.setEditor(
249 self.miniMenuCheckBox.isChecked()) 265 "ShowWhitespace", self.whitespaceCheckBox.isChecked())
250 266 Preferences.setEditor(
251 Preferences.setEditor("AnnotationsEnabled", 267 "WhitespaceSize", self.whitespaceSizeSpinBox.value())
252 self.enableAnnotationsCheckBox.isChecked()) 268
253 269 Preferences.setEditor(
254 Preferences.setEditor("OverrideEditAreaColours", 270 "MiniContextMenu", self.miniMenuCheckBox.isChecked())
271
272 Preferences.setEditor(
273 "AnnotationsEnabled", self.enableAnnotationsCheckBox.isChecked())
274
275 Preferences.setEditor(
276 "OverrideEditAreaColours",
255 self.editAreaOverrideCheckBox.isChecked()) 277 self.editAreaOverrideCheckBox.isChecked())
256 278
257 Preferences.setEditor("OnlineChangeTrace", 279 Preferences.setEditor(
258 self.enableChangeTraceCheckBox.isChecked()) 280 "OnlineChangeTrace", self.enableChangeTraceCheckBox.isChecked())
259 Preferences.setEditor("OnlineChangeTraceInterval", 281 Preferences.setEditor(
282 "OnlineChangeTraceInterval",
260 self.changeTraceTimeoutSpinBox.value()) 283 self.changeTraceTimeoutSpinBox.value())
261 284
262 self.saveColours(Preferences.setEditorColour) 285 self.saveColours(Preferences.setEditorColour)
263 for key in list(self.editorColours.keys()): 286 for key in list(self.editorColours.keys()):
264 Preferences.setEditorColour(key, self.editorColours[key]) 287 Preferences.setEditorColour(key, self.editorColours[key])
266 @pyqtSlot() 289 @pyqtSlot()
267 def on_linenumbersFontButton_clicked(self): 290 def on_linenumbersFontButton_clicked(self):
268 """ 291 """
269 Private method used to select the font for the editor margins. 292 Private method used to select the font for the editor margins.
270 """ 293 """
271 self.marginsFont = self.selectFont(self.marginsFontSample, self.marginsFont) 294 self.marginsFont = self.selectFont(
295 self.marginsFontSample, self.marginsFont)
272 296
273 @pyqtSlot() 297 @pyqtSlot()
274 def on_defaultFontButton_clicked(self): 298 def on_defaultFontButton_clicked(self):
275 """ 299 """
276 Private method used to select the default font for the editor. 300 Private method used to select the default font for the editor.
277 """ 301 """
278 self.defaultFont = self.selectFont(self.defaultFontSample, self.defaultFont) 302 self.defaultFont = self.selectFont(
303 self.defaultFontSample, self.defaultFont)
279 304
280 @pyqtSlot() 305 @pyqtSlot()
281 def on_monospacedFontButton_clicked(self): 306 def on_monospacedFontButton_clicked(self):
282 """ 307 """
283 Private method used to select the font to be used as the monospaced font. 308 Private method used to select the font to be used as the monospaced
284 """ 309 font.
285 self.monospacedFont = \ 310 """
286 self.selectFont(self.monospacedFontSample, self.monospacedFont) 311 self.monospacedFont = self.selectFont(
312 self.monospacedFontSample, self.monospacedFont)
287 313
288 def polishPage(self): 314 def polishPage(self):
289 """ 315 """
290 Public slot to perform some polishing actions. 316 Public slot to perform some polishing actions.
291 """ 317 """
292 self.marginsFontSample.setFont(self.marginsFont) 318 self.marginsFontSample.setFont(self.marginsFont)
293 self.defaultFontSample.setFont(self.defaultFont) 319 self.defaultFontSample.setFont(self.defaultFont)
294 self.monospacedFontSample.setFont(self.monospacedFont) 320 self.monospacedFontSample.setFont(self.monospacedFont)
295 321
296 pl = self.annotationsWarningSample.palette() 322 pl = self.annotationsWarningSample.palette()
297 pl.setColor(QPalette.Text, self.editorColours["AnnotationsWarningForeground"]) 323 pl.setColor(QPalette.Text,
298 pl.setColor(QPalette.Base, self.editorColours["AnnotationsWarningBackground"]) 324 self.editorColours["AnnotationsWarningForeground"])
325 pl.setColor(QPalette.Base,
326 self.editorColours["AnnotationsWarningBackground"])
299 self.annotationsWarningSample.setPalette(pl) 327 self.annotationsWarningSample.setPalette(pl)
300 self.annotationsWarningSample.repaint() 328 self.annotationsWarningSample.repaint()
301 329
302 pl = self.annotationsErrorSample.palette() 330 pl = self.annotationsErrorSample.palette()
303 pl.setColor(QPalette.Text, self.editorColours["AnnotationsErrorForeground"]) 331 pl.setColor(QPalette.Text,
304 pl.setColor(QPalette.Base, self.editorColours["AnnotationsErrorBackground"]) 332 self.editorColours["AnnotationsErrorForeground"])
333 pl.setColor(QPalette.Base,
334 self.editorColours["AnnotationsErrorBackground"])
305 self.annotationsErrorSample.setPalette(pl) 335 self.annotationsErrorSample.setPalette(pl)
306 self.annotationsErrorSample.repaint() 336 self.annotationsErrorSample.repaint()
337
338 pl = self.annotationsStyleWarningSample.palette()
339 pl.setColor(QPalette.Text,
340 self.editorColours["AnnotationsStyleForeground"])
341 pl.setColor(QPalette.Base,
342 self.editorColours["AnnotationsStyleBackground"])
343 self.annotationsStyleWarningSample.setPalette(pl)
344 self.annotationsStyleWarningSample.repaint()
307 345
308 @pyqtSlot() 346 @pyqtSlot()
309 def on_annotationsWarningFgButton_clicked(self): 347 def on_annotationsWarningFgButton_clicked(self):
310 """ 348 """
311 Private slot to set the foreground colour of the warning annotations. 349 Private slot to set the foreground colour of the warning annotations.
312 """ 350 """
313 colour = QColorDialog.getColor(self.editorColours["AnnotationsWarningForeground"]) 351 colour = QColorDialog.getColor(
352 self.editorColours["AnnotationsWarningForeground"])
314 if colour.isValid(): 353 if colour.isValid():
315 pl = self.annotationsWarningSample.palette() 354 pl = self.annotationsWarningSample.palette()
316 pl.setColor(QPalette.Text, colour) 355 pl.setColor(QPalette.Text, colour)
317 self.annotationsWarningSample.setPalette(pl) 356 self.annotationsWarningSample.setPalette(pl)
318 self.annotationsWarningSample.repaint() 357 self.annotationsWarningSample.repaint()
321 @pyqtSlot() 360 @pyqtSlot()
322 def on_annotationsWarningBgButton_clicked(self): 361 def on_annotationsWarningBgButton_clicked(self):
323 """ 362 """
324 Private slot to set the background colour of the warning annotations. 363 Private slot to set the background colour of the warning annotations.
325 """ 364 """
326 colour = QColorDialog.getColor(self.editorColours["AnnotationsWarningBackground"]) 365 colour = QColorDialog.getColor(
366 self.editorColours["AnnotationsWarningBackground"])
327 if colour.isValid(): 367 if colour.isValid():
328 pl = self.annotationsWarningSample.palette() 368 pl = self.annotationsWarningSample.palette()
329 pl.setColor(QPalette.Base, colour) 369 pl.setColor(QPalette.Base, colour)
330 self.annotationsWarningSample.setPalette(pl) 370 self.annotationsWarningSample.setPalette(pl)
331 self.annotationsWarningSample.repaint() 371 self.annotationsWarningSample.repaint()
334 @pyqtSlot() 374 @pyqtSlot()
335 def on_annotationsErrorFgButton_clicked(self): 375 def on_annotationsErrorFgButton_clicked(self):
336 """ 376 """
337 Private slot to set the foreground colour of the error annotations. 377 Private slot to set the foreground colour of the error annotations.
338 """ 378 """
339 colour = QColorDialog.getColor(self.editorColours["AnnotationsErrorForeground"]) 379 colour = QColorDialog.getColor(
380 self.editorColours["AnnotationsErrorForeground"])
340 if colour.isValid(): 381 if colour.isValid():
341 pl = self.annotationsErrorSample.palette() 382 pl = self.annotationsErrorSample.palette()
342 pl.setColor(QPalette.Text, colour) 383 pl.setColor(QPalette.Text, colour)
343 self.annotationsErrorSample.setPalette(pl) 384 self.annotationsErrorSample.setPalette(pl)
344 self.annotationsErrorSample.repaint() 385 self.annotationsErrorSample.repaint()
347 @pyqtSlot() 388 @pyqtSlot()
348 def on_annotationsErrorBgButton_clicked(self): 389 def on_annotationsErrorBgButton_clicked(self):
349 """ 390 """
350 Private slot to set the background colour of the error annotations. 391 Private slot to set the background colour of the error annotations.
351 """ 392 """
352 colour = QColorDialog.getColor(self.editorColours["AnnotationsErrorBackground"]) 393 colour = QColorDialog.getColor(
394 self.editorColours["AnnotationsErrorBackground"])
353 if colour.isValid(): 395 if colour.isValid():
354 pl = self.annotationsErrorSample.palette() 396 pl = self.annotationsErrorSample.palette()
355 pl.setColor(QPalette.Base, colour) 397 pl.setColor(QPalette.Base, colour)
356 self.annotationsErrorSample.setPalette(pl) 398 self.annotationsErrorSample.setPalette(pl)
357 self.annotationsErrorSample.repaint() 399 self.annotationsErrorSample.repaint()
358 self.editorColours["AnnotationsErrorBackground"] = colour 400 self.editorColours["AnnotationsErrorBackground"] = colour
401
402 @pyqtSlot()
403 def on_annotationsStyleWarningFgButton_clicked(self):
404 """
405 Private slot to set the foreground colour of the style annotations.
406 """
407 colour = QColorDialog.getColor(
408 self.editorColours["AnnotationsStyleForeground"])
409 if colour.isValid():
410 pl = self.annotationsStyleWarningSample.palette()
411 pl.setColor(QPalette.Text, colour)
412 self.annotationsStyleWarningSample.setPalette(pl)
413 self.annotationsStyleWarningSample.repaint()
414 self.editorColours["AnnotationsStyleForeground"] = colour
415
416 @pyqtSlot()
417 def on_annotationsStyleWarningBgButton_clicked(self):
418 """
419 Private slot to set the background colour of the style annotations.
420 """
421 colour = QColorDialog.getColor(
422 self.editorColours["AnnotationsStyleBackground"])
423 if colour.isValid():
424 pl = self.annotationsStyleWarningSample.palette()
425 pl.setColor(QPalette.Base, colour)
426 self.annotationsStyleWarningSample.setPalette(pl)
427 self.annotationsStyleWarningSample.repaint()
428 self.editorColours["AnnotationsStyleackground"] = colour
359 429
360 430
361 def create(dlg): 431 def create(dlg):
362 """ 432 """
363 Module function to create the configuration page. 433 Module function to create the configuration page.

eric ide

mercurial