From 688b22eaac2518830f1d51b22ae1915ba2e20b94 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 17 Jan 2014 13:08:44 +0100 Subject: [PATCH] Move progress handling to TabbedBrowser --- qutebrowser/widgets/browser.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/qutebrowser/widgets/browser.py b/qutebrowser/widgets/browser.py index 1a413bdb3..27e2bc313 100644 --- a/qutebrowser/widgets/browser.py +++ b/qutebrowser/widgets/browser.py @@ -17,6 +17,7 @@ class TabbedBrowser(TabWidget): self.tabs.append(tab) self.addTab(tab, url) self.setCurrentWidget(tab) + tab.loadProgress.connect(self.progress_changed) @pyqtSlot(str) def openurl(self, url): @@ -51,21 +52,19 @@ class TabbedBrowser(TabWidget): # FIXME pass + @pyqtSlot(int) + def progress_changed(self, prog): + if self.currentWidget() == self.sender(): + self.cur_progress.emit(prog) class BrowserTab(QWebView): parent = None def __init__(self, parent): super().__init__(parent) - self.parent = parent - self.loadProgress.connect(self.progress_changed) self.show() def openurl(self, url): if not url.startswith('http://'): url = 'http://' + url super().load(QUrl(url)) - - def progress_changed(self, prog): - if self.parent.currentWidget() == self: - self.parent.cur_progress.emit(prog)