From 4a096cb728c0880b447c6af2c1ac8f10f81a7ca4 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 15 May 2021 01:21:25 -0700 Subject: [PATCH] Use load instead of setHtml so paths resolve. Without this we can't resolve local paths to files. --- qt_ui/widgets/map/QLiberationMap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qt_ui/widgets/map/QLiberationMap.py b/qt_ui/widgets/map/QLiberationMap.py index b7f2020c..315920a1 100644 --- a/qt_ui/widgets/map/QLiberationMap.py +++ b/qt_ui/widgets/map/QLiberationMap.py @@ -15,7 +15,7 @@ from typing import ( ) from PySide2 import QtCore, QtWidgets -from PySide2.QtCore import QLineF, QPointF, QRectF, Qt +from PySide2.QtCore import QLineF, QPointF, QRectF, Qt, QUrl from PySide2.QtGui import ( QBrush, QColor, @@ -162,7 +162,9 @@ class LeafletMap(QWebEngineView, LiberationMap): self.page = LoggingWebPage(self) self.page.setWebChannel(self.channel) - self.page.setHtml(Path("resources/ui/map/canvas.html").read_text()) + self.page.load( + QUrl.fromLocalFile(str(Path("resources/ui/map/canvas.html").resolve())) + ) self.setPage(self.page) self.loadFinished.connect(self.load_finished)