Skip to content

Commit

Permalink
[processing] improve loading help from local files (refs #17191)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Sep 27, 2017
1 parent 59904fb commit 03a444c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions python/plugins/processing/gui/AlgorithmDialogBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,22 @@ def linkClicked(url):

isText, algHelp = self.alg.help()
if algHelp is not None:
algHelp = algHelp if isText else QUrl(algHelp)
try:
if isText:
self.txtHelp.setHtml(algHelp)
else:
html = self.tr('<p>Downloading algorithm help... Please wait.</p>')
self.txtHelp.setHtml(html)
rq = QNetworkRequest(algHelp)
self.reply = QgsNetworkAccessManager.instance().get(rq)
self.reply.finished.connect(self.requestFinished)
except Exception, e:
if algHelp.startswith('http'):
html = self.tr('<p>Downloading algorithm help... Please wait.</p>')
self.txtHelp.setHtml(html)
rq = QNetworkRequest(QUrl(algHelp))
self.reply = QgsNetworkAccessManager.instance().get(rq)
self.reply.finished.connect(self.requestFinished)
else:
if algHelp.startswith('file://'):
p = os.path.dirname(algHelp[7:])
self.txtHelp.setSearchPaths([p])
self.txtHelp.setSource(QUrl(algHelp))
except Exception as e:
self.tabWidget.removeTab(2)
else:
self.tabWidget.removeTab(2)
Expand Down

0 comments on commit 03a444c

Please sign in to comment.