sightplace-rep/browser.py

19 lines
628 B
Python

import base
from PyQt6.QtWebChannel import QWebChannel
from PyQt6.QtWebEngineWidgets import QWebEngineView
from PyQt6.QtCore import QUrl
class Browser(QWebEngineView):
def __init__(self):
super().__init__()
self.channel = QWebChannel()
def addObject(self, id, call_handler):
self.handler = call_handler
self.channel.registerObject(id, self.handler)
self.page().setWebChannel(self.channel)
def loadContent(self, page):
print(base.data["default_template_dir"]+page+".html")
self.load(QUrl.fromLocalFile(base.data["default_template_dir"]+page+".html"))