Skip to content
Permalink
Browse files

Move icon references back out of QgsPythonConsoleBase

  • Loading branch information
nyalldawson committed Oct 5, 2020
1 parent e66a0a0 commit bc55102eb8396fb7ebd38ac2cdc7b71733bd5fda
@@ -40,25 +40,6 @@ def __init__(self, parent=None):
# Margin 2 is used for the 'folding' (editor)
self.setMarginWidth(2, "0")

self.iconRun = QgsApplication.getThemeIcon("console/mIconRunConsole.svg")
self.iconRunScript = QgsApplication.getThemeIcon("mActionStart.svg")
self.iconUndo = QgsApplication.getThemeIcon("mActionUndo.svg")
self.iconRedo = QgsApplication.getThemeIcon("mActionRedo.svg")
self.iconCodePad = QgsApplication.getThemeIcon("console/iconCodepadConsole.svg")
self.iconCommentEditor = QgsApplication.getThemeIcon("console/iconCommentEditorConsole.svg")
self.iconUncommentEditor = QgsApplication.getThemeIcon("console/iconUncommentEditorConsole.svg")
self.iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.svg")
self.iconFind = QgsApplication.getThemeIcon("console/iconSearchEditorConsole.svg")
self.iconSyntaxCk = QgsApplication.getThemeIcon("console/iconSyntaxErrorConsole.svg")
self.iconObjInsp = QgsApplication.getThemeIcon("console/iconClassBrowserConsole.svg")
self.iconCut = QgsApplication.getThemeIcon("mActionEditCut.svg")
self.iconCopy = QgsApplication.getThemeIcon("mActionEditCopy.svg")
self.iconPaste = QgsApplication.getThemeIcon("mActionEditPaste.svg")
self.iconClear = QgsApplication.getThemeIcon("console/iconClearConsole.svg")
self.iconHideTool = QgsApplication.getThemeIcon("console/iconHideToolConsole.svg")
self.iconShowEditor = QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg")
self.iconPyQGISHelp = QgsApplication.getThemeIcon("console/iconHelpConsole.svg")

def setLexers(self):
self.api = QsciAPIs(self.lexer())
checkBoxAPI = self.settings.value("pythonConsole/preloadAPI", True, type=bool)
@@ -187,62 +187,62 @@ def contextMenuEvent(self, e):
QCoreApplication.translate("PythonConsole", "Hide Editor"),
self.hideEditor)
menu.addSeparator() # ------------------------------
syntaxCheck = menu.addAction(self.iconSyntaxCk,
syntaxCheck = menu.addAction(QgsApplication.getThemeIcon("console/iconSyntaxErrorConsole.svg"),
QCoreApplication.translate("PythonConsole", "Check Syntax"),
self.syntaxCheck, 'Ctrl+4')
runSelected = menu.addAction(self.iconRun, # spellok
runSelected = menu.addAction(QgsApplication.getThemeIcon("console/mIconRunConsole.svg"), # spellok
QCoreApplication.translate("PythonConsole", "Run Selected"),
self.runSelectedCode, 'Ctrl+E') # spellok
pyQGISHelpAction = menu.addAction(self.iconPyQGISHelp,
pyQGISHelpAction = menu.addAction(QgsApplication.getThemeIcon("console/iconHelpConsole.svg"),
QCoreApplication.translate("PythonConsole", "Search Selected in PyQGIS docs"),
self.searchSelectedTextInPyQGISDocs)
menu.addAction(self.iconRunScript,
menu.addAction(QgsApplication.getThemeIcon("mActionStart.svg"),
QCoreApplication.translate("PythonConsole", "Run Script"),
self.runScriptCode, 'Shift+Ctrl+E')
menu.addSeparator()
undoAction = menu.addAction(self.iconUndo,
undoAction = menu.addAction(QgsApplication.getThemeIcon("mActionUndo.svg"),
QCoreApplication.translate("PythonConsole", "Undo"),
self.undo, QKeySequence.Undo)
redoAction = menu.addAction(self.iconRedo,
redoAction = menu.addAction(QgsApplication.getThemeIcon("mActionRedo.svg"),
QCoreApplication.translate("PythonConsole", "Redo"),
self.redo, 'Ctrl+Shift+Z')
menu.addSeparator()
menu.addAction(self.iconFind,
menu.addAction(QgsApplication.getThemeIcon("console/iconSearchEditorConsole.svg"),
QCoreApplication.translate("PythonConsole", "Find Text"),
self.openFindWidget)
cutAction = menu.addAction(self.iconCut,
cutAction = menu.addAction(QgsApplication.getThemeIcon("mActionEditCut.svg"),
QCoreApplication.translate("PythonConsole", "Cut"),
self.cut, QKeySequence.Cut)
copyAction = menu.addAction(self.iconCopy,
copyAction = menu.addAction(QgsApplication.getThemeIcon("mActionEditCopy.svg"),
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(self.iconPaste,
pasteAction = menu.addAction(QgsApplication.getThemeIcon("mActionEditPaste.svg"),
QCoreApplication.translate("PythonConsole", "Paste"),
self.paste, QKeySequence.Paste)
selectAllAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Select All"),
self.selectAll, QKeySequence.SelectAll)
menu.addSeparator()
menu.addAction(self.iconCommentEditor,
menu.addAction(QgsApplication.getThemeIcon("console/iconCommentEditorConsole.svg"),
QCoreApplication.translate("PythonConsole", "Comment"),
self.parent.pc.commentCode, 'Ctrl+3')
menu.addAction(self.iconUncommentEditor,
menu.addAction(QgsApplication.getThemeIcon("console/iconUncommentEditorConsole.svg"),
QCoreApplication.translate("PythonConsole", "Uncomment"),
self.parent.pc.uncommentCode, 'Shift+Ctrl+3')
menu.addSeparator()
gist_menu = QMenu(self)
gist_menu.setTitle(QCoreApplication.translate("PythonConsole", "Share on GitHub"))
gist_menu.setIcon(self.iconCodePad)
gist_menu.setIcon(QgsApplication.getThemeIcon("console/iconCodepadConsole.svg"))
gist_menu.addAction(QCoreApplication.translate("PythonConsole", "Secret Gist"),
partial(self.shareOnGist, False))
gist_menu.addAction(QCoreApplication.translate("PythonConsole", "Public Gist"),
partial(self.shareOnGist, True))
menu.addMenu(gist_menu)
showCodeInspection = menu.addAction(self.iconObjInsp,
showCodeInspection = menu.addAction(QgsApplication.getThemeIcon("console/iconClassBrowserConsole.svg"),
QCoreApplication.translate("PythonConsole", "Hide/Show Object Inspector"),
self.objectListEditor)
menu.addSeparator()
menu.addAction(self.iconSettings,
menu.addAction(QgsApplication.getThemeIcon("console/iconSettingsConsole.svg"),
QCoreApplication.translate("PythonConsole", "Options…"),
self.parent.pc.openSettings)
syntaxCheck.setEnabled(False)
@@ -164,35 +164,35 @@ def clearConsole(self):

def contextMenuEvent(self, e):
menu = QMenu(self)
menu.addAction(self.iconHideTool,
menu.addAction(QgsApplication.getThemeIcon("console/iconHideToolConsole.svg"),
QCoreApplication.translate("PythonConsole", "Hide/Show Toolbar"),
self.hideToolBar)
menu.addSeparator()
showEditorAction = menu.addAction(
self.iconShowEditor,
QgsApplication.getThemeIcon("console/iconShowEditorConsole.svg"),
QCoreApplication.translate("PythonConsole", "Show Editor"),
self.showEditor)
menu.addSeparator()
runAction = menu.addAction(self.iconRun,
runAction = menu.addAction(QgsApplication.getThemeIcon("console/mIconRunConsole.svg"),
QCoreApplication.translate("PythonConsole", "Enter Selected"),
self.enteredSelected,
QKeySequence(Qt.CTRL + Qt.Key_E))
clearAction = menu.addAction(self.iconClear,
clearAction = menu.addAction(QgsApplication.getThemeIcon("console/iconClearConsole.svg"),
QCoreApplication.translate("PythonConsole", "Clear Console"),
self.clearConsole)
pyQGISHelpAction = menu.addAction(self.iconPyQGISHelp,
pyQGISHelpAction = menu.addAction(QgsApplication.getThemeIcon("console/iconHelpConsole.svg"),
QCoreApplication.translate("PythonConsole", "Search Selected in PyQGIS docs"),
self.searchSelectedTextInPyQGISDocs)
menu.addSeparator()
copyAction = menu.addAction(
self.iconCopy,
QgsApplication.getThemeIcon("mActionEditCopy.svg"),
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
selectAllAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Select All"),
self.selectAll, QKeySequence.SelectAll)
menu.addSeparator()
menu.addAction(self.iconSettings,
menu.addAction(QgsApplication.getThemeIcon("console/iconSettingsConsole.svg"),
QCoreApplication.translate("PythonConsole", "Options…"),
self.parent.openSettings)
runAction.setEnabled(False)
@@ -424,14 +424,14 @@ def contextMenuEvent(self, e):
menu.addMenu(subMenu)
menu.addSeparator()
copyAction = menu.addAction(
self.iconCopy,
QgsApplication.getThemeIcon("mActionEditCopy.svg"),
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(
self.iconPaste,
QgsApplication.getThemeIcon("mActionEditPaste.svg"),
QCoreApplication.translate("PythonConsole", "Paste"),
self.paste, QKeySequence.Paste)
pyQGISHelpAction = menu.addAction(self.iconPyQGISHelp,
pyQGISHelpAction = menu.addAction(QgsApplication.getThemeIcon("console/iconHelpConsole.svg"),
QCoreApplication.translate("PythonConsole", "Search Selected in PyQGIS docs"),
self.searchSelectedTextInPyQGISDocs)
copyAction.setEnabled(False)

0 comments on commit bc55102

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