Skip to content
Permalink
Browse files

[FEATURE] - Choose Fontfamily and API files for Python Console

- update Italian translation
- added Settings icon for toolbar
- update Italian translation fro console_help
  • Loading branch information
slarosa committed Oct 19, 2012
1 parent d06203b commit ca20be178a3e2274fe72e5961dd28217fa68c38a
@@ -6450,6 +6450,10 @@ Cambiare questa situazione prima, perché il plugin OSM non quale layer è la de
<source>Save to script file</source>
<translation>Salva file</translation>
</message>
<message>
<source>Settings</source>
<translation>Impostazioni</translation>
</message>
<message>
<source>Help</source>
<translation>Aiuto</translation>
Binary file not shown.
File renamed without changes.
@@ -468,7 +468,7 @@
<file>console/iconClassConsole.png</file>
<file>console/iconSaveConsole.png</file>
<file>console/iconHelpConsole.png</file>
<file>console/iconTempConsole.png</file>
<file>console/iconSettingsConsole.png</file>
<file>console/iconOpenConsole.png</file>
<file>console/iconClearConsole.png</file>
<file>console/imgHelpDialog.png</file>
@@ -478,6 +478,7 @@
<file>console/iconQtCoreConsole.png</file>
<file>console/iconQtGuiConsole.png</file>
<file>console/iconRunConsole.png</file>
<file>console/iconAboutConsole.png</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
@@ -149,7 +149,12 @@ ADD_CUSTOM_COMMAND(TARGET compile_python_files
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

FOREACH(file __init__.py utils.py console.py console_sci.py console_help.py)
FILE(GLOB UI_FILES *.ui)
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
ADD_CUSTOM_TARGET(console ALL DEPENDS ${PYUI_FILES})
INSTALL(FILES ${PYUI_FILES} DESTINATION ${QGIS_PYTHON_DIR})

FOREACH(file __init__.py utils.py console.py console_sci.py console_help.py console_settings.py)
ADD_CUSTOM_COMMAND(TARGET compile_python_files
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${file} ${QGIS_PYTHON_OUTPUT_DIRECTORY}
@@ -163,3 +168,4 @@ PYTHON_INSTALL(utils.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(console.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(console_sci.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(console_help.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(console_settings.py ${QGIS_PYTHON_DIR})
@@ -24,6 +24,7 @@
from qgis.utils import iface
from console_sci import PythonEdit
from console_help import HelpDialog
from console_settings import optionsDialog

import sys
import os
@@ -66,7 +67,7 @@ def get_and_clean_data(self):
def flush(self):
pass

sys.stdout = QgisOutputCatcher()
sys.stdout = QgisOutputCatcher()

class PythonConsole(QDockWidget):
def __init__(self, parent=None):
@@ -82,14 +83,14 @@ def __init__(self, parent=None):
if iface and not iface.mainWindow().restoreDockWidget(self):
iface.mainWindow().addDockWidget(Qt.BottomDockWidgetArea, self)


class PythonConsoleWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setWindowTitle(QCoreApplication.translate("PythonConsole", "Python Console"))

self.widgetButton = QWidget()

self.options = optionsDialog(self)

self.toolBar = QToolBar()
self.toolBar.setEnabled(True)
#self.toolBar.setFont(font)
@@ -121,13 +122,16 @@ def __init__(self, parent=None):
self.clearButton.setIconVisibleInMenu(True)
self.clearButton.setToolTip(clearBt)
self.clearButton.setText(clearBt)
## Action for paste snippets code
# self.currentLayerButton = QAction(parent)
# self.currentLayerButton.setCheckable(False)
# self.currentLayerButton.setEnabled(True)
# self.currentLayerButton.setIcon(QIcon("icon/iconTempConsole.png"))
# self.currentLayerButton.setMenuRole(QAction.PreferencesRole)
# self.currentLayerButton.setIconVisibleInMenu(True)
## Action for settings
optionsBt = QCoreApplication.translate("PythonConsole", "Settings")
self.optionsButton = QAction(parent)
self.optionsButton.setCheckable(False)
self.optionsButton.setEnabled(True)
self.optionsButton.setIcon(QIcon(":/images/console/iconSettingsConsole.png"))
self.optionsButton.setMenuRole(QAction.PreferencesRole)
self.optionsButton.setIconVisibleInMenu(True)
self.optionsButton.setToolTip(optionsBt)
self.optionsButton.setText(optionsBt)
## Action menu for class
actionClassBt = QCoreApplication.translate("PythonConsole", "Import Class")
self.actionClass = QAction(parent)
@@ -232,6 +236,7 @@ def __init__(self, parent=None):
self.toolBar.addAction(self.clearButton)
self.toolBar.addAction(self.actionClass)
self.toolBar.addAction(self.actionScript)
self.toolBar.addAction(self.optionsButton)
self.toolBar.addAction(self.helpButton)
self.toolBar.addAction(self.runButton)
## Menu Import Class
@@ -261,7 +266,7 @@ def __init__(self, parent=None):
self.edit.setFocus()

self.clearButton.triggered.connect(self.edit.clearConsole)
#self.currentLayerButton.triggered.connect(self.cLayer)
self.optionsButton.triggered.connect(self.openSettings)
self.loadIfaceButton.triggered.connect(self.iface)
self.loadSextanteButton.triggered.connect(self.sextante)
self.loadQtCoreButton.triggered.connect(self.qtCore)
@@ -270,9 +275,8 @@ def __init__(self, parent=None):
self.openFileButton.triggered.connect(self.openScriptFile)
self.saveFileButton.triggered.connect(self.saveScriptFile)
self.helpButton.triggered.connect(self.openHelp)

def cLayer(self):
self.edit.commandConsole('cLayer')
QObject.connect(self.options.buttonBox, SIGNAL("accepted()"),
self.prefChanged)

def sextante(self):
self.edit.commandConsole('sextante')
@@ -288,7 +292,7 @@ def qtGui(self):

def openScriptFile(self):
settings = QSettings()
lastDirPath = settings.value("/pythonConsole/lastDirPath").toString()
lastDirPath = settings.value("pythonConsole/lastDirPath").toString()
scriptFile = QFileDialog.getOpenFileName(
self, "Open File", lastDirPath, "Script file (*.py)")
if scriptFile.isEmpty() == False:
@@ -300,7 +304,7 @@ def openScriptFile(self):
self.edit.insertTextFromFile(listScriptFile)

lastDirPath = QFileInfo(scriptFile).path()
settings.setValue("/pythonConsole/lastDirPath", QVariant(scriptFile))
settings.setValue("pythonConsole/lastDirPath", QVariant(scriptFile))


def saveScriptFile(self):
@@ -329,12 +333,18 @@ def saveScriptFile(self):
def openHelp(self):
dlg = HelpDialog()
dlg.exec_()

def openSettings(self):
#options = optionsDialog()
self.options.exec_()

def prefChanged(self):
self.edit.refreshLexerProperties()

def closeEvent(self, event):
self.edit.writeHistoryFile()
QWidget.closeEvent(self, event)


if __name__ == '__main__':
a = QApplication(sys.argv)
console = PythonConsoleWidget()
@@ -34,7 +34,7 @@ <h2 id="headerTitle">Python Console for QGIS</h2>
</tr>
</table>
<p align="justify">
<span id="headerSubject">Python Console based on PyQScintilla2. (Developed by Salvatore Larosa)</span>
<span id="headerSubject">Python Console based on PyQScintilla2.</span>
<br><br>
<span id="headerSubjectMain">To access Quantum GIS environment from this console
use qgis.utils.iface object (instance of QgisInterface class).
@@ -64,16 +64,22 @@ <h4 id="features">Features</h4>
<br>
<li><span id="featuresB">CTRL+ALT+SPACE to view the command history list.</span></li>
<br>
<li><span id="featuresLoadAPI">Open Quantum GIS API documentation by typing <b>_api</b>.</span></li>
<br>
<li><span id="featuresLoadCookBook">Open PyQGIS Cookbook by typing <b>_pyqgis</b>.</span>
</li>
<br>
<li><span id="featuresC">Saves the command history by typing <b>_save</b> or closing the widget.<br>
This command saves the history command in the file ~/.qgis/console_history.txt</span>
</li>
<br>
<li><span id="featuresD">Clears the command history by typing <b>_clear</b>.<br>
This command clears the command history from file ~/.qgis/console_history.txt</span>
This command clears the temporary command history</span>
</li>
<br>
<li><span id="featuresE">Clears completely command history by typing <b>_clearAll</b>.<br>
This command clears completely the command history. It has an irreversible effect.</span>
This command clears completely the command history (both temporary and ~/.qgis/console_history.txt).
It has an irreversible effect.</span>
</li>
</ul>
</p>
@@ -120,6 +126,10 @@ <h4 id="toolbar">Toolbar</h4>
<td><img src="qrc:/images/console/iconSaveConsole.png" /></td>
<td><span id="toolbarScriptSave">Tool to save a python script</span></td>
</tr>
<tr>
<td><img src="qrc:/images/console/iconSettingsConsole.png" /></td>
<td colspan="2"><span id="toolbarSettings">Settings</span></td>
</tr>
<tr>
<td><img src="qrc:/images/console/iconHelpConsole.png" /></td>
<td colspan="2"><span id="toolbarHelp">Help</span></td>
@@ -1,6 +1,6 @@
i18n_dict = {
"header.title" : "Python Console für QGIS",
"header.subject" : "Python Console auf PyQScintilla2 basierend (entwickelt von Salvatore Larosa)",
"header.subject" : "Python Console auf PyQScintilla2 basierend",
"header.subject.main" : "Das Objekt qgis.utils.iface (Instanz der Klasse QgisInterface) ermöglicht den Zugriff \
quf die Quantum GIS Umgebung von der Konsole aus. \
Über den defür bestimmten Knopf in der Werkzeugleiste \
@@ -1,6 +1,6 @@
i18n_dict = {
"header.title" : "Python Console for QGIS",
"header.subject" : "Python Console based on PyQScintilla2. (Developed by Salvatore Larosa)",
"header.subject" : "Python Console based on PyQScintilla2.",
"header.subject.main" : "To access Quantum GIS environment from this console \
use qgis.utils.iface object (instance of QgisInterface class). \
To import the class QgisInterface can also use the dedicated \
@@ -15,6 +15,8 @@ i18n_dict = {
This command clears the command history from file ~/.qgis/console_history.txt",
"features.e" : "Clears completely command history by typing '_clearAll'. \
This command clears completely the command history. It has an irreversible effect.",
"features.api.doc" : "Open Quantum GIS API documentation by typing '_api'.",
"features.pyqgis.doc" : "Open PyQGIS Cookbook by typing '_pyqgis'.",
"toolbar" : "Toolbar",
"toolbar.title" : "The following is a description of the tools in the toolbar:",
"toolbar.clear" : "Tool to clear python console",
@@ -24,6 +26,7 @@ i18n_dict = {
"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.settings" : "Settings",
"toolbar.help" : "Help",
"toolbar.run" : "Run command (like Enter key pressed)",
"thanks" : "Acknowledgments",
@@ -1,6 +1,6 @@
i18n_dict = {
"header.title" : "Console Python per QGIS",
"header.subject" : "Console Python basata su PyQScintilla2. (Sviluppata da Salvatore Larosa)",
"header.subject" : "Console Python basata su PyQScintilla2.",
"header.subject.main" : "Per accedere all'ambiente Quantum GIS da questa console \
usa l'oggetto qgis.utils.iface (istanza della classe QgisInterface). \
Per importare la classe QgisInterface puoi usare anche il bottone dedicato che si trova \
@@ -15,6 +15,8 @@ i18n_dict = {
La cronologia verrà cancellata dal file ~/.qgis/console_history.txt",
"features.e" : "Possibilità di cancellare completamente la cronologia dei comandi digitando '_clearAll'. \
La cronologia verrà cancellata sia dal file che dalla memoria temporanea.",
"features.api.doc" : "Apri la documentazione completa sulle API di QuantumGIS digitando '_api'.",
"features.pyqgis.doc" : "Apri il Cookbook PyQGIS digitando '_pyqgis'.",
"toolbar" : "Toolbar",
"toolbar.title" : "Di seguito la descrizione dei comandi disponibile nella toolbar:",
"toolbar.clear" : "Strumento per pulire la console",
@@ -24,6 +26,7 @@ i18n_dict = {
"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.settings" : "Impostazioni",
"toolbar.help" : "Aiuto",
"toolbar.run" : "Esegui comando (simile al tasto <Invio>)",
"thanks" : "Ringraziamenti",
@@ -1,6 +1,6 @@
i18n_dict = {
"header.title" : "Консоль Python для QGIS",
"header.subject" : "Консоль Python на основе PyQScintilla2. (Разработана Salvatore Larosa)",
"header.subject" : "Консоль Python на основе PyQScintilla2.",
"header.subject.main" : "Для доступа к окружению Quantum GIS из консоли \
используйте объект qgis.utils.iface (экземпляр класса QgisInterface). \
Также можно импортировать класс QgisInterface при помощи специальной \
@@ -10,6 +10,8 @@ $('span#featuresB').text($.i18n._('features.b'));
$('span#featuresC').text($.i18n._('features.c'));
$('span#featuresD').text($.i18n._('features.d'));
$('span#featuresE').text($.i18n._('features.e'));
$('span#featuresLoadAPI').text($.i18n._('features.api.doc'));
$('span#featuresLoadCookBook').text($.i18n._('features.pyqgis.doc'));
$('h4#toolbar').text($.i18n._('toolbar'));
$('span#toolbarTitle').text($.i18n._('toolbar.title'));
$('span#toolbarClear').text($.i18n._('toolbar.clear'));
@@ -20,6 +22,7 @@ $('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'));
$('span#toolbarSettings').text($.i18n._('toolbar.settings'));
$('span#toolbarRun').text($.i18n._('toolbar.run'));
$('h4#thanks').text($.i18n._('thanks'));
$('span#thanksText').text($.i18n._('thanks.text'));

0 comments on commit ca20be1

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