diff options
-rwxr-xr-x | browser.py | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -51,6 +51,12 @@ class GBrowser(QtWidgets.QMainWindow): profile = QtWebEngineCore.QWebEngineProfile.defaultProfile() QtWidgets.QMainWindow.__init__(self) + # Main Viewport + self._browser = QtWebEngineWidgets.QWebEngineView() + page = GeminiPage(profile, self._browser) + self._browser.setPage(page) + self.setCentralWidget(self._browser) + # Navigation Toolbar back = QtWidgets.QPushButton("back") forward = QtWidgets.QPushButton("forward") @@ -62,24 +68,18 @@ class GBrowser(QtWidgets.QMainWindow): toolbar.addWidget(address) self.addToolBar(toolbar) - # Main Viewport - browser = QtWebEngineWidgets.QWebEngineView() - page = GeminiPage(profile, browser) - browser.setPage(page) - self.setCentralWidget(browser) - # Status Bar request_status = QtWidgets.QLabel() self.statusBar().addWidget(request_status) # Connect signals - back.clicked.connect(browser.back) - forward.clicked.connect(browser.forward) - browser.urlChanged.connect(address.setUrl) - address.returnPressed.connect(browser.load) - browser.page().linkHovered.connect(self.set_status_url) + back.clicked.connect(self._browser.back) + forward.clicked.connect(self._browser.forward) + self._browser.urlChanged.connect(address.setUrl) + address.returnPressed.connect(self._browser.load) + self._browser.page().linkHovered.connect(self.set_status_url) - browser.load(QtCore.QUrl(initial_url)) + self._browser.load(QtCore.QUrl(initial_url)) settings = QtCore.QSettings("xcolour.net", "GeminiBrowser") self.restoreGeometry(settings.value("geometry")) @@ -97,6 +97,7 @@ class GBrowser(QtWidgets.QMainWindow): settings = QtCore.QSettings("xcolour.net", "GeminiBrowser") settings.setValue("geometry", self.saveGeometry()) settings.setValue("windowState", self.saveState()) + self._browser.page().deleteLater() super().closeEvent(event) |