Skip to content
Permalink
Browse files

Allow error indicator colors to be controlled for code editor color s…

…cheme
  • Loading branch information
nyalldawson committed Oct 13, 2020
1 parent b02d7b3 commit 0a3f40a191f4f9d9f8ede138e8b8d8eea376f84e
@@ -891,6 +891,7 @@
<file>themes/default/mActionLabelAnchorStart.svg</file>
<file>themes/default/transformation.svg</file>
<file>themes/default/mIconCodeEditor.svg</file>
<file>themes/default/console/iconSyntaxErrorConsoleParams.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
@@ -0,0 +1 @@
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" fill="param(fill)" r="7.5" stroke="param(outline)"/><path d="m9 3-.2 7.3h-1.67l-.128-7.3zm-2 9h2v2h-2z" fill="param(outline)"/></svg>
@@ -54,6 +54,7 @@ Defines a color scheme for use in QgsCodeEditor widgets.
Edge,
Fold,
Error,
ErrorBackground,
FoldIconForeground,
FoldIconHalo,
IndentationGuide,
@@ -66,6 +66,7 @@ QgsCodeEditorOptionsWidget::QgsCodeEditorOptionsWidget( QWidget *parent )
{QgsCodeEditorColorScheme::ColorRole::Edge, mColorEdge },
{QgsCodeEditorColorScheme::ColorRole::Fold, mColorFold },
{QgsCodeEditorColorScheme::ColorRole::Error, mColorError },
{QgsCodeEditorColorScheme::ColorRole::ErrorBackground, mColorErrorBackground },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, mColorFoldIcon },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, mColorFoldIconHalo },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, mColorIndentation },
@@ -62,6 +62,7 @@ QMap< QgsCodeEditorColorScheme::ColorRole, QString > QgsCodeEditor::sColorRoleTo
{QgsCodeEditorColorScheme::ColorRole::Edge, QStringLiteral( "edgeColor" ) },
{QgsCodeEditorColorScheme::ColorRole::Fold, QStringLiteral( "foldColor" ) },
{QgsCodeEditorColorScheme::ColorRole::Error, QStringLiteral( "stderrFontColor" ) },
{QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QStringLiteral( "stderrBackgroundColor" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QStringLiteral( "foldIconForeground" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QStringLiteral( "foldIconHalo" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QStringLiteral( "indentationGuide" ) },
@@ -89,8 +90,6 @@ QgsCodeEditor::QgsCodeEditor( QWidget *parent, const QString &title, bool foldin
SendScintilla( SCI_SETMULTIPASTE, 1 );
SendScintilla( SCI_SETVIRTUALSPACEOPTIONS, SCVS_RECTANGULARSELECTION );

markerDefine( QgsApplication::getThemePixmap( "console/iconSyntaxErrorConsole.svg" ),
MARKER_NUMBER );
SendScintilla( SCI_SETMARGINTYPEN, 3, SC_MARGIN_SYMBOL );
SendScintilla( SCI_SETMARGINMASKN, 3, 1 << MARKER_NUMBER );
setMarginWidth( 3, 0 );
@@ -248,6 +247,9 @@ void QgsCodeEditor::setSciWidget()
// autocomplete
setAutoCompletionThreshold( 2 );
setAutoCompletionSource( QsciScintilla::AcsAPIs );

markerDefine( QgsApplication::getThemePixmap( "console/iconSyntaxErrorConsoleParams.svg", lexerColor( QgsCodeEditorColorScheme::ColorRole::Error ),
lexerColor( QgsCodeEditorColorScheme::ColorRole::ErrorBackground ), 16 ), MARKER_NUMBER );
}

void QgsCodeEditor::setTitle( const QString &title )
@@ -360,6 +362,7 @@ QColor QgsCodeEditor::defaultColor( QgsCodeEditorColorScheme::ColorRole role, co
{QgsCodeEditorColorScheme::ColorRole::Edge, QStringLiteral( "edgeColor" ) },
{QgsCodeEditorColorScheme::ColorRole::Fold, QStringLiteral( "foldColor" ) },
{QgsCodeEditorColorScheme::ColorRole::Error, QStringLiteral( "stderrFontColor" ) },
{QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QStringLiteral( "stderrBackground" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QStringLiteral( "foldIconForeground" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QStringLiteral( "foldIconHalo" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QStringLiteral( "indentationGuide" ) },
@@ -460,7 +463,7 @@ void QgsCodeEditor::addWarning( const int lineNumber, const QString &warning )
font.setItalic( true );
const QsciStyle styleAnn = QsciStyle( -1, QStringLiteral( "Annotation" ),
lexerColor( QgsCodeEditorColorScheme::ColorRole::Error ),
QColor( 255, 200, 0 ), // TODO - expose as configurable color!
lexerColor( QgsCodeEditorColorScheme::ColorRole::ErrorBackground ),
font,
true );
annotate( lineNumber, warning, styleAnn );
@@ -67,6 +67,7 @@ class GUI_EXPORT QgsCodeEditorColorScheme
Edge, //!< Edge color
Fold, //!< Fold color
Error, //!< Error color
ErrorBackground, //!< Error background color
FoldIconForeground, //!< Fold icon foreground color
FoldIconHalo, //!< Fold icon halo color
IndentationGuide, //!< Indentation guide line
@@ -52,6 +52,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry()
{QgsCodeEditorColorScheme::ColorRole::Edge, QColor( "#efefef" ) },
{QgsCodeEditorColorScheme::ColorRole::Fold, QColor( "#efefef" ) },
{QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#e31a1c" ) },
{QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QColor( "#ffffff" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#ffffff" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#000000" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#d5d5d5" ) },
@@ -92,6 +93,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry()
{QgsCodeEditorColorScheme::ColorRole::Edge, QColor( "#EEE8D5" ) },
{QgsCodeEditorColorScheme::ColorRole::Fold, QColor( "#EEE8D5" ) },
{QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#DC322F" ) },
{QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QColor( "#ffffff" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#ffffff" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#93a1a1" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#c2beb3" ) },
@@ -132,6 +134,7 @@ QgsCodeEditorColorSchemeRegistry::QgsCodeEditorColorSchemeRegistry()
{QgsCodeEditorColorScheme::ColorRole::Edge, QColor( "#586E75" ) },
{QgsCodeEditorColorScheme::ColorRole::Fold, QColor( "#073642" ) },
{QgsCodeEditorColorScheme::ColorRole::Error, QColor( "#DC322F" ) },
{QgsCodeEditorColorScheme::ColorRole::ErrorBackground, QColor( "#ffffff" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconForeground, QColor( "#586e75" ) },
{QgsCodeEditorColorScheme::ColorRole::FoldIconHalo, QColor( "#839496" ) },
{QgsCodeEditorColorScheme::ColorRole::IndentationGuide, QColor( "#586E75" ) },
@@ -297,13 +297,6 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="9" column="5">
<widget class="QgsColorButton" name="mColorFold">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="3">
<widget class="QgsColorButton" name="mColorMarginForeground">
<property name="text">
@@ -479,13 +472,6 @@
</property>
</widget>
</item>
<item row="10" column="5">
<widget class="QgsColorButton" name="mColorCaretLine">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="5">
<widget class="QgsColorButton" name="mColorNumber">
<property name="text">
@@ -535,13 +521,6 @@
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QLabel" name="label_38">
<property name="text">
<string>Indentation guide</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="5">
<widget class="QComboBox" name="mColorSchemeComboBox"/>
</item>
@@ -552,13 +531,6 @@
</property>
</widget>
</item>
<item row="7" column="5">
<widget class="QgsColorButton" name="mColorIndentation">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLabel" name="label_26">
<property name="text">
@@ -580,13 +552,6 @@
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Comment line</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QgsColorButton" name="mColorUnknownTag">
<property name="text">
@@ -615,13 +580,6 @@
</property>
</widget>
</item>
<item row="6" column="5">
<widget class="QgsColorButton" name="mColorCommentLine">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
@@ -664,13 +622,6 @@
</property>
</widget>
</item>
<item row="9" column="4">
<widget class="QLabel" name="label_39">
<property name="text">
<string>Fold guide</string>
</property>
</widget>
</item>
<item row="12" column="2">
<widget class="QLabel" name="label_52">
<property name="text">
@@ -734,13 +685,6 @@
</property>
</widget>
</item>
<item row="10" column="4">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Caretline</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QgsColorButton" name="mColorMarginBackground">
<property name="text">
@@ -762,22 +706,92 @@
</property>
</widget>
</item>
<item row="8" column="4">
<item row="3" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Operator</string>
</property>
</widget>
</item>
<item row="11" column="4">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Caretline</string>
</property>
</widget>
</item>
<item row="11" column="5">
<widget class="QgsColorButton" name="mColorCaretLine">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="10" column="4">
<widget class="QLabel" name="label_39">
<property name="text">
<string>Fold guide</string>
</property>
</widget>
</item>
<item row="10" column="5">
<widget class="QgsColorButton" name="mColorFold">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="4">
<widget class="QLabel" name="label_40">
<property name="text">
<string>Edge guide</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_23">
<item row="9" column="5">
<widget class="QgsColorButton" name="mColorEdge">
<property name="text">
<string>Operator</string>
<string/>
</property>
</widget>
</item>
<item row="8" column="4">
<widget class="QLabel" name="label_38">
<property name="text">
<string>Indentation guide</string>
</property>
</widget>
</item>
<item row="8" column="5">
<widget class="QgsColorButton" name="mColorEdge">
<widget class="QgsColorButton" name="mColorIndentation">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Comment line</string>
</property>
</widget>
</item>
<item row="7" column="5">
<widget class="QgsColorButton" name="mColorCommentLine">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QLabel" name="label_34">
<property name="text">
<string>Error background</string>
</property>
</widget>
</item>
<item row="6" column="5">
<widget class="QgsColorButton" name="mColorErrorBackground">
<property name="text">
<string/>
</property>
@@ -865,21 +879,22 @@
<tabstop>mColorError</tabstop>
<tabstop>mColorComment</tabstop>
<tabstop>mColorCommentBlock</tabstop>
<tabstop>mColorCommentLine</tabstop>
<tabstop>mColorErrorBackground</tabstop>
<tabstop>mColorSingleQuote</tabstop>
<tabstop>mColorDoubleQuote</tabstop>
<tabstop>mColorIndentation</tabstop>
<tabstop>mColorCommentLine</tabstop>
<tabstop>mColorTripleSingleQuote</tabstop>
<tabstop>mColorTripleDoubleQuote</tabstop>
<tabstop>mColorEdge</tabstop>
<tabstop>mColorIndentation</tabstop>
<tabstop>mColorMarginBackground</tabstop>
<tabstop>mColorMarginForeground</tabstop>
<tabstop>mColorFold</tabstop>
<tabstop>mColorEdge</tabstop>
<tabstop>mColorSelectionBackground</tabstop>
<tabstop>mColorSelectionForeground</tabstop>
<tabstop>mColorCaretLine</tabstop>
<tabstop>mColorFold</tabstop>
<tabstop>mColorBraceBackground</tabstop>
<tabstop>mColorBraceForeground</tabstop>
<tabstop>mColorCaretLine</tabstop>
<tabstop>mColorFoldIcon</tabstop>
<tabstop>mColorFoldIconHalo</tabstop>
<tabstop>mListLanguage</tabstop>

0 comments on commit 0a3f40a

Please sign in to comment.
You can’t perform that action at this time.