|
20 | 20 |
|
21 | 21 | from .. import debug, settings, stream |
22 | 22 | from ..streamhandler_helper import StreamHandlerHelper |
| 23 | +from . import QtPropertyInit |
23 | 24 | from .codehighlighter import CodeHighlighter |
24 | 25 | from .completer import PythonCompleter |
25 | 26 | from .suggest_path_quotes_dialog import SuggestPathQuotesDialog |
|
28 | 29 | class ConsolePrEdit(QTextEdit): |
29 | 30 | # Ensure the error prompt only shows up once. |
30 | 31 | _errorPrompted = False |
31 | | - # the color error messages are displayed in, can be set by stylesheets |
32 | | - _errorMessageColor = QColor(Qt.red) |
| 32 | + # the color error messages are displayed in, can be set by style-sheets via: |
| 33 | + # `ConsolePrEdit {qproperty-errorMessageColor: rgb(0, 255, 0)}` |
| 34 | + errorMessageColor = QtPropertyInit('_errorMessageColor', QColor(Qt.red)) |
33 | 35 |
|
34 | 36 | def __init__(self, parent): |
35 | 37 | super(ConsolePrEdit, self).__init__(parent) |
@@ -366,12 +368,6 @@ def completer(self): |
366 | 368 | """returns the completer instance that is associated with this editor""" |
367 | 369 | return self._completer |
368 | 370 |
|
369 | | - def errorMessageColor(self): |
370 | | - return self.__class__._errorMessageColor |
371 | | - |
372 | | - def setErrorMessageColor(self, color): |
373 | | - self.__class__._errorMessageColor = color |
374 | | - |
375 | 371 | def foregroundColor(self): |
376 | 372 | return self._foregroundColor |
377 | 373 |
|
@@ -835,7 +831,7 @@ def write(self, msg, error=False): |
835 | 831 | if not error: |
836 | 832 | charFormat.setForeground(self.stdoutColor()) |
837 | 833 | else: |
838 | | - charFormat.setForeground(self.errorMessageColor()) |
| 834 | + charFormat.setForeground(self.errorMessageColor) |
839 | 835 | self.setCurrentCharFormat(charFormat) |
840 | 836 |
|
841 | 837 | # If showing Error Hyperlinks... Sometimes (when a syntax error, at least), |
|
0 commit comments