Skip to content

Commit bb72302

Browse files
committed
[processing] Fixes #11363 - help file is created but not shown in the Help tab
1 parent c768f13 commit bb72302

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

python/plugins/processing/gui/Help2Html.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
__revision__ = '$Format:%H$'
2828

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

45-
4646
def getHtmlFromRstFile(rst):
4747
if not os.path.exists(rst):
4848
return None
@@ -54,20 +54,17 @@ def getHtmlFromRstFile(rst):
5454
s = p.sub(replace, s)
5555
return s
5656

57-
5857
def getHtmlFromHelpFile(alg, helpFile):
5958
if not os.path.exists(helpFile):
6059
return None
6160
try:
6261
with open(helpFile) as f:
6362
descriptions = json.load(f)
64-
return getHtmlFromDescriptionsDict(descriptions)
63+
return getHtmlFromDescriptionsDict(alg, descriptions)
6564
except:
6665
return None
6766

68-
6967
def getHtmlFromDescriptionsDict(alg, descriptions):
70-
7168
s = tr('<html><body><h2>Algorithm description</h2>\n')
7269
s += '<p>' + getDescription(ALG_DESC, descriptions) + '</p>\n'
7370
s += tr('<h2>Input parameters</h2>\n')
@@ -80,17 +77,16 @@ def getHtmlFromDescriptionsDict(alg, descriptions):
8077
s += '<p>' + getDescription(out.name, descriptions) + '</p>\n'
8178
s += '<br>'
8279
s += tr('<p align="right">Algorithm author: %s</p>') % getDescription(ALG_CREATOR, descriptions)
83-
s += tr('<p align="right">Help author: %s</p>') + getDescription(ALG_HELP_CREATOR, descriptions)
84-
s += tr('<p align="right">Algorithm version: %s</p>') + getDescription(ALG_VERSION, descriptions)
80+
s += tr('<p align="right">Help author: %s</p>') % getDescription(ALG_HELP_CREATOR, descriptions)
81+
s += tr('<p align="right">Algorithm version: %s</p>') % getDescription(ALG_VERSION, descriptions)
8582
s += '</body></html>'
8683
return s
8784

88-
8985
def getDescription(name, descriptions):
9086
if name in descriptions:
9187
return unicode(descriptions[name]).replace("\n", "<br>")
9288
else:
9389
return ''
9490

9591
def tr(string):
96-
return QtCore.QCoreApplication.translate('Help2Html', string)
92+
return QCoreApplication.translate('Help2Html', string)

0 commit comments

Comments
 (0)