Support closing windows via javascript.
This commit is contained in:
parent
7315712359
commit
43c0578ede
@ -155,6 +155,8 @@ class TabbedBrowser(TabWidget):
|
|||||||
tab.iconChanged.connect(self.on_icon_changed)
|
tab.iconChanged.connect(self.on_icon_changed)
|
||||||
tab.page().mainFrame().loadStarted.connect(partial(
|
tab.page().mainFrame().loadStarted.connect(partial(
|
||||||
self.on_load_started, tab))
|
self.on_load_started, tab))
|
||||||
|
tab.page().windowCloseRequested.connect(partial(
|
||||||
|
self.on_window_close_requested, tab))
|
||||||
|
|
||||||
def cntwidget(self, count=None):
|
def cntwidget(self, count=None):
|
||||||
"""Return a widget based on a count/idx.
|
"""Return a widget based on a count/idx.
|
||||||
@ -241,6 +243,11 @@ class TabbedBrowser(TabWidget):
|
|||||||
"""Close a tab via an index."""
|
"""Close a tab via an index."""
|
||||||
self.close_tab(idx)
|
self.close_tab(idx)
|
||||||
|
|
||||||
|
@pyqtSlot(WebView)
|
||||||
|
def on_window_close_requested(self, widget):
|
||||||
|
"""Close a tab with a widget given."""
|
||||||
|
self.close_tab(widget)
|
||||||
|
|
||||||
@pyqtSlot(str, bool)
|
@pyqtSlot(str, bool)
|
||||||
def tabopen(self, url=None, background=None):
|
def tabopen(self, url=None, background=None):
|
||||||
"""Open a new tab with a given URL.
|
"""Open a new tab with a given URL.
|
||||||
|
Loading…
Reference in New Issue
Block a user