Skip to content

Commit 10a57ad

Browse files
committed
fixed problem when running grass in modeler (wrong output names, it was a problem introduced by the grass session functionalities)
reverted shell=true in R execution Removed help files help menu
1 parent 81807d4 commit 10a57ad

File tree

838 files changed

+41
-50485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

838 files changed

+41
-50485
lines changed

python/plugins/sextante/SextantePlugin.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ def initGui(self):
9494
QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults)
9595
self.menu.addAction(self.resultsAction)
9696

97-
self.helpAction = QAction(QIcon(":/sextante/images/help.png"),
98-
QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
99-
self.iface.mainWindow())
100-
QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
101-
self.menu.addAction(self.helpAction)
97+
#=======================================================================
98+
# self.helpAction = QAction(QIcon(":/sextante/images/help.png"),
99+
# QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
100+
# self.iface.mainWindow())
101+
# QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
102+
# self.menu.addAction(self.helpAction)
103+
#=======================================================================
102104

103105
menuBar = self.iface.mainWindow().menuBar()
104106
menuBar.insertMenu(menuBar.actions()[-1], self.menu)
@@ -137,5 +139,7 @@ def openConfig(self):
137139
dlg = ConfigDialog(self.toolbox)
138140
dlg.exec_()
139141

140-
def openHelp(self):
141-
QDesktopServices.openUrl(QUrl(os.path.dirname(__file__) + "/help/index.html"))
142+
#===========================================================================
143+
# def openHelp(self):
144+
# QDesktopServices.openUrl(QUrl(os.path.dirname(__file__) + "/help/index.html"))
145+
#===========================================================================

python/plugins/sextante/core/Sextante.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
from sextante.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
4848
from sextante.mmqgisx.MMQGISXAlgorithmProvider import MMQGISXAlgorithmProvider
4949
from sextante.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
50-
from sextante.pymorph.PymorphAlgorithmProvider import PymorphAlgorithmProvider
50+
#from sextante.pymorph.PymorphAlgorithmProvider import PymorphAlgorithmProvider
5151
from sextante.r.RAlgorithmProvider import RAlgorithmProvider
5252
from sextante.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
5353
from sextante.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider
@@ -120,7 +120,7 @@ def initialize():
120120
Sextante.addProvider(FToolsAlgorithmProvider())
121121
Sextante.addProvider(ModelerOnlyAlgorithmProvider())
122122
Sextante.addProvider(GdalOgrAlgorithmProvider())
123-
Sextante.addProvider(PymorphAlgorithmProvider())
123+
#Sextante.addProvider(PymorphAlgorithmProvider())
124124
Sextante.addProvider(LidarToolsAlgorithmProvider())
125125
Sextante.addProvider(OTBAlgorithmProvider())
126126
Sextante.addProvider(RAlgorithmProvider())

python/plugins/sextante/grass/GrassAlgorithm.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* *
1717
***************************************************************************
1818
"""
19+
import uuid
1920

2021
__author__ = 'Victor Olaya'
2122
__date__ = 'August 2012'
@@ -254,13 +255,17 @@ def processAlgorithm(self, progress):
254255
else:
255256
command+=(" " + param.name + "=" + str(param.value));
256257

258+
uniqueSufix = str(uuid.uuid4()).replace("-","");
257259
for out in self.outputs:
258260
if isinstance(out, OutputFile):
259261
command+=(" " + out.name + "=\"" + out.value + "\"");
260262
else:
261-
command += (" " + out.name)
262-
out.name += ("_"+str(len(self.exportedLayers))) # make sure output is unique within a session
263-
command += ("=" + out.name)
263+
#an output name to make sure it is unique if the session uses this algorithm several times
264+
uniqueOutputName = out.name + uniqueSufix
265+
command += (" " + out.name + "=" + uniqueOutputName)
266+
# add output file to exported layers, to indicate that they are present in GRASS
267+
self.exportedLayers[out.value]= uniqueOutputName
268+
264269

265270
command += " --overwrite"
266271
commands.append(command)
@@ -270,24 +275,21 @@ def processAlgorithm(self, progress):
270275
if isinstance(out, OutputRaster):
271276
filename = out.value
272277
#Raster layer output: adjust region to layer before exporting
273-
commands.append("g.region rast=" + out.name)
278+
commands.append("g.region rast=" + out.name + uniqueSufix)
274279
command = "r.out.gdal -c createopt=\"TFW=YES,COMPRESS=LZW\""
275280
command += " input="
276-
command += out.name
281+
command += out.name + uniqueSufix
277282
command += " output=\"" + filename + "\""
278283
commands.append(command)
279-
# add output file to exported layers, to indicate that they are present in GRASS
280-
self.exportedLayers[filename]= out.name
284+
281285
if isinstance(out, OutputVector):
282286
filename = out.value
283-
command = "v.out.ogr -ce input=" + out.name
287+
command = "v.out.ogr -ce input=" + out.name + uniqueSufix
284288
command += " dsn=\"" + os.path.dirname(out.value) + "\""
285289
command += " format=ESRI_Shapefile"
286290
command += " olayer=" + os.path.basename(out.value)[:-4]
287291
command += " type=auto"
288292
commands.append(command)
289-
# add output file to exported layers
290-
self.exportedLayers[filename]= out.name
291293

292294
#4 Run GRASS
293295
loglines = []

python/plugins/sextante/grass/GrassUtils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def createGrassBatchJobFileFromGrassCommands(commands):
178178

179179
@staticmethod
180180
def grassMapsetFolder():
181-
tempfolder = os.path.join(os.path.expanduser("~"), "sextante", "tempdata", "grassdata", "temp_location")
181+
tempfolder = os.path.join(SextanteUtils.tempFolder(), "grassdata", "temp_location")
182182
mkdir(tempfolder)
183183
return tempfolder
184184

python/plugins/sextante/gui/SextanteToolbox.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* *
1717
***************************************************************************
1818
"""
19+
import webbrowser
1920

2021
__author__ = 'Victor Olaya'
2122
__date__ = 'August 2012'
@@ -86,14 +87,17 @@ def setupUi(self):
8687
QMetaObject.connectSlotsByName(self)
8788

8889
def configureProviders(self):
89-
#QDesktopServices.openUrl(QUrl(os.path.join(os.path.dirname(__file__), os.path.pardir) + "/help/3rdParty.html"))
90-
filename = os.path.join(os.path.dirname(__file__), "..", "help", "3rdParty.html")
91-
if os.name == "nt":
92-
os.startfile(filename)
93-
elif sys.platform == "darwin":
94-
subprocess.Popen(('open', filename))
95-
else:
96-
subprocess.call(('xdg-open', filename))
90+
webbrowser.open("http://docs.qgis.org/html/en/user_manual/sextante/3rdParty.html")
91+
#=======================================================================
92+
# #QDesktopServices.openUrl(QUrl(os.path.join(os.path.dirname(__file__), os.path.pardir) + "/help/3rdParty.html"))
93+
# filename = os.path.join(os.path.dirname(__file__), "..", "help", "3rdParty.html")
94+
# if os.name == "nt":
95+
# os.startfile(filename)
96+
# elif sys.platform == "darwin":
97+
# subprocess.Popen(('open', filename))
98+
# else:
99+
# subprocess.call(('xdg-open', filename))
100+
#=======================================================================
97101

98102
def showPopupMenu(self,point):
99103
item = self.algorithmTree.itemAt(point)

python/plugins/sextante/help/.buildinfo

-4
This file was deleted.

0 commit comments

Comments
 (0)