Skip to content

Commit

Permalink
Fix #6458
Browse files Browse the repository at this point in the history
- added new icon in resources
- added tools to import QtCore,QtGui class
- update help and locale
  • Loading branch information
slarosa committed Oct 5, 2012
1 parent 680db77 commit b3589d4
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 3 deletions.
Binary file added images/console/iconQtCoreConsole.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/console/iconQtGuiConsole.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions images/images.qrc
Expand Up @@ -475,6 +475,8 @@
<file>console/iconSextanteConsole.png</file>
<file>console/iconScriptConsole.png</file>
<file>console/iconIfaceConsole.png</file>
<file>console/iconQtCoreConsole.png</file>
<file>console/iconQtGuiConsole.png</file>
<file>console/iconRunConsole.png</file>
</qresource>
<qresource prefix="/images/tips">
Expand Down
34 changes: 32 additions & 2 deletions python/console.py
Expand Up @@ -134,7 +134,7 @@ def __init__(self, parent=None):
self.actionScript.setToolTip(actionScriptBt)
self.actionScript.setText(actionScriptBt)
## Import Sextante class
loadSextanteBt = QCoreApplication.translate("PythonConsole", "Import sextante class")
loadSextanteBt = QCoreApplication.translate("PythonConsole", "Import Sextante class")
self.loadSextanteButton = QAction(parent)
self.loadSextanteButton.setCheckable(False)
self.loadSextanteButton.setEnabled(True)
Expand All @@ -144,7 +144,7 @@ def __init__(self, parent=None):
self.loadSextanteButton.setToolTip(loadSextanteBt)
self.loadSextanteButton.setText(loadSextanteBt)
## Import QgisInterface class
loadIfaceBt = QCoreApplication.translate("PythonConsole", "Import iface class")
loadIfaceBt = QCoreApplication.translate("PythonConsole", "Import QgisInterface class")
self.loadIfaceButton = QAction(parent)
self.loadIfaceButton.setCheckable(False)
self.loadIfaceButton.setEnabled(True)
Expand All @@ -153,6 +153,26 @@ def __init__(self, parent=None):
self.loadIfaceButton.setIconVisibleInMenu(True)
self.loadIfaceButton.setToolTip(loadIfaceBt)
self.loadIfaceButton.setText(loadIfaceBt)
## Import QtCore class
loadQtCoreBt = QCoreApplication.translate("PythonConsole", "Import PyQt.QtCore class")
self.loadQtCoreButton = QAction(parent)
self.loadQtCoreButton.setCheckable(False)
self.loadQtCoreButton.setEnabled(True)
self.loadQtCoreButton.setIcon(QIcon(":/images/console/iconQtCoreConsole.png"))
self.loadQtCoreButton.setMenuRole(QAction.PreferencesRole)
self.loadQtCoreButton.setIconVisibleInMenu(True)
self.loadQtCoreButton.setToolTip(loadQtCoreBt)
self.loadQtCoreButton.setText(loadQtCoreBt)
## Import QtGui class
loadQtGuiBt = QCoreApplication.translate("PythonConsole", "Import PyQt.QtGui class")
self.loadQtGuiButton = QAction(parent)
self.loadQtGuiButton.setCheckable(False)
self.loadQtGuiButton.setEnabled(True)
self.loadQtGuiButton.setIcon(QIcon(":/images/console/iconQtGuiConsole.png"))
self.loadQtGuiButton.setMenuRole(QAction.PreferencesRole)
self.loadQtGuiButton.setIconVisibleInMenu(True)
self.loadQtGuiButton.setToolTip(loadQtGuiBt)
self.loadQtGuiButton.setText(loadQtGuiBt)
## Action for Open File
openFileBt = QCoreApplication.translate("PythonConsole", "Open script file")
self.openFileButton = QAction(parent)
Expand Down Expand Up @@ -203,6 +223,8 @@ def __init__(self, parent=None):
self.classMenu = QMenu(self)
self.classMenu.addAction(self.loadIfaceButton)
self.classMenu.addAction(self.loadSextanteButton)
self.classMenu.addAction(self.loadQtCoreButton)
self.classMenu.addAction(self.loadQtGuiButton)
cM = self.toolBar.widgetForAction(self.actionClass)
cM.setMenu(self.classMenu)
cM.setPopupMode(QToolButton.InstantPopup)
Expand All @@ -229,6 +251,8 @@ def __init__(self, parent=None):
#self.currentLayerButton.triggered.connect(self.cLayer)
self.loadIfaceButton.triggered.connect(self.iface)
self.loadSextanteButton.triggered.connect(self.sextante)
self.loadQtCoreButton.triggered.connect(self.qtCore)
self.loadQtGuiButton.triggered.connect(self.qtGui)
self.runButton.triggered.connect(self.edit.entered)
self.openFileButton.triggered.connect(self.openScriptFile)
self.saveFileButton.triggered.connect(self.saveScriptFile)
Expand All @@ -245,6 +269,12 @@ def sextante(self):

def iface(self):
self.edit.commandConsole('iface')

def qtCore(self):
self.edit.commandConsole('qtCore')

def qtGui(self):
self.edit.commandConsole('qtGui')

def openScriptFile(self):
settings = QSettings()
Expand Down
8 changes: 8 additions & 0 deletions python/console_sci.py
Expand Up @@ -151,6 +151,14 @@ def commandConsole(self, command):
"""Retrieve current Layer from map camvas"""
self.append('cLayer = iface.mapCanvas().currentLayer()')
self.move_cursor_to_end()
elif command == "qtCore":
"""Retrieve current Layer from map camvas"""
self.append('from PyQt4.QtCore import *')
self.move_cursor_to_end()
elif command == "qtGui":
"""Retrieve current Layer from map camvas"""
self.append('from PyQt4.QtGui import *')
self.move_cursor_to_end()
self.setFocus()

def setLexers(self, lexer):
Expand Down
12 changes: 11 additions & 1 deletion python/helpConsole/help.htm
Expand Up @@ -93,13 +93,23 @@ <h4 id="toolbar">Toolbar</h4>
<tr>
<td><img src="qrc:/images/console/iconClassConsole.png" /></td>
<td><img src="qrc:/images/console/iconIfaceConsole.png" /></td>
<td><span id="toolbarIfaceClass">Tool to import iface class</span></td>
<td><span id="toolbarIfaceClass">Tool to import QgisInterface class</span></td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/console/iconSextanteConsole.png" /></td>
<td><span id="toolbarSextClass">Tool to import Sextante class</span></td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/console/iconQtCoreConsole.png" /></td>
<td><span id="toolbarQtCoreClass">Tool to import PyQt4.QtCore class</span></td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/console/iconQtGuiConsole.png" /></td>
<td><span id="toolbarQtGuiClass">Tool to import PyQt4.QtGui class</span></td>
</tr>
<tr>
<td><img src="qrc:/images/console/iconScriptConsole.png" /></td>
<td><img src="qrc:/images/console/iconOpenConsole.png" /></td>
Expand Down
2 changes: 2 additions & 0 deletions python/helpConsole/i18n/en_US.properties
Expand Up @@ -20,6 +20,8 @@ i18n_dict = {
"toolbar.clear" : "Tool to clear python console",
"toolbar.iface" : "Tool to import iface class",
"toolbar.sextante" : "Tool to import Sextante class",
"toolbar.qtcore" : "Tool to import PyQt4.QtCore class",
"toolbar.qtgui" : "Tool to import PyQt4.QtGui class",
"toolbar.script.open" : "Tool to open a python script and load in console",
"toolbar.script.save" : "Tool to save a python script",
"toolbar.help" : "Help",
Expand Down
2 changes: 2 additions & 0 deletions python/helpConsole/i18n/it.properties
Expand Up @@ -20,6 +20,8 @@ i18n_dict = {
"toolbar.clear" : "Strumento per pulire la console",
"toolbar.iface" : "Strumento per importare la classe iface, per accedere all'ambiente QGIS",
"toolbar.sextante" : "Strumento per importare la classe Sextante",
"toolbar.qtcore" : "Strumento per importare la classe PyQt4.QtCore",
"toolbar.qtgui" : "Strumento per importare la classe PyQt4.QtGui",
"toolbar.script.open" : "Strumento per aprire un script python da eseguire in console",
"toolbar.script.save" : "Strumento per salvare uno script python sul disco",
"toolbar.help" : "Aiuto",
Expand Down
2 changes: 2 additions & 0 deletions python/helpConsole/js/encoding.js
Expand Up @@ -15,6 +15,8 @@ $('span#toolbarTitle').text($.i18n._('toolbar.title'));
$('span#toolbarClear').text($.i18n._('toolbar.clear'));
$('span#toolbarIfaceClass').text($.i18n._('toolbar.iface'));
$('span#toolbarSextClass').text($.i18n._('toolbar.sextante'));
$('span#toolbarQtCoreClass').text($.i18n._('toolbar.qtcore'));
$('span#toolbarQtGuiClass').text($.i18n._('toolbar.qtgui'));
$('span#toolbarScriptOpen').text($.i18n._('toolbar.script.open'));
$('span#toolbarScriptSave').text($.i18n._('toolbar.script.save'));
$('span#toolbarHelp').text($.i18n._('toolbar.help'));
Expand Down

0 comments on commit b3589d4

Please sign in to comment.