19 lines
629 B
Python
19 lines
629 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, type):
|
|
print(base.data["default_template_dir"]+type+".html"))
|
|
self.load(QUrl.fromLocalFile(base.data["default_template_dir"]+type+".html")) |