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

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

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

0 comments on commit 51d73a9

Please sign in to comment.