Preferences/ConfigurationPages/EditorStylesPage.py

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

eric ide

mercurial