sightplace-rep/browser.py

25 lines
865 B
Python
Raw Permalink Normal View History

import base
from base import *
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):
self.load(QUrl.fromLocalFile(base.data["default_template_dir"]+page+".html"))
log.byCode("BLC1000S", base.data["default_template_dir"]+page+".html")
def loadAdminContent(self, page):
self.load(QUrl.fromLocalFile(base.data["admin_template"] + page + ".html"))
log.byCode("BLC1001S", base.data["admin_template"] + page + ".html")