From 67eea1678e5c9bf64416c5bca3112a0dfa716bc2 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 8 Jul 2016 17:13:18 +0200 Subject: [PATCH] Move tab registry from webview to tab --- qutebrowser/browser/tab.py | 7 +++++++ qutebrowser/browser/webkit/webview.py | 13 +++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/qutebrowser/browser/tab.py b/qutebrowser/browser/tab.py index 868014ba0..126006365 100644 --- a/qutebrowser/browser/tab.py +++ b/qutebrowser/browser/tab.py @@ -425,6 +425,7 @@ class AbstractTab(QWidget): Attributes: history: The AbstractHistory for the current tab. + registry: The ObjectRegistry associated with this tab. for properties, see WebView/WebEngineView docs. @@ -452,6 +453,12 @@ class AbstractTab(QWidget): self.win_id = win_id self.tab_id = next(tab_id_gen) super().__init__(parent) + + self.registry = objreg.ObjectRegistry() + tab_registry = objreg.get('tab-registry', scope='window', + window=win_id) + tab_registry[self.tab_id] = self + # self.history = AbstractHistory(self) # self.scroll = AbstractScroller(parent=self) # self.caret = AbstractCaret(win_id=win_id, tab=self, mode_manager=..., diff --git a/qutebrowser/browser/webkit/webview.py b/qutebrowser/browser/webkit/webview.py index 29d16488f..5a01cc187 100644 --- a/qutebrowser/browser/webkit/webview.py +++ b/qutebrowser/browser/webkit/webview.py @@ -45,7 +45,6 @@ class WebView(QWebView): scroll_pos: The current scroll position as (x%, y%) tuple. statusbar_message: The current javascript statusbar message. load_status: loading status of this page (index into LoadStatus) - registry: The ObjectRegistry associated with this tab. win_id: The window ID of the view. _tab_id: The tab ID of the view. _has_ssl_errors: Whether SSL errors occurred during loading. @@ -93,19 +92,17 @@ class WebView(QWebView): self._set_bg_color() self.cur_url = QUrl() self.progress = 0 - self.registry = objreg.ObjectRegistry() self._tab_id = tab_id - # FIXME:qtwebengine stop registering it here - tab_registry = objreg.get('tab-registry', scope='window', - window=win_id) - tab_registry[self._tab_id] = self - objreg.register('webview', self, registry=self.registry) + + 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) hintmanager.start_hinting.connect(page.on_start_hinting) hintmanager.stop_hinting.connect(page.on_stop_hinting) - objreg.register('hintmanager', hintmanager, registry=self.registry) + objreg.register('hintmanager', hintmanager, scope='tab', window=win_id, + tab=tab_id) mode_manager = objreg.get('mode-manager', scope='window', window=win_id) mode_manager.entered.connect(self.on_mode_entered)