Skip to content
Permalink
Browse files

Rename BaseClass to QgsPythonConsoleBase

  • Loading branch information
rduivenvoorde committed Sep 3, 2020
1 parent 701d323 commit 982e4f12627a2d22fa43629c1bb1f9785924ca23
@@ -26,7 +26,7 @@
import os


class QgsQsciScintillaBase(QsciScintilla):
class QgsPythonConsoleBase(QsciScintilla):

MARKER_NUM = 6
DEFAULT_COLOR = "#4d4d4c"
@@ -55,7 +55,7 @@ class QgsQsciScintillaBase(QsciScintilla):
ERROR_COLOR = "#e31a1c"

def __init__(self, parent=None):
super(QgsQsciScintillaBase, self).__init__(parent)
super(QgsPythonConsoleBase, self).__init__(parent)

# Enable non-ascii chars
self.setUtf8(True)
@@ -25,7 +25,7 @@
from qgis.core import Qgis, QgsApplication, QgsSettings
from qgis.gui import QgsMessageBar
from qgis.utils import OverrideCursor
from .console_base import QgsQsciScintillaBase
from .console_base import QgsPythonConsoleBase
import sys
import os
import subprocess
@@ -77,7 +77,7 @@ def eventFilter(self, obj, event):
return QObject.eventFilter(self, obj, event)


class Editor(QgsQsciScintillaBase):
class Editor(QgsPythonConsoleBase):

def __init__(self, parent=None):
super(Editor, self).__init__(parent)
@@ -25,7 +25,7 @@
from qgis.PyQt.Qsci import QsciScintilla
from qgis.core import Qgis, QgsApplication, QgsSettings
from qgis.gui import QgsMessageBar
from .console_base import QgsQsciScintillaBase
from .console_base import QgsPythonConsoleBase
import sys


@@ -94,7 +94,7 @@ def isatty(self):
return False


class ShellOutputScintilla(QgsQsciScintillaBase):
class ShellOutputScintilla(QgsPythonConsoleBase):

def __init__(self, parent=None):
super(ShellOutputScintilla, self).__init__(parent)
@@ -34,7 +34,7 @@

from qgis.core import QgsApplication, QgsSettings, Qgis
from .ui_console_history_dlg import Ui_HistoryDialogPythonConsole
from .console_base import QgsQsciScintillaBase
from .console_base import QgsPythonConsoleBase

_init_commands = ["import sys", "import os", "import re", "import math", "from qgis.core import *",
"from qgis.gui import *", "from qgis.analysis import *", "from qgis._3d import *",
@@ -45,7 +45,7 @@
_historyFile = os.path.join(QgsApplication.qgisSettingsDirPath(), "console_history.txt")


class ShellScintilla(QgsQsciScintillaBase, code.InteractiveInterpreter):
class ShellScintilla(QgsPythonConsoleBase, code.InteractiveInterpreter):

def __init__(self, parent=None):
super(ShellScintilla, self).__init__(parent)
@@ -25,7 +25,7 @@

from qgis.core import QgsSettings

from .console_base import QgsQsciScintillaBase
from .console_base import QgsPythonConsoleBase
from .console_compile_apis import PrepareAPIDialog
from .ui_console_settings import Ui_SettingsDialogPythonConsole

@@ -234,56 +234,56 @@ def restoreSettings(self):
self.autoCompFromDocAPI.setChecked(True)

# Setting font lexer color
self.defaultFontColor.setColor(QColor(settings.value("pythonConsole/defaultFontColor", QColor(QgsQsciScintillaBase.DEFAULT_COLOR))))
self.keywordFontColor.setColor(QColor(settings.value("pythonConsole/keywordFontColor", QColor(QgsQsciScintillaBase.KEYWORD_COLOR))))
self.classFontColor.setColor(QColor(settings.value("pythonConsole/classFontColor", QColor(QgsQsciScintillaBase.CLASS_COLOR))))
self.methodFontColor.setColor(QColor(settings.value("pythonConsole/methodFontColor", QColor(QgsQsciScintillaBase.METHOD_COLOR))))
self.decorFontColor.setColor(QColor(settings.value("pythonConsole/decorFontColor", QColor(QgsQsciScintillaBase.DECORATION_COLOR))))
self.numberFontColor.setColor(QColor(settings.value("pythonConsole/numberFontColor", QColor(QgsQsciScintillaBase.NUMBER_COLOR))))
self.commentFontColor.setColor(QColor(settings.value("pythonConsole/commentFontColor", QColor(QgsQsciScintillaBase.COMMENT_COLOR))))
self.commentBlockFontColor.setColor(QColor(settings.value("pythonConsole/commentBlockFontColor", QColor(QgsQsciScintillaBase.COMMENT_BLOCK_COLOR))))
self.paperBackgroundColor.setColor(QColor(settings.value("pythonConsole/paperBackgroundColor", QColor(QgsQsciScintillaBase.BACKGROUND_COLOR))))
self.caretLineColor.setColor(QColor(settings.value("pythonConsole/caretLineColor", QColor(QgsQsciScintillaBase.CARET_LINE_COLOR))))
self.cursorColor.setColor(QColor(settings.value("pythonConsole/cursorColor", QColor(QgsQsciScintillaBase.CURSOR_COLOR))))
self.singleQuoteFontColor.setColor(settings.value("pythonConsole/singleQuoteFontColor", QColor(QgsQsciScintillaBase.SINGLE_QUOTE_COLOR)))
self.doubleQuoteFontColor.setColor(settings.value("pythonConsole/doubleQuoteFontColor", QColor(QgsQsciScintillaBase.DOUBLE_QUOTE_COLOR)))
self.tripleSingleQuoteFontColor.setColor(settings.value("pythonConsole/tripleSingleQuoteFontColor", QColor(QgsQsciScintillaBase.TRIPLE_SINGLE_QUOTE_COLOR)))
self.tripleDoubleQuoteFontColor.setColor(settings.value("pythonConsole/tripleDoubleQuoteFontColor", QColor(QgsQsciScintillaBase.TRIPLE_DOUBLE_QUOTE_COLOR)))
self.marginBackgroundColor.setColor(settings.value("pythonConsole/marginBackgroundColor", QColor(QgsQsciScintillaBase.MARGIN_BACKGROUND_COLOR)))
self.marginForegroundColor.setColor(settings.value("pythonConsole/marginForegroundColor", QColor(QgsQsciScintillaBase.MARGIN_FOREGROUND_COLOR)))
self.selectionForegroundColor.setColor(settings.value("pythonConsole/selectionForegroundColor", QColor(QgsQsciScintillaBase.SELECTION_FOREGROUND_COLOR)))
self.selectionBackgroundColor.setColor(settings.value("pythonConsole/selectionBackgroundColor", QColor(QgsQsciScintillaBase.SELECTION_BACKGROUND_COLOR)))
self.matchedBraceForegroundColor.setColor(settings.value("pythonConsole/matchedBraceForegroundColor", QColor(QgsQsciScintillaBase.MATCHED_BRACE_FOREGROUND_COLOR)))
self.matchedBraceBackgroundColor.setColor(settings.value("pythonConsole/matchedBraceBackgroundColor", QColor(QgsQsciScintillaBase.MATCHED_BRACE_BACKGROUND_COLOR)))
self.stderrFontColor.setColor(QColor(settings.value("pythonConsole/stderrFontColor", QColor(QgsQsciScintillaBase.ERROR_COLOR))))
self.edgeColor.setColor(settings.value("pythonConsole/edgeColor", QColor(QgsQsciScintillaBase.EDGE_COLOR)))
self.foldColor.setColor(settings.value("pythonConsole/foldColor", QColor(QgsQsciScintillaBase.FOLD_COLOR)))
self.defaultFontColor.setColor(QColor(settings.value("pythonConsole/defaultFontColor", QColor(QgsPythonConsoleBase.DEFAULT_COLOR))))
self.keywordFontColor.setColor(QColor(settings.value("pythonConsole/keywordFontColor", QColor(QgsPythonConsoleBase.KEYWORD_COLOR))))
self.classFontColor.setColor(QColor(settings.value("pythonConsole/classFontColor", QColor(QgsPythonConsoleBase.CLASS_COLOR))))
self.methodFontColor.setColor(QColor(settings.value("pythonConsole/methodFontColor", QColor(QgsPythonConsoleBase.METHOD_COLOR))))
self.decorFontColor.setColor(QColor(settings.value("pythonConsole/decorFontColor", QColor(QgsPythonConsoleBase.DECORATION_COLOR))))
self.numberFontColor.setColor(QColor(settings.value("pythonConsole/numberFontColor", QColor(QgsPythonConsoleBase.NUMBER_COLOR))))
self.commentFontColor.setColor(QColor(settings.value("pythonConsole/commentFontColor", QColor(QgsPythonConsoleBase.COMMENT_COLOR))))
self.commentBlockFontColor.setColor(QColor(settings.value("pythonConsole/commentBlockFontColor", QColor(QgsPythonConsoleBase.COMMENT_BLOCK_COLOR))))
self.paperBackgroundColor.setColor(QColor(settings.value("pythonConsole/paperBackgroundColor", QColor(QgsPythonConsoleBase.BACKGROUND_COLOR))))
self.caretLineColor.setColor(QColor(settings.value("pythonConsole/caretLineColor", QColor(QgsPythonConsoleBase.CARET_LINE_COLOR))))
self.cursorColor.setColor(QColor(settings.value("pythonConsole/cursorColor", QColor(QgsPythonConsoleBase.CURSOR_COLOR))))
self.singleQuoteFontColor.setColor(settings.value("pythonConsole/singleQuoteFontColor", QColor(QgsPythonConsoleBase.SINGLE_QUOTE_COLOR)))
self.doubleQuoteFontColor.setColor(settings.value("pythonConsole/doubleQuoteFontColor", QColor(QgsPythonConsoleBase.DOUBLE_QUOTE_COLOR)))
self.tripleSingleQuoteFontColor.setColor(settings.value("pythonConsole/tripleSingleQuoteFontColor", QColor(QgsPythonConsoleBase.TRIPLE_SINGLE_QUOTE_COLOR)))
self.tripleDoubleQuoteFontColor.setColor(settings.value("pythonConsole/tripleDoubleQuoteFontColor", QColor(QgsPythonConsoleBase.TRIPLE_DOUBLE_QUOTE_COLOR)))
self.marginBackgroundColor.setColor(settings.value("pythonConsole/marginBackgroundColor", QColor(QgsPythonConsoleBase.MARGIN_BACKGROUND_COLOR)))
self.marginForegroundColor.setColor(settings.value("pythonConsole/marginForegroundColor", QColor(QgsPythonConsoleBase.MARGIN_FOREGROUND_COLOR)))
self.selectionForegroundColor.setColor(settings.value("pythonConsole/selectionForegroundColor", QColor(QgsPythonConsoleBase.SELECTION_FOREGROUND_COLOR)))
self.selectionBackgroundColor.setColor(settings.value("pythonConsole/selectionBackgroundColor", QColor(QgsPythonConsoleBase.SELECTION_BACKGROUND_COLOR)))
self.matchedBraceForegroundColor.setColor(settings.value("pythonConsole/matchedBraceForegroundColor", QColor(QgsPythonConsoleBase.MATCHED_BRACE_FOREGROUND_COLOR)))
self.matchedBraceBackgroundColor.setColor(settings.value("pythonConsole/matchedBraceBackgroundColor", QColor(QgsPythonConsoleBase.MATCHED_BRACE_BACKGROUND_COLOR)))
self.stderrFontColor.setColor(QColor(settings.value("pythonConsole/stderrFontColor", QColor(QgsPythonConsoleBase.ERROR_COLOR))))
self.edgeColor.setColor(settings.value("pythonConsole/edgeColor", QColor(QgsPythonConsoleBase.EDGE_COLOR)))
self.foldColor.setColor(settings.value("pythonConsole/foldColor", QColor(QgsPythonConsoleBase.FOLD_COLOR)))

def _resetFontColor(self):
self.defaultFontColor.setColor(QColor(QgsQsciScintillaBase.DEFAULT_COLOR))
self.keywordFontColor.setColor(QColor(QgsQsciScintillaBase.KEYWORD_COLOR))
self.classFontColor.setColor(QColor(QgsQsciScintillaBase.CLASS_COLOR))
self.methodFontColor.setColor(QColor(QgsQsciScintillaBase.METHOD_COLOR))
self.decorFontColor.setColor(QColor(QgsQsciScintillaBase.DECORATION_COLOR))
self.numberFontColor.setColor(QColor(QgsQsciScintillaBase.NUMBER_COLOR))
self.commentFontColor.setColor(QColor(QgsQsciScintillaBase.COMMENT_COLOR))
self.commentBlockFontColor.setColor(QColor(QgsQsciScintillaBase.COMMENT_BLOCK_COLOR))
self.paperBackgroundColor.setColor(QColor(QgsQsciScintillaBase.BACKGROUND_COLOR))
self.cursorColor.setColor(QColor(QgsQsciScintillaBase.CURSOR_COLOR))
self.caretLineColor.setColor(QColor(QgsQsciScintillaBase.CARET_LINE_COLOR))
self.singleQuoteFontColor.setColor(QColor(QgsQsciScintillaBase.SINGLE_QUOTE_COLOR))
self.doubleQuoteFontColor.setColor(QColor(QgsQsciScintillaBase.DOUBLE_QUOTE_COLOR))
self.tripleSingleQuoteFontColor.setColor(QColor(QgsQsciScintillaBase.TRIPLE_SINGLE_QUOTE_COLOR))
self.tripleDoubleQuoteFontColor.setColor(QColor(QgsQsciScintillaBase.TRIPLE_DOUBLE_QUOTE_COLOR))
self.marginBackgroundColor.setColor(QColor(QgsQsciScintillaBase.MARGIN_BACKGROUND_COLOR))
self.marginForegroundColor.setColor(QColor(QgsQsciScintillaBase.MARGIN_FOREGROUND_COLOR))
self.selectionBackgroundColor.setColor(QColor(QgsQsciScintillaBase.SELECTION_BACKGROUND_COLOR))
self.selectionForegroundColor.setColor(QColor(QgsQsciScintillaBase.SELECTION_FOREGROUND_COLOR))
self.matchedBraceBackgroundColor.setColor(QColor(QgsQsciScintillaBase.MATCHED_BRACE_BACKGROUND_COLOR))
self.matchedBraceForegroundColor.setColor(QColor(QgsQsciScintillaBase.MATCHED_BRACE_FOREGROUND_COLOR))
self.stderrFontColor.setColor(QColor(QgsQsciScintillaBase.ERROR_COLOR))
self.edgeColor.setColor(QColor(QgsQsciScintillaBase.EDGE_COLOR))
self.foldColor.setColor(QColor(QgsQsciScintillaBase.FOLD_COLOR))
self.defaultFontColor.setColor(QColor(QgsPythonConsoleBase.DEFAULT_COLOR))
self.keywordFontColor.setColor(QColor(QgsPythonConsoleBase.KEYWORD_COLOR))
self.classFontColor.setColor(QColor(QgsPythonConsoleBase.CLASS_COLOR))
self.methodFontColor.setColor(QColor(QgsPythonConsoleBase.METHOD_COLOR))
self.decorFontColor.setColor(QColor(QgsPythonConsoleBase.DECORATION_COLOR))
self.numberFontColor.setColor(QColor(QgsPythonConsoleBase.NUMBER_COLOR))
self.commentFontColor.setColor(QColor(QgsPythonConsoleBase.COMMENT_COLOR))
self.commentBlockFontColor.setColor(QColor(QgsPythonConsoleBase.COMMENT_BLOCK_COLOR))
self.paperBackgroundColor.setColor(QColor(QgsPythonConsoleBase.BACKGROUND_COLOR))
self.cursorColor.setColor(QColor(QgsPythonConsoleBase.CURSOR_COLOR))
self.caretLineColor.setColor(QColor(QgsPythonConsoleBase.CARET_LINE_COLOR))
self.singleQuoteFontColor.setColor(QColor(QgsPythonConsoleBase.SINGLE_QUOTE_COLOR))
self.doubleQuoteFontColor.setColor(QColor(QgsPythonConsoleBase.DOUBLE_QUOTE_COLOR))
self.tripleSingleQuoteFontColor.setColor(QColor(QgsPythonConsoleBase.TRIPLE_SINGLE_QUOTE_COLOR))
self.tripleDoubleQuoteFontColor.setColor(QColor(QgsPythonConsoleBase.TRIPLE_DOUBLE_QUOTE_COLOR))
self.marginBackgroundColor.setColor(QColor(QgsPythonConsoleBase.MARGIN_BACKGROUND_COLOR))
self.marginForegroundColor.setColor(QColor(QgsPythonConsoleBase.MARGIN_FOREGROUND_COLOR))
self.selectionBackgroundColor.setColor(QColor(QgsPythonConsoleBase.SELECTION_BACKGROUND_COLOR))
self.selectionForegroundColor.setColor(QColor(QgsPythonConsoleBase.SELECTION_FOREGROUND_COLOR))
self.matchedBraceBackgroundColor.setColor(QColor(QgsPythonConsoleBase.MATCHED_BRACE_BACKGROUND_COLOR))
self.matchedBraceForegroundColor.setColor(QColor(QgsPythonConsoleBase.MATCHED_BRACE_FOREGROUND_COLOR))
self.stderrFontColor.setColor(QColor(QgsPythonConsoleBase.ERROR_COLOR))
self.edgeColor.setColor(QColor(QgsPythonConsoleBase.EDGE_COLOR))
self.foldColor.setColor(QColor(QgsPythonConsoleBase.FOLD_COLOR))

def reject(self):
self.restoreSettings()

0 comments on commit 982e4f1

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