use QUrl.fromLocalFile

This commit is contained in:
nicogodet 2022-02-28 11:30:12 +01:00 committed by GitHub
parent 401bd915d7
commit a0397805f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,7 @@ QGIS utilities module
"""
from typing import List, Dict, Optional
from qgis.PyQt.QtCore import QCoreApplication, QDir, QLocale, QThread, qDebug, QUrl
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
@ -618,10 +618,10 @@ def showPluginHelp(packageName: str = None, filename: str = "index", section: st
if not os.path.exists(helpfile):
helpfile = os.path.join(path, filename + ".html")
if os.path.exists(helpfile):
url = "file://" + QDir.fromNativeSeparators(helpfile)
url = "file://" + helpfile
if section != "":
url = url + "#" + section
QDesktopServices.openUrl(QUrl(url, QUrl.TolerantMode))
QDesktopServices.openUrl(QUrl.fromLocalFile(url))
def pluginDirectory(packageName: str) -> str: