Skip to content
Permalink
Browse files

added notice when grass help is not configured

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@194 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf
volayaf committed May 29, 2012
1 parent 6d2ee69 commit 65357b2027501c70cc1e30345a24240ffacf313f
@@ -0,0 +1,5 @@
class WrongHelpFileException(Exception):

def __init__(self, msg):
Exception.__init__(self)
self.msg = msg
@@ -21,6 +21,7 @@
from sextante.core.SextanteUtils import SextanteUtils
from sextante.parameters.ParameterSelection import ParameterSelection
from sextante.core.LayerExporter import LayerExporter
from sextante.core.WrongHelpFileException import WrongHelpFileException

class GrassAlgorithm(GeoAlgorithm):

@@ -40,10 +41,13 @@ def getIcon(self):

def helpFile(self):
folder = GrassUtils.grassHelpPath()
if str(folder).strip() != "":
helpfile = str(folder) + os.sep + self.grassName + ".html"
#if str(folder).strip() != "":
helpfile = str(folder) + os.sep + self.grassName + ".html"
if os.path.exists(helpfile):
return helpfile
return None
else:
raise WrongHelpFileException("Grass help folder is not correctly configured.\nPlease configure it")
#return None

def getParameterDescriptions(self):
descs = {}
@@ -27,6 +27,7 @@
from sextante.outputs.OutputRaster import OutputRaster
from sextante.outputs.OutputVector import OutputVector
from sextante.outputs.OutputTable import OutputTable
from sextante.core.WrongHelpFileException import WrongHelpFileException

try:
_fromUtf8 = QtCore.QString.fromUtf8
@@ -79,11 +80,14 @@ def setupUi(self, dialog, alg):
QtCore.QMetaObject.connectSlotsByName(dialog)

def showHelp(self):
if self.alg.helpFile():
dlg = HTMLViewerDialog(self.alg.helpFile())
dlg.exec_()
else:
QMessageBox.warning(self.dialog, "No help available", "No help is available for the current algorithm.")
try:
if self.alg.helpFile():
dlg = HTMLViewerDialog(self.alg.helpFile())
dlg.exec_()
else:
QMessageBox.warning(self.dialog, "No help available", "No help is available for the current algorithm.")
except WrongHelpFileException, e:
QMessageBox.warning(self.dialog, "Help", e.msg)


def setParamValues(self):
@@ -23,6 +23,7 @@
from sextante.parameters.ParameterFile import ParameterFile
from sextante.outputs.OutputFile import OutputFile
from sextante.gui.HTMLViewerDialog import HTMLViewerDialog
from sextante.core.WrongHelpFileException import WrongHelpFileException

class ModelerParametersDialog(QtGui.QDialog):

@@ -73,11 +74,14 @@ def setupUi(self):
QtCore.QMetaObject.connectSlotsByName(self)

def showHelp(self):
if self.alg.helpFile():
dlg = HTMLViewerDialog(self.alg.helpFile())
dlg.exec_()
else:
QMessageBox.warning(self.dialog, "No help available", "No help is available for this algorithm.")
try:
if self.alg.helpFile():
dlg = HTMLViewerDialog(self.alg.helpFile())
dlg.exec_()
else:
QMessageBox.warning(self.dialog, "No help available", "No help is available for the current algorithm.")
except WrongHelpFileException, e:
QMessageBox.warning(self.dialog, "Help", e.msg)

def getRasterLayers(self):
layers = []

0 comments on commit 65357b2

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