Skip to content
Permalink
Browse files

Use QDesktopServices instead of deprecated iface.openUrl

  • Loading branch information
Guts authored and nyalldawson committed Jan 11, 2021
1 parent d82ff4b commit 05d836b4ceb1cef5640ad98061dec1aaecafa7d6
Showing with 10 additions and 4 deletions.
  1. +10 −4 python/utils.py
@@ -26,7 +26,8 @@
"""

from qgis.PyQt.QtCore import QCoreApplication, QLocale, QThread, qDebug
from qgis.PyQt.QtCore import QCoreApplication, QLocale, QThread, qDebug, QUrl
from qgis.PyQt.QtGui import QDesktopServices
from qgis.PyQt.QtWidgets import QPushButton, QApplication
from qgis.core import Qgis, QgsMessageLog, qgsfunction, QgsMessageOutput
from qgis.gui import QgsMessageBar
@@ -499,8 +500,13 @@ def reloadPlugin(packageName):
startPlugin(packageName)


def showPluginHelp(packageName=None, filename="index", section=""):
""" show a help in the user's html browser. The help file should be named index-ll_CC.html or index-ll.html"""
def showPluginHelp(packageName: str = None, filename: str = "index", section: str = ""):
"""Open help in the user's html browser. The help file should be named index-ll_CC.html or index-ll.html or index.html.
:param str packageName: name of package folder, if None it's using the current file package. Defaults to None. Optional.
:param str filename: name of file to open. It can be a path like 'doc/index' for example. Defaults to 'index'.
:param str section: URL path to open. Defaults to empty string.
"""
try:
source = ""
if packageName is None:
@@ -526,7 +532,7 @@ def showPluginHelp(packageName=None, filename="index", section=""):
url = "file://" + helpfile
if section != "":
url = url + "#" + section
iface.openURL(url, False)
QDesktopServices.openUrl .openUrl(url, False)


def pluginDirectory(packageName):

0 comments on commit 05d836b

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