Skip to content

Commit

Permalink
Added code to support multiple browser windows. Fixes issue pythonguis#7
Browse files Browse the repository at this point in the history
  • Loading branch information
alandmoore committed Oct 9, 2019
1 parent dfc4bbf commit 0f4ab03
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions browser/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 0f4ab03

Please sign in to comment.