Skip to content

Commit

Permalink
[pyqgis-console] fix translation string
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed May 20, 2013
1 parent 942d6bf commit 51d73a9
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 31 deletions.
6 changes: 3 additions & 3 deletions python/console/console.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def __init__(self, parent=None):
self.runScriptEditorButton.setToolTip(runScriptEditorBt) self.runScriptEditorButton.setToolTip(runScriptEditorBt)
self.runScriptEditorButton.setText(runScriptEditorBt) self.runScriptEditorButton.setText(runScriptEditorBt)
## Action Run Script (subprocess) ## Action Run Script (subprocess)
commentEditorBt = QCoreApplication.translate("PythonConsole", "Comment code") commentEditorBt = QCoreApplication.translate("PythonConsole", "Comment")
self.commentEditorButton = QAction(self) self.commentEditorButton = QAction(self)
self.commentEditorButton.setCheckable(False) self.commentEditorButton.setCheckable(False)
self.commentEditorButton.setEnabled(True) self.commentEditorButton.setEnabled(True)
Expand All @@ -231,7 +231,7 @@ def __init__(self, parent=None):
self.commentEditorButton.setToolTip(commentEditorBt) self.commentEditorButton.setToolTip(commentEditorBt)
self.commentEditorButton.setText(commentEditorBt) self.commentEditorButton.setText(commentEditorBt)
## Action Run Script (subprocess) ## Action Run Script (subprocess)
uncommentEditorBt = QCoreApplication.translate("PythonConsole", "Uncomment code") uncommentEditorBt = QCoreApplication.translate("PythonConsole", "Uncomment")
self.uncommentEditorButton = QAction(self) self.uncommentEditorButton = QAction(self)
self.uncommentEditorButton.setCheckable(False) self.uncommentEditorButton.setCheckable(False)
self.uncommentEditorButton.setEnabled(True) self.uncommentEditorButton.setEnabled(True)
Expand All @@ -252,7 +252,7 @@ def __init__(self, parent=None):
self.objectListButton.setToolTip(objList) self.objectListButton.setToolTip(objList)
self.objectListButton.setText(objList) self.objectListButton.setText(objList)
## Action for Find text ## Action for Find text
findText = QCoreApplication.translate("PythonConsole", "Find text") findText = QCoreApplication.translate("PythonConsole", "Find Text")
self.findTextButton = QAction(self) self.findTextButton = QAction(self)
self.findTextButton.setCheckable(True) self.findTextButton.setCheckable(True)
self.findTextButton.setEnabled(True) self.findTextButton.setEnabled(True)
Expand Down
63 changes: 45 additions & 18 deletions python/console/console_editor.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -271,53 +271,76 @@ def contextMenuEvent(self, e):
iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.png") iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.png")
iconFind = QgsApplication.getThemeIcon("console/iconSearchEditorConsole.png") iconFind = QgsApplication.getThemeIcon("console/iconSearchEditorConsole.png")
iconSyntaxCk = QgsApplication.getThemeIcon("console/iconSyntaxErrorConsole.png") iconSyntaxCk = QgsApplication.getThemeIcon("console/iconSyntaxErrorConsole.png")
hideEditorAction = menu.addAction("Hide Editor", iconObjInsp = QgsApplication.getThemeIcon("console/iconClassBrowserConsole.png")
self.hideEditor) hideEditorAction = menu.addAction(QCoreApplication.translate("PythonConsole", "Hide Editor"),
self.hideEditor)
menu.addSeparator() menu.addSeparator()
syntaxCheck = menu.addAction(iconSyntaxCk, "Check Syntax", syntaxCheck = menu.addAction(iconSyntaxCk,
QCoreApplication.translate("PythonConsole",
"Check Syntax"),
self.syntaxCheck, 'Ctrl+4') self.syntaxCheck, 'Ctrl+4')
menu.addSeparator() menu.addSeparator()
runSelected = menu.addAction(iconRun, runSelected = menu.addAction(iconRun,
"Enter selected", QCoreApplication.translate("PythonConsole",
"Enter selected"),
self.runSelectedCode, 'Ctrl+E') self.runSelectedCode, 'Ctrl+E')
runScript = menu.addAction(iconRunScript, runScript = menu.addAction(iconRunScript,
"Run Script", QCoreApplication.translate("PythonConsole",
"Run Script"),
self.runScriptCode, 'Shift+Ctrl+E') self.runScriptCode, 'Shift+Ctrl+E')
menu.addSeparator() menu.addSeparator()
undoAction = menu.addAction("Undo", self.undo, QKeySequence.Undo) undoAction = menu.addAction(QCoreApplication.translate("PythonConsole",
redoAction = menu.addAction("Redo", self.redo, 'Ctrl+Shift+Z') "Undo"),
self.undo, QKeySequence.Undo)
redoAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Redo"),
self.redo, 'Ctrl+Shift+Z')
menu.addSeparator() menu.addSeparator()
findAction = menu.addAction(iconFind, findAction = menu.addAction(iconFind,
"Find Text", QCoreApplication.translate("PythonConsole",
"Find Text"),
self.showFindWidget) self.showFindWidget)
menu.addSeparator() menu.addSeparator()
cutAction = menu.addAction("Cut", cutAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Cut"),
self.cut, self.cut,
QKeySequence.Cut) QKeySequence.Cut)
copyAction = menu.addAction("Copy", copyAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Copy"),
self.copy, self.copy,
QKeySequence.Copy) QKeySequence.Copy)
pasteAction = menu.addAction("Paste", self.paste, QKeySequence.Paste) pasteAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Paste"),
self.paste, QKeySequence.Paste)
menu.addSeparator() menu.addSeparator()
commentCodeAction = menu.addAction(iconCommentEditor, "Comment", commentCodeAction = menu.addAction(iconCommentEditor,
QCoreApplication.translate("PythonConsole",
"Comment"),
self.parent.pc.commentCode, 'Ctrl+3') self.parent.pc.commentCode, 'Ctrl+3')
uncommentCodeAction = menu.addAction(iconUncommentEditor, "Uncomment", uncommentCodeAction = menu.addAction(iconUncommentEditor,
QCoreApplication.translate("PythonConsole",
"Uncomment"),
self.parent.pc.uncommentCode, self.parent.pc.uncommentCode,
'Shift+Ctrl+3') 'Shift+Ctrl+3')
menu.addSeparator() menu.addSeparator()
codePadAction = menu.addAction(iconCodePad, codePadAction = menu.addAction(iconCodePad,
"Share on codepad", QCoreApplication.translate("PythonConsole",
self.codepad) "Share on codepad"),
self.codepad)
menu.addSeparator() menu.addSeparator()
showCodeInspection = menu.addAction("Hide/Show Object list", showCodeInspection = menu.addAction(iconObjInsp,
QCoreApplication.translate("PythonConsole",
"Hide/Show Object Inspector"),
self.objectListEditor) self.objectListEditor)
menu.addSeparator() menu.addSeparator()
selectAllAction = menu.addAction("Select All", selectAllAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Select All"),
self.selectAll, self.selectAll,
QKeySequence.SelectAll) QKeySequence.SelectAll)
menu.addSeparator() menu.addSeparator()
settingsDialog = menu.addAction(iconSettings, settingsDialog = menu.addAction(iconSettings,
"Settings", QCoreApplication.translate("PythonConsole",
"Settings"),
self.parent.pc.openSettings) self.parent.pc.openSettings)
syntaxCheck.setEnabled(False) syntaxCheck.setEnabled(False)
pasteAction.setEnabled(False) pasteAction.setEnabled(False)
Expand All @@ -328,6 +351,7 @@ def contextMenuEvent(self, e):
selectAllAction.setEnabled(False) selectAllAction.setEnabled(False)
undoAction.setEnabled(False) undoAction.setEnabled(False)
redoAction.setEnabled(False) redoAction.setEnabled(False)
showCodeInspection.setEnabled(False)
if self.hasSelectedText(): if self.hasSelectedText():
runSelected.setEnabled(True) runSelected.setEnabled(True)
copyAction.setEnabled(True) copyAction.setEnabled(True)
Expand All @@ -342,6 +366,9 @@ def contextMenuEvent(self, e):
redoAction.setEnabled(True) redoAction.setEnabled(True)
if QApplication.clipboard().text(): if QApplication.clipboard().text():
pasteAction.setEnabled(True) pasteAction.setEnabled(True)
if self.settings.value("pythonConsole/enableObjectInsp",
False).toBool():
showCodeInspection.setEnabled(True)
action = menu.exec_(self.mapToGlobal(e.pos())) action = menu.exec_(self.mapToGlobal(e.pos()))


def findText(self, forward): def findText(self, forward):
Expand Down
23 changes: 15 additions & 8 deletions python/console/console_output.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -176,30 +176,37 @@ def contextMenuEvent(self, e):
iconHideTool = QgsApplication.getThemeIcon("console/iconHideToolConsole.png") iconHideTool = QgsApplication.getThemeIcon("console/iconHideToolConsole.png")
iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.png") iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.png")
hideToolBar = menu.addAction(iconHideTool, hideToolBar = menu.addAction(iconHideTool,
"Hide/Show Toolbar", QCoreApplication.translate("PythonConsole",
"Hide/Show Toolbar"),
self.hideToolBar) self.hideToolBar)
menu.addSeparator() menu.addSeparator()
showEditorAction = menu.addAction("Show Editor", showEditorAction = menu.addAction(QCoreApplication.translate("PythonConsole",
self.showEditor) "Show Editor"),
self.showEditor)
menu.addSeparator() menu.addSeparator()
runAction = menu.addAction(iconRun, runAction = menu.addAction(iconRun,
"Enter Selected", QCoreApplication.translate("PythonConsole",
"Enter Selected"),
self.enteredSelected, self.enteredSelected,
QKeySequence(Qt.CTRL + Qt.Key_E)) QKeySequence(Qt.CTRL + Qt.Key_E))
clearAction = menu.addAction(iconClear, clearAction = menu.addAction(iconClear,
"Clear console", QCoreApplication.translate("PythonConsole",
"Clear console"),
self.clearConsole) self.clearConsole)
menu.addSeparator() menu.addSeparator()
copyAction = menu.addAction("Copy", copyAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Copy"),
self.copy, self.copy,
QKeySequence.Copy) QKeySequence.Copy)
menu.addSeparator() menu.addSeparator()
selectAllAction = menu.addAction("Select All", selectAllAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Select All"),
self.selectAll, self.selectAll,
QKeySequence.SelectAll) QKeySequence.SelectAll)
menu.addSeparator() menu.addSeparator()
settingsDialog = menu.addAction(iconSettings, settingsDialog = menu.addAction(iconSettings,
"Settings", QCoreApplication.translate("PythonConsole",
"Settings"),
self.parent.openSettings) self.parent.openSettings)
runAction.setEnabled(False) runAction.setEnabled(False)
clearAction.setEnabled(False) clearAction.setEnabled(False)
Expand Down
8 changes: 6 additions & 2 deletions python/console/console_sci.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -402,8 +402,12 @@ def keyPressEvent(self, e):


def contextMenuEvent(self, e): def contextMenuEvent(self, e):
menu = QMenu(self) menu = QMenu(self)
copyAction = menu.addAction("Copy", self.copy, QKeySequence.Copy) copyAction = menu.addAction(QCoreApplication.translate("PythonConsole",
pasteAction = menu.addAction("Paste", self.paste, QKeySequence.Paste) "Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Paste"),
self.paste, QKeySequence.Paste)
copyAction.setEnabled(False) copyAction.setEnabled(False)
pasteAction.setEnabled(False) pasteAction.setEnabled(False)
if self.hasSelectedText(): if self.hasSelectedText():
Expand Down

0 comments on commit 51d73a9

Please sign in to comment.