Don't register webview in objreg

All places now should use the tab API instead.
This commit is contained in:
Florian Bruhin 2016-07-08 17:18:26 +02:00
parent 67eea1678e
commit 11cd5f8653
5 changed files with 14 additions and 13 deletions

View File

@ -1744,10 +1744,12 @@ class CommandDispatcher:
raise cmdexc.CommandError("No focused window!")
else:
try:
receiver = objreg.get('webview', scope='tab',
tab='current')
tab = objreg.get('tab', scope='tab', tab='current')
except objreg.RegistryUnavailableError:
raise cmdexc.CommandError("No focused webview!")
# pylint: disable=protected-access
receiver = tab._widget
# pylint: enable=protected-access
QApplication.postEvent(receiver, press_event)
QApplication.postEvent(receiver, release_event)

View File

@ -757,9 +757,9 @@ class HintManager(QObject):
window=self._win_id)
tabbed_browser.tabopen(url, background=background)
else:
webview = objreg.get('webview', scope='tab', window=self._win_id,
tab=self._tab_id)
webview.openurl(url)
tab = objreg.get('tab', scope='tab', window=self._win_id,
tab=self._tab_id)
tab.openurl(url)
@cmdutils.register(instance='hintmanager', scope='tab', name='hint',
star_args_optional=True, maxsplit=2)

View File

@ -458,6 +458,7 @@ class AbstractTab(QWidget):
tab_registry = objreg.get('tab-registry', scope='window',
window=win_id)
tab_registry[self.tab_id] = self
objreg.register('tab', self, registry=self.registry)
# self.history = AbstractHistory(self)
# self.scroll = AbstractScroller(parent=self)

View File

@ -228,9 +228,9 @@ class NetworkManager(QNetworkAccessManager):
# This might be a generic network manager, e.g. one belonging to a
# DownloadManager. In this case, just skip the webview thing.
if self._tab_id is not None:
webview = objreg.get('webview', scope='tab', window=self._win_id,
tab=self._tab_id)
webview.loadStarted.connect(q.abort)
tab = objreg.get('tab', scope='tab', window=self._win_id,
tab=self._tab_id)
tab.load_started.connect(q.abort)
bridge = objreg.get('message-bridge', scope='window',
window=self._win_id)
bridge.ask(q, blocking=True)
@ -479,9 +479,9 @@ class NetworkManager(QNetworkAccessManager):
if self._tab_id is not None:
try:
webview = objreg.get('webview', scope='tab',
window=self._win_id, tab=self._tab_id)
current_url = webview.url()
tab = objreg.get('tab', scope='tab', window=self._win_id,
tab=self._tab_id)
current_url = tab.url()
except (KeyError, RuntimeError, TypeError):
# https://github.com/The-Compiler/qutebrowser/issues/889
# Catching RuntimeError and TypeError because we could be in

View File

@ -94,8 +94,6 @@ class WebView(QWebView):
self.progress = 0
self._tab_id = tab_id
objreg.register('webview', self, scope='tab', window=win_id,
tab=tab_id)
page = self._init_page()
hintmanager = hints.HintManager(win_id, self._tab_id, self)
hintmanager.mouse_event.connect(self.on_mouse_event)