From 0f4ab03cf32f11dad0bb7b22b57d27dd69a9a176 Mon Sep 17 00:00:00 2001 From: Alan D Moore Date: Wed, 9 Oct 2019 10:33:39 -0500 Subject: [PATCH] Added code to support multiple browser windows. Fixes issue #7 --- browser/browser.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/browser/browser.py b/browser/browser.py index 797425b..2c07016 100644 --- a/browser/browser.py +++ b/browser/browser.py @@ -50,6 +50,7 @@ def __init__(self, *args, **kwargs): self.browser.urlChanged.connect(self.update_urlbar) self.browser.loadFinished.connect(self.update_title) + self.browser.createWindow = self.new_window self.setCentralWidget(self.browser) self.status = QStatusBar() @@ -191,6 +192,15 @@ def update_urlbar(self, q): self.urlbar.setText(q.toString()) self.urlbar.setCursorPosition(0) + def new_window(self, page_type): + + profile = self.browser.page().profile() + new_page = QWebEnginePage(profile) + new_window = MainWindow() + new_window.browser.setPage(new_page) + new_window.show() + + return new_window.browser app = QApplication(sys.argv) app.setApplicationName("MooseAche")