Skip to content
Permalink
Browse files

[processing] Fixes #11363 - help file is created but not shown in the…

… Help tab
  • Loading branch information
slarosa committed Oct 8, 2014
1 parent c768f13 commit bb723027f4c4758d186990607f35827c39c699bd
Showing with 5 additions and 9 deletions.
  1. +5 −9 python/plugins/processing/gui/Help2Html.py
@@ -26,6 +26,7 @@

__revision__ = '$Format:%H$'

from PyQt4.QtCore import QCoreApplication
import os
import re
import json
@@ -42,7 +43,6 @@
(r"::(\s*\n(\s*\n)*((\s+).*?\n)(((\4).*?\n)|(\s*\n))*)",r"<pre>\1</pre>"),
("\n+", "</p><p>")]


def getHtmlFromRstFile(rst):
if not os.path.exists(rst):
return None
@@ -54,20 +54,17 @@ def getHtmlFromRstFile(rst):
s = p.sub(replace, s)
return s


def getHtmlFromHelpFile(alg, helpFile):
if not os.path.exists(helpFile):
return None
try:
with open(helpFile) as f:
descriptions = json.load(f)
return getHtmlFromDescriptionsDict(descriptions)
return getHtmlFromDescriptionsDict(alg, descriptions)
except:
return None


def getHtmlFromDescriptionsDict(alg, descriptions):

s = tr('<html><body><h2>Algorithm description</h2>\n')
s += '<p>' + getDescription(ALG_DESC, descriptions) + '</p>\n'
s += tr('<h2>Input parameters</h2>\n')
@@ -80,17 +77,16 @@ def getHtmlFromDescriptionsDict(alg, descriptions):
s += '<p>' + getDescription(out.name, descriptions) + '</p>\n'
s += '<br>'
s += tr('<p align="right">Algorithm author: %s</p>') % getDescription(ALG_CREATOR, descriptions)
s += tr('<p align="right">Help author: %s</p>') + getDescription(ALG_HELP_CREATOR, descriptions)
s += tr('<p align="right">Algorithm version: %s</p>') + getDescription(ALG_VERSION, descriptions)
s += tr('<p align="right">Help author: %s</p>') % getDescription(ALG_HELP_CREATOR, descriptions)
s += tr('<p align="right">Algorithm version: %s</p>') % getDescription(ALG_VERSION, descriptions)
s += '</body></html>'
return s


def getDescription(name, descriptions):
if name in descriptions:
return unicode(descriptions[name]).replace("\n", "<br>")
else:
return ''

def tr(string):
return QtCore.QCoreApplication.translate('Help2Html', string)
return QCoreApplication.translate('Help2Html', string)

0 comments on commit bb72302

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