Skip to content
Permalink
Browse files

fixed problem when running grass in modeler (wrong output names, it w…

…as a problem introduced by the grass session functionalities)

reverted shell=true in R execution
Removed help files help menu
  • Loading branch information
volaya committed Nov 14, 2012
1 parent 81807d4 commit 10a57ad7ffad00f4ed258b027883e812a7a78c74
Showing 838 changed files with 41 additions and 50,485 deletions.
@@ -94,11 +94,13 @@ def initGui(self):
QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults)
self.menu.addAction(self.resultsAction)

self.helpAction = QAction(QIcon(":/sextante/images/help.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
self.iface.mainWindow())
QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
self.menu.addAction(self.helpAction)
#=======================================================================
# self.helpAction = QAction(QIcon(":/sextante/images/help.png"),
# QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
# self.iface.mainWindow())
# QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
# self.menu.addAction(self.helpAction)
#=======================================================================

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

def openHelp(self):
QDesktopServices.openUrl(QUrl(os.path.dirname(__file__) + "/help/index.html"))
#===========================================================================
# def openHelp(self):
# QDesktopServices.openUrl(QUrl(os.path.dirname(__file__) + "/help/index.html"))
#===========================================================================
@@ -47,7 +47,7 @@
from sextante.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
from sextante.mmqgisx.MMQGISXAlgorithmProvider import MMQGISXAlgorithmProvider
from sextante.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
from sextante.pymorph.PymorphAlgorithmProvider import PymorphAlgorithmProvider
#from sextante.pymorph.PymorphAlgorithmProvider import PymorphAlgorithmProvider
from sextante.r.RAlgorithmProvider import RAlgorithmProvider
from sextante.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
from sextante.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider
@@ -120,7 +120,7 @@ def initialize():
Sextante.addProvider(FToolsAlgorithmProvider())
Sextante.addProvider(ModelerOnlyAlgorithmProvider())
Sextante.addProvider(GdalOgrAlgorithmProvider())
Sextante.addProvider(PymorphAlgorithmProvider())
#Sextante.addProvider(PymorphAlgorithmProvider())
Sextante.addProvider(LidarToolsAlgorithmProvider())
Sextante.addProvider(OTBAlgorithmProvider())
Sextante.addProvider(RAlgorithmProvider())
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
import uuid

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

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


command += " --overwrite"
commands.append(command)
@@ -270,24 +275,21 @@ def processAlgorithm(self, progress):
if isinstance(out, OutputRaster):
filename = out.value
#Raster layer output: adjust region to layer before exporting
commands.append("g.region rast=" + out.name)
commands.append("g.region rast=" + out.name + uniqueSufix)
command = "r.out.gdal -c createopt=\"TFW=YES,COMPRESS=LZW\""
command += " input="
command += out.name
command += out.name + uniqueSufix
command += " output=\"" + filename + "\""
commands.append(command)
# add output file to exported layers, to indicate that they are present in GRASS
self.exportedLayers[filename]= out.name

if isinstance(out, OutputVector):
filename = out.value
command = "v.out.ogr -ce input=" + out.name
command = "v.out.ogr -ce input=" + out.name + uniqueSufix
command += " dsn=\"" + os.path.dirname(out.value) + "\""
command += " format=ESRI_Shapefile"
command += " olayer=" + os.path.basename(out.value)[:-4]
command += " type=auto"
commands.append(command)
# add output file to exported layers
self.exportedLayers[filename]= out.name

#4 Run GRASS
loglines = []
@@ -178,7 +178,7 @@ def createGrassBatchJobFileFromGrassCommands(commands):

@staticmethod
def grassMapsetFolder():
tempfolder = os.path.join(os.path.expanduser("~"), "sextante", "tempdata", "grassdata", "temp_location")
tempfolder = os.path.join(SextanteUtils.tempFolder(), "grassdata", "temp_location")
mkdir(tempfolder)
return tempfolder

@@ -16,6 +16,7 @@
* *
***************************************************************************
"""
import webbrowser

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

def configureProviders(self):
#QDesktopServices.openUrl(QUrl(os.path.join(os.path.dirname(__file__), os.path.pardir) + "/help/3rdParty.html"))
filename = os.path.join(os.path.dirname(__file__), "..", "help", "3rdParty.html")
if os.name == "nt":
os.startfile(filename)
elif sys.platform == "darwin":
subprocess.Popen(('open', filename))
else:
subprocess.call(('xdg-open', filename))
webbrowser.open("http://docs.qgis.org/html/en/user_manual/sextante/3rdParty.html")
#=======================================================================
# #QDesktopServices.openUrl(QUrl(os.path.join(os.path.dirname(__file__), os.path.pardir) + "/help/3rdParty.html"))
# filename = os.path.join(os.path.dirname(__file__), "..", "help", "3rdParty.html")
# if os.name == "nt":
# os.startfile(filename)
# elif sys.platform == "darwin":
# subprocess.Popen(('open', filename))
# else:
# subprocess.call(('xdg-open', filename))
#=======================================================================

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

This file was deleted.

0 comments on commit 10a57ad

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