Skip to content

Commit a36a2a9

Browse files
author
volayaf@gmail.com
committedJun 15, 2012
updated help
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@246 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
1 parent cfab06e commit a36a2a9

19 files changed

+92
-194
lines changed
 

‎src/sextante/core/AlgorithmProvider.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ class AlgorithmProvider():
99
'''
1010

1111
def __init__(self):
12+
#indicates if the provider should be active by default.
13+
#For provider relying on an external software, this should be
14+
#false, so the user should activate them manually and install
15+
#the required software in advance.
16+
self.activate = True
1217
self.actions = []
1318
self.contextMenuActions = []
1419

20+
1521
def loadAlgorithms(self):
1622
self.algs = []
1723
name = "ACTIVATE_" + self.getName().upper().replace(" ", "_")
@@ -36,7 +42,7 @@ def initializeSettings(self):
3642
By default it just adds a setting to activate or deactivate algorithms from the provider'''
3743
SextanteConfig.settingIcons[self.getDescription()] = self.getIcon()
3844
name = "ACTIVATE_" + self.getName().upper().replace(" ", "_")
39-
SextanteConfig.addSetting(Setting(self.getDescription(), name, "Activate", True))
45+
SextanteConfig.addSetting(Setting(self.getDescription(), name, "Activate", self.activate))
4046

4147
def unload(self):
4248
'''Do here anything that you want to be done when the provider is removed from the list of available ones.

‎src/sextante/core/Sextante.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
from sextante.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
1818
from sextante.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider
1919
from sextante.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
20-
from sextante.lastools.LasToolsAlgorithmProvider import LasToolsAlgorithmProvider
21-
from sextante.core.SextanteUtils import SextanteUtils
2220
from sextante.algs.SextanteAlgorithmProvider import SextanteAlgorithmProvider
23-
from sextante.fusion.FusionAlgorithmProvider import FusionAlgorithmProvider
2421
from sextante.pymorph.PymorphAlgorithmProvider import PymorphAlgorithmProvider
2522
from sextante.mmqgisx.MMQGISXAlgorithmProvider import MMQGISXAlgorithmProvider
2623
from sextante.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider

‎src/sextante/core/SextanteExternalAppsConfigurer.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎src/sextante/gui/ConfigDialog.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
from PyQt4.QtGui import *
33
from PyQt4 import QtCore, QtGui
44
from sextante.core.SextanteConfig import SextanteConfig
5-
from sextante.core.Sextante import Sextante
6-
from sextante.core.SextanteUtils import SextanteUtils
7-
from sextante.gui.ExternalAppsConfigurer import ExternalAppsConfigurer
85

96

107
class ConfigDialog(QtGui.QDialog):
@@ -41,13 +38,6 @@ def setupUi(self):
4138
self.buttonBox = QtGui.QDialogButtonBox()
4239
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
4340
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
44-
#=======================================================================
45-
# if SextanteUtils.isWindows():
46-
# self.externalAppsButton = QtGui.QPushButton()
47-
# self.externalAppsButton.setText("Configure external apps")
48-
# self.horizontalLayout.addWidget(self.externalAppsButton)
49-
# QtCore.QObject.connect(self.externalAppsButton, QtCore.SIGNAL("clicked()"), self.configureExternalApps)
50-
#=======================================================================
5141
self.horizontalLayout.addSpacing(100)
5242
self.horizontalLayout.addWidget(self.buttonBox)
5343
self.verticalLayout.addLayout(self.horizontalLayout)
@@ -56,10 +46,6 @@ def setupUi(self):
5646
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.cancelPressed)
5747
QtCore.QMetaObject.connectSlotsByName(self)
5848

59-
def configureExternalApps(self):
60-
configurer = ExternalAppsConfigurer()
61-
configurer.configure()
62-
6349

6450
def fillTree(self):
6551
self.items = {}

‎src/sextante/gui/ExternalAppsConfigurer.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

‎src/sextante/gui/HTMLViewerDialog.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

‎src/sextante/gui/InteractiveHTMLViewerDialog.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

‎src/sextante/gui/SextanteToolbox.py

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
from sextante.core.SextanteLog import SextanteLog
1010
from sextante.core.SextanteConfig import SextanteConfig
1111
from sextante.core.QGisLayers import QGisLayers
12+
import os
13+
import sys
14+
import subprocess
1215

1316
try:
1417
_fromUtf8 = QtCore.QString.fromUtf8
@@ -37,6 +40,10 @@ def setupUi(self):
3740
self.verticalLayout = QtGui.QVBoxLayout(self.contents)
3841
self.verticalLayout.setSpacing(2)
3942
self.verticalLayout.setMargin(0)
43+
self.externalAppsButton = QtGui.QPushButton()
44+
self.externalAppsButton.setText("Click here to configure additional algorithm providers")
45+
QObject.connect(self.externalAppsButton, QtCore.SIGNAL("clicked()"), self.configureProviders)
46+
self.verticalLayout.addWidget(self.externalAppsButton)
4047
self.searchBox = QtGui.QLineEdit(self.contents)
4148
self.searchBox.textChanged.connect(self.fillTree)
4249
self.verticalLayout.addWidget(self.searchBox)
@@ -52,6 +59,15 @@ def setupUi(self):
5259
self.iface.addDockWidget(Qt.RightDockWidgetArea, self)
5360
QtCore.QMetaObject.connectSlotsByName(self)
5461

62+
def configureProviders(self):
63+
filename = os.path.join(os.path.dirname(__file__), "..", "help", "3rdParty.html")
64+
if os.name == "nt":
65+
os.startfile(filename)
66+
elif sys.platform == "darwin":
67+
subprocess.Popen(('open', filename))
68+
else:
69+
subprocess.call(('xdg-open', filename))
70+
5571
def showPopupMenu(self,point):
5672
item = self.algorithmTree.itemAt(point)
5773
if isinstance(item, TreeAlgorithmItem):
@@ -141,18 +157,20 @@ def fillTree(self):
141157
groups[alg.group] = groupItem
142158
algItem = TreeAlgorithmItem(alg)
143159
groupItem.addChild(algItem)
144-
#add actions
145-
actions = Sextante.actions[providerName]
146-
for action in actions:
147-
if text =="" or text.lower() in action.name.lower():
148-
if action.group in groups:
149-
groupItem = groups[action.group]
150-
else:
151-
groupItem = QtGui.QTreeWidgetItem()
152-
groupItem.setText(0,action.group)
153-
groups[action.group] = groupItem
154-
algItem = TreeActionItem(action)
155-
groupItem.addChild(algItem)
160+
161+
#add actions only if there are algorithms in this provider
162+
if len(groups)>0:
163+
actions = Sextante.actions[providerName]
164+
for action in actions:
165+
if text =="" or text.lower() in action.name.lower():
166+
if action.group in groups:
167+
groupItem = groups[action.group]
168+
else:
169+
groupItem = QtGui.QTreeWidgetItem()
170+
groupItem.setText(0,action.group)
171+
groups[action.group] = groupItem
172+
algItem = TreeActionItem(action)
173+
groupItem.addChild(algItem)
156174

157175
if len(groups)>0:
158176
providerItem = QtGui.QTreeWidgetItem()

‎src/sextante/help/3rdParty.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,18 @@ <h1>Configuring external applications<a class="headerlink" href="#configuring-ex
5252
<div class="section" id="introduction">
5353
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
5454
<p>SEXTANTE can be extended using additional applications, calling them
55-
from within SEXTANTE. Currently, SAGA, GRASS, OTB(Orfeo Toolbox) and R are supported, along
56-
with some other command-line applications that provide spatial data
57-
analysis functionalities.
58-
This chapter will show you how to configure SEXTANTE to include these
55+
from within SEXTANTE.</p>
56+
<p>By default, algorithms coming from external applications are not activated unless SEXTANTE has checked that the corresponding applications are installed in your system and can be executed. That means that there are probably many more algorithms available than those that you can see in the toolbox, but some extra configuration is needed to have them fully operational.</p>
57+
<p>This chapter will show you how to configure SEXTANTE to include these
5958
additional applications. Once you have correctly configured the system,
6059
you will be able to execute external algorithms from any SEXTANTE
6160
component like the toolbox or the graphical modeler, just like you do
6261
with any other SEXTANTE geoalgorithm.</p>
62+
<p>At the time of writing this manual, SEXTANTE has two external providers activated by default: GRASS and GDAL. This providers are activated because QGIS includes both the GRASS binaries and the GDAL library files, so there is no need for further configuration (QGIS developers have done that in advance for you). This might change in other versions, but for now it means that you need to manually install and configure those external programs. Do not worry, this is very easy to do. If you are running Linux, you just have to install the software yourself and then activate the corresponding algorithm provider. If you are running Windows, you should also tell SEXTANTE the path to the software.</p>
63+
<p>For each algorithm provider there is a group entry in the SEXTANTE configuration dialog, which contains at least an &#8220;Activate&#8221; item. Other parameters might appear if they are needed to configure the provider (mostly paths to executales and additional files). In the following sections, we will see how to set those parameters for the main providers currently available for SEXTANTE. But first, a couple of quick notes with important information about using algorithms based on external applications.</p>
6364
<div class="section" id="a-note-on-file-formats">
6465
<h3>A note on file formats<a class="headerlink" href="#a-note-on-file-formats" title="Permalink to this headline"></a></h3>
66+
<p>Algorithms provided by external applications have some differences when compared to &#8220;native&#8221; SEXTANTE algorithm. The main one of them is related to the file formats supported both for input and for output.</p>
6567
<p>When using an external software, opening a file in QGIS does not mean
6668
that it can be opened and processed as well on that other software. In
6769
most cases, it can read what you have opened in QGIS, but in some cases,
@@ -114,7 +116,7 @@ <h3>A note on vector layer selections<a class="headerlink" href="#a-note-on-vect
114116
<h2>SAGA<a class="headerlink" href="#saga" title="Permalink to this headline"></a></h2>
115117
<p>SAGA algorithms can be run from SEXTANTE if you have SAGA installed in
116118
your system and you configure SEXTANTE properly so it can find SAGA
117-
executables. In particular, the SAGA commandline executable is needed
119+
executables. In particular, the SAGA command-line executable is needed
118120
to run SAGA algorithms. SAGA binaries are not included with SEXTANTE, so
119121
you have to download and install the software yourself. Please check the
120122
SAGA website at for more information. SAGA 2.0.8 is needed.</p>
@@ -187,7 +189,7 @@ <h2>R. Creating R scripts<a class="headerlink" href="#r-creating-r-scripts" titl
187189
the syntax to use to call those R commands from SEXTANTE and how to use
188190
SEXTANTE objects (layers, tables) in them.</p>
189191
<p>The first thing you have to do, as we saw in the case of SAGA, is to
190-
tell SEXTANTE where you R binaries are located. You can do so using the
192+
tell SEXTANTE where your R binaries are located. You can do so using the
191193
<em>R folder</em> entry in the SEXTANTE configuration dialog. Once you have set
192194
that parameter, you can start creating your own R scripts and executing
193195
them.</p>
@@ -265,8 +267,9 @@ <h2>R. Creating R scripts<a class="headerlink" href="#r-creating-r-scripts" titl
265267
console instead, you have to tell SEXTANTE that you want the console to
266268
be shown once the execution is finished. To do so, just start the
267269
command lines that produce the results you want to print with the
268-
<math xmlns="http://www.w3.org/1998/Math/MathML">
269-
<mrow><mo>&gt;</mo></mrow></math>” sign. The output of all other lines will not be shown. For
270+
<span class="math">
271+
\(&gt;\)</span>
272+
” sign. The output of all other lines will not be shown. For
270273
instance, here is the description file of an algorithms that performs a
271274
normality test on a given field (column) of the attributes of a vector
272275
layer:</p>

0 commit comments

Comments
 (0)
Please sign in to comment.