Skip to content

Commit cf272f8

Browse files
committedSep 10, 2012
New Python Console
1 parent 51606a6 commit cf272f8

14 files changed

+804
-295
lines changed
 

‎python/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ SET (QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)
9797

9898
ADD_CUSTOM_TARGET(compile_python_files ALL)
9999

100+
ADD_SUBDIRECTORY(iconConsole)
101+
ADD_SUBDIRECTORY(helpConsole)
102+
100103
ADD_CUSTOM_COMMAND(TARGET compile_python_files
101104
POST_BUILD
102105
COMMAND ${CMAKE_COMMAND} -E make_directory ${QGIS_PYTHON_OUTPUT_DIRECTORY}
@@ -115,3 +118,6 @@ ENDFOREACH(file)
115118
PYTHON_INSTALL(__init__.py ${QGIS_PYTHON_DIR})
116119
PYTHON_INSTALL(utils.py ${QGIS_PYTHON_DIR})
117120
PYTHON_INSTALL(console.py ${QGIS_PYTHON_DIR})
121+
PYTHON_INSTALL(console_sci.py ${QGIS_PYTHON_DIR})
122+
PYTHON_INSTALL(help.py ${QGIS_PYTHON_DIR})
123+

‎python/console.py

Lines changed: 232 additions & 295 deletions
Large diffs are not rendered by default.

‎python/console_sci.py

Lines changed: 456 additions & 0 deletions
Large diffs are not rendered by default.

‎python/help.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from PyQt4 import QtCore, QtGui, QtWebKit
2+
from PyQt4.QtCore import *
3+
from PyQt4.QtGui import *
4+
import os
5+
6+
class HelpDialog(QtGui.QDialog):
7+
8+
def __init__(self):
9+
QtGui.QDialog.__init__(self)
10+
self.setModal(True)
11+
self.setupUi()
12+
13+
def setupUi(self):
14+
self.resize(500, 300)
15+
self.webView = QtWebKit.QWebView()
16+
self.setWindowTitle("Help Python Console")
17+
self.verticalLayout= QtGui.QVBoxLayout()
18+
self.verticalLayout.setSpacing(2)
19+
self.verticalLayout.setMargin(0)
20+
self.verticalLayout.addWidget(self.webView)
21+
self.closeButton = QtGui.QPushButton()
22+
self.closeButton.setText("Close")
23+
self.closeButton.setMaximumWidth(150)
24+
self.horizontalLayout= QtGui.QHBoxLayout()
25+
self.horizontalLayout.setSpacing(2)
26+
self.horizontalLayout.setMargin(0)
27+
self.horizontalLayout.addStretch(1000)
28+
self.horizontalLayout.addWidget(self.closeButton)
29+
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow)
30+
self.verticalLayout.addLayout(self.horizontalLayout)
31+
self.setLayout(self.verticalLayout)
32+
filename = os.path.dirname(__file__) + "/helpConsole/help.htm"
33+
url = QtCore.QUrl(filename)
34+
self.webView.load(url)
35+
36+
def closeWindow(self):
37+
self.close()

‎python/helpConsole/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FILE(GLOB HTML_FILES *.htm)
2+
INSTALL(FILES ${HTML_FILES} DESTINATION ${QGIS_PYTHON_DIR}/helpConsole)

‎python/helpConsole/help.htm

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<title>Help Python Console</title>
5+
<style>
6+
body{
7+
font-family: verdana,arial,helvetica,sans-serif;
8+
/*font-family:Verdana,Geneva,sans-serif;*/
9+
font-size : 12px;
10+
}
11+
</style>
12+
</head>
13+
<body>
14+
<table>
15+
<tr>
16+
<td>
17+
<img src="../iconConsole/imgHelpDialog.png" />
18+
</td>
19+
<td>
20+
<h2>Python Console for QGIS</h2>
21+
</td>
22+
</tr>
23+
</table>
24+
<p align="justify">
25+
To access Quantum GIS environment from this console
26+
use qgis.utils.iface object (instance of QgisInterface class).
27+
To import the class QgisInterface can also use the dedicated
28+
button on the toolbar on the left.
29+
<br><br>
30+
The following is a description of the tools in the toolbar:
31+
</p>
32+
<table width="100%" bordercolor="#000" border="1">
33+
<tr>
34+
<td><img src="../iconConsole/iconClearConsole.png" /></td>
35+
<td>Tool to clear python console</td>
36+
</tr>
37+
<tr>
38+
<td><img src="../iconConsole/iconTempConsole.png" /></td>
39+
<td>Tool to import iface class</td>
40+
</tr>
41+
<tr>
42+
<td><img src="../iconConsole/iconOpenConsole.png" /></td>
43+
<td>Tool to open a python script and load in console</td>
44+
</tr>
45+
<tr>
46+
<td><img src="../iconConsole/iconSaveConsole.png" /></td>
47+
<td>Tool to save a python script</td>
48+
</tr>
49+
<tr>
50+
<td><img src="../iconConsole/iconHelpConsole.png" /></td>
51+
<td>This! ;-)</td>
52+
</tr>
53+
<tr>
54+
<td><img src="../iconConsole/iconRunConsole.png" /></td>
55+
<td>Run commnand (like Enter key pressed)</td>
56+
</tr>
57+
</table>
58+
</body>
59+
</html>

‎python/iconConsole/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
SET(ICON_FILES
2+
iconClearConsole.png
3+
iconOpenConsole.png
4+
iconRunConsole.png
5+
iconTempConsole.png
6+
iconSaveConsole.png
7+
iconHelpConsole.png
8+
imgHelpDialog.png
9+
)
10+
11+
FILE(GLOB ICON_FILES *.png)
12+
INSTALL(FILES ${ICON_FILES} DESTINATION ${QGIS_PYTHON_DIR}/iconConsole)
1.2 KB
Loading
1.77 KB
Loading
1.16 KB
Loading

‎python/iconConsole/iconRunConsole.png

3.76 KB
Loading
1.21 KB
Loading
1.91 KB
Loading

‎python/iconConsole/imgHelpDialog.png

3.56 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.