QGIS/resources/context_help/PythonConsole

168 lines
6.1 KiB
Plaintext

<style>
#toolbarConsole td{
background: #f6f6f6;
}
</style>
<h3>Python Console for QGIS</h3>
<a href="#console">Console</a><br>
<a href="#editor">Editor</a><br>
<a href="#settings">Settings</a><br><br>
<table>
<tr>
<td>
<p align='justify'>
The QGIS Python Console is an interactive shell for the python command executions.
It also has a python file editor that allows you to edit and save your python scripts.
Both console and editor are based on PyQScintilla2 package.<br>
The console is split in two main panes, top and bottom one
resizable by using the horizontal splitter. Output area pane is a widget read-only which
shows the commands output. You can drag and drop or copy and paste text into input area and
execute code snippets from the output pane by selecting some text and clicking on the
<label>Enter selected</label> command from the context menu.
No matter if selected text contains the interpreter prompt (>>>, ...). Input area pane is the interactive
python shell for input commands.<br>To access to the python file editor use the
<label>Show editor</label> button
from the toolbar. The editor allows to edit and save python file and it offers basic functionality
for managing your code (comment and
uncomment code, check syntax, share the code via codepad.org and much more).
</p>
</td>
</tr>
</table>
<a name="console">
<h4>Console</h4>
</a>
<b><i>Main features:</i></b>
<table>
<tr>
<td>
<ul>
<li>Code completion, highlighting syntax and calltips for the following APIs:
<ol>
<li>Python</li>
<li>PyQGIS</li>
<li>PyQt4</li>
<li>QScintilla2</li>
<li>osgeo-gdal-ogr</li>
</ol>
</li>
<br>
<li><label>Ctrl+Alt+Space</label> to view the auto-completion list.</li>
<br>
<li><label>Ctrl+Shift+Space</label> to view the command history list.</li>
<br>
<li>Execute code snippets with the <label>Enter selected</label> command from output pane.</li>
<br>
<li>Open QGIS API documentation by typing <label>_api</label>.</li>
<br>
<li>Open PyQGIS Cookbook by typing <label>_pyqgis</label>.</li>
<br>
<li>Save and clear the command history accessing from context menu of input pane.
The history will be saved into the file ~/.qgis2/console_history.txt</li>
<br>
</ul>
</td>
<td><img src="qrc:/images/themes/default/console/consoleHelp.png" /></td>
</tr>
</table>
<b><i>Toolbar:</i></b>
<table width="100%" id='toolbarConsole'>
<tr>
<td><img src="qrc:/images/themes/default/console/iconClearConsole.png" /></td>
<td colspan="2">Clear python console</td>
</tr>
<tr>
<td><img src="qrc:/images/themes/default/console/iconClassConsole.png" /></td>
<td><img src="qrc:/images/themes/default/console/iconProcessingConsole.png" /></td>
<td>Import Processing class</td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/themes/default/console/iconQtCoreConsole.png" /></td>
<td>Import PyQt4.QtCore class</td>
</tr>
<tr>
<td></td>
<td><img src="qrc:/images/themes/default/console/iconQtGuiConsole.png" /></td>
<td>Tool to import PyQt4.QtGui class</td>
</tr>
<tr>
<td><img src="qrc:/images/themes/default/console/iconRunConsole.png" /></td>
<td colspan="2">Run command (like Enter key pressed)</td>
</tr>
<tr>
<td><img src="qrc:/images/themes/default/console/iconSettingsConsole.png" /></td>
<td colspan="2">Settings</td>
</tr>
<tr>
<td><img src="qrc:/images/themes/default/console/iconHelpConsole.png" /></td>
<td colspan="2">Help</td>
</tr>
</table>
<a name="editor">
<h4>Editor</h4>
</a>
<b><i>Main features:</i></b>
<table>
<tr>
<td>
<img src="qrc:/images/themes/default/console/editorHelp.png" />
<img src="qrc:/images/themes/default/console/classBrowserHelp.png" />
</td>
<td>
<ul>
<li>Code completion, highlighting syntax and calltips for the following APIs:
<ol>
<li>Python</li>
<li>PyQGIS</li>
<li>PyQt4</li>
<li>QScintilla2</li>
<li>osgeo-gdal-ogr</li>
</ol>
</li>
<br>
<li><label>Ctrl+Space</label> to view the auto-completion list.</li>
<br>
<li>Sharing code snippets via codepad.org.</li>
<br>
<li><label>Ctrl+4</label> Syntax check.</li>
<br>
<li>Object inspector: a class and function browser.</li>
<br>
<li>Go to an object definition with a mouse click. (from Object inspector)</li>
<br>
<li>Execute code snippets with the <label>Enter selected</label> command.</li>
<br>
<li>Execute the whole script with the <label>Run script</label> command
(this creates a byte-compiled file with the extension .pyc)</li>
<br>
</ul>
</td>
</tr>
</table>
<a name="settings">
<h4>Settings</h4>
</a>
<b><i>Further settings for python console:</i></b>
<ul>
<li><label>Autocompletion:</label> If checked the code completion is enabled. You can get autocompletion
from current document, from installed APIs and both from APIs and current document</li>
<br>
<li><label>Autocompletion threshold:</label> Sets the threshold to display the autocompletion list (in chars typed)</li>
<br>
<li><label>Automatic parentheses insertion:</label> If checked enables the autoclosing for bracket</li>
<br>
<li><label>Auto-save script before running:</label> Allows you to save automatically the
script to be executed in order to avoid to save it after any modification.
This action will store a temporary file into the temporary system directory
that will be automatically deleted after running.</li>
<br>
<li><label>Using preloaded APIs file:</label> You can choose whether use the preload APIs file or load some APIs files saved on your system.</li>
<br>
<li><label>Using prepared APIs file:</label> If checked the *.pap file will be used for code completion. To generate a prepared APIs file you have to load least an *.api file and then compile it by clicking on <label>Compile Apis...</label> button.</li>
</ul>
<p style='border: 1px solid; background:#f6f6f6;' align='justify'>
<b>Note:</b> To save the state of console's widgets you have to close the Python Console
from the close button. This allows you to save the geometry to be restored to the next start.
</p>