Skip to content
Permalink
Browse files
[processing] rst files are now the default for help files
  • Loading branch information
volaya committed Jun 8, 2014
1 parent 2073026 commit d8dfdd25f1da91eb1f4467a7b5e5550e3adb75a4
Showing with 19 additions and 3 deletions.
  1. +18 −2 python/plugins/processing/core/GeoAlgorithm.py
  2. +1 −1 python/plugins/processing/gui/Help2Html.py
@@ -25,13 +25,15 @@

__revision__ = '$Format:%H$'

import inspect
import os.path
import traceback
import copy
from PyQt4 import QtGui
from PyQt4.QtCore import *
from qgis.core import *

from processing.gui.Help2Html import getHtmlFromRstFile
from processing.core.ProcessingLog import ProcessingLog
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.GeoAlgorithmExecutionException import \
@@ -112,11 +114,25 @@ def help(self):
"""Returns the help with the description of this algorithm.
It returns a tuple boolean, string. IF the boolean value is true, it means that
the string contains the actual description. If false, it is an url or path to a file
where the description is stored
where the description is stored.
Returns None if there is no help file available.
The default implementation looks for an rst file in a help folder under the folder
where the algorithm is located.
The name of the file is the name console name of the algorithm, without the namespace part
"""
return False, None
name = self.commandLineName().split(':')[1].lower()
filename = os.path.join(os.path.dirname(inspect.getfile(self.__class__)), 'help', name + '.rst')
print filename
try:
html = getHtmlFromRstFile(filename)
print html
return True, html
except:
print "error"
return False, None


def processAlgorithm(self):
"""Here goes the algorithm itself.
@@ -45,7 +45,7 @@

def getHtmlFromRstFile(rst):
if not os.path.exists(rst):
return ''
return None
with open(rst) as f:
lines = f.readlines()
s = "".join(lines)

0 comments on commit d8dfdd2

Please sign in to comment.