From 2630f779cdbeadaf0438718dd27bcd975deccd7f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 28 Sep 2018 19:48:24 +0200 Subject: [PATCH] Make tab attributes more consistent --- qutebrowser/browser/browsertab.py | 3 ++- qutebrowser/browser/webengine/webenginetab.py | 7 +++---- qutebrowser/browser/webkit/webkittab.py | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index dac8eb9a3..eb67cf091 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -258,8 +258,9 @@ class AbstractSearch(QObject): finished = pyqtSignal(bool) cleared = pyqtSignal() - def __init__(self, parent=None): + def __init__(self, tab, parent=None): super().__init__(parent) + self._tab = tab self._widget = None self.text = None self.search_displayed = False diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index f5933e579..3b72719e7 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -163,10 +163,9 @@ class WebEngineSearch(browsertab.AbstractSearch): """ def __init__(self, tab, parent=None): - super().__init__(parent) + super().__init__(tab, parent) self._flags = QWebEnginePage.FindFlags(0) self._pending_searches = 0 - self._tab = tab def _find(self, text, flags, callback, caller): """Call findText on the widget.""" @@ -1026,8 +1025,8 @@ class WebEngineTab(browsertab.AbstractTab): private=private, parent=parent) widget = webview.WebEngineView(tabdata=self.data, win_id=win_id, private=private) - self.history = WebEngineHistory(self) - self.scroller = WebEngineScroller(self, parent=self) + self.history = WebEngineHistory(tab=self) + self.scroller = WebEngineScroller(tab=self, parent=self) self.caret = WebEngineCaret(mode_manager=mode_manager, tab=self, parent=self) self.zoom = WebEngineZoom(tab=self, parent=self) diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 1d7c842b4..2edea1777 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -84,8 +84,8 @@ class WebKitSearch(browsertab.AbstractSearch): """QtWebKit implementations related to searching on the page.""" - def __init__(self, parent=None): - super().__init__(parent) + def __init__(self, tab, parent=None): + super().__init__(tab, parent) self._flags = QWebPage.FindFlags(0) def _call_cb(self, callback, found, text, flags, caller): @@ -662,12 +662,12 @@ class WebKitTab(browsertab.AbstractTab): private=private, tab=self) if private: self._make_private(widget) - self.history = WebKitHistory(self) - self.scroller = WebKitScroller(self, parent=self) + self.history = WebKitHistory(tab=self) + self.scroller = WebKitScroller(tab=self, parent=self) self.caret = WebKitCaret(mode_manager=mode_manager, tab=self, parent=self) self.zoom = WebKitZoom(tab=self, parent=self) - self.search = WebKitSearch(parent=self) + self.search = WebKitSearch(tab=self, parent=self) self.printing = WebKitPrinting(tab=self) self.elements = WebKitElements(tab=self) self.action = WebKitAction(tab=self)