Add new _tabopen method for tabopen and backtabopen.
This commit is contained in:
parent
836a5e04a5
commit
de5f85982f
@ -136,6 +136,27 @@ class TabbedBrowser(TabWidget):
|
|||||||
tab.titleChanged.connect(self.on_title_changed)
|
tab.titleChanged.connect(self.on_title_changed)
|
||||||
tab.open_tab.connect(self.tabopen)
|
tab.open_tab.connect(self.tabopen)
|
||||||
|
|
||||||
|
def _tabopen(self, url, background=False):
|
||||||
|
"""Open a new tab with a given url.
|
||||||
|
|
||||||
|
Inner logic for tabopen and backtabopen.
|
||||||
|
Also connect all the signals we need to _filter_signals.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
url: The URL to open.
|
||||||
|
background: Whether to oepn the tab in the background.
|
||||||
|
"""
|
||||||
|
logging.debug("Opening {}".format(url))
|
||||||
|
url = urlutils.qurl(url)
|
||||||
|
tab = WebView(self)
|
||||||
|
self._connect_tab_signals(tab)
|
||||||
|
self._tabs.append(tab)
|
||||||
|
self.addTab(tab, urlutils.urlstring(url))
|
||||||
|
tab.show()
|
||||||
|
tab.openurl(url)
|
||||||
|
if not background:
|
||||||
|
self.setCurrentWidget(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.
|
||||||
|
|
||||||
@ -202,30 +223,14 @@ class TabbedBrowser(TabWidget):
|
|||||||
tab.openurl('about:blank')
|
tab.openurl('about:blank')
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', maxsplit=0)
|
@cmdutils.register(instance='mainwindow.tabs', maxsplit=0)
|
||||||
def tabopen(self, url, background=False):
|
def tabopen(self, url):
|
||||||
"""Open a new tab with a given url.
|
"""Open a new tab with a given url."""
|
||||||
|
self._tabopen(url, background=False)
|
||||||
Also connect all the signals we need to _filter_signals.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
url: The URL to open.
|
|
||||||
background: Whether to oepn the tab in the background.
|
|
||||||
"""
|
|
||||||
logging.debug("Opening {}".format(url))
|
|
||||||
url = urlutils.qurl(url)
|
|
||||||
tab = WebView(self)
|
|
||||||
self._connect_tab_signals(tab)
|
|
||||||
self._tabs.append(tab)
|
|
||||||
self.addTab(tab, urlutils.urlstring(url))
|
|
||||||
tab.show()
|
|
||||||
tab.openurl(url)
|
|
||||||
if not background:
|
|
||||||
self.setCurrentWidget(tab)
|
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', maxsplit=0)
|
@cmdutils.register(instance='mainwindow.tabs', maxsplit=0)
|
||||||
def backtabopen(self, url):
|
def backtabopen(self, url):
|
||||||
"""Open a new tab in background."""
|
"""Open a new tab in background."""
|
||||||
self.tabopen(url, background=True)
|
self._tabopen(url, background=True)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs', hide=True)
|
||||||
def tabopencur(self):
|
def tabopencur(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user