Skip to content

Commit 03a444c

Browse files
committedSep 27, 2017
[processing] improve loading help from local files (refs #17191)
1 parent 59904fb commit 03a444c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed
 

‎python/plugins/processing/gui/AlgorithmDialogBase.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,22 @@ def linkClicked(url):
8989

9090
isText, algHelp = self.alg.help()
9191
if algHelp is not None:
92-
algHelp = algHelp if isText else QUrl(algHelp)
9392
try:
9493
if isText:
9594
self.txtHelp.setHtml(algHelp)
9695
else:
97-
html = self.tr('<p>Downloading algorithm help... Please wait.</p>')
98-
self.txtHelp.setHtml(html)
99-
rq = QNetworkRequest(algHelp)
100-
self.reply = QgsNetworkAccessManager.instance().get(rq)
101-
self.reply.finished.connect(self.requestFinished)
102-
except Exception, e:
96+
if algHelp.startswith('http'):
97+
html = self.tr('<p>Downloading algorithm help... Please wait.</p>')
98+
self.txtHelp.setHtml(html)
99+
rq = QNetworkRequest(QUrl(algHelp))
100+
self.reply = QgsNetworkAccessManager.instance().get(rq)
101+
self.reply.finished.connect(self.requestFinished)
102+
else:
103+
if algHelp.startswith('file://'):
104+
p = os.path.dirname(algHelp[7:])
105+
self.txtHelp.setSearchPaths([p])
106+
self.txtHelp.setSource(QUrl(algHelp))
107+
except Exception as e:
103108
self.tabWidget.removeTab(2)
104109
else:
105110
self.tabWidget.removeTab(2)

0 commit comments

Comments
 (0)
Please sign in to comment.