Update cur_progress on tab switch
This commit is contained in:
parent
688b22eaac
commit
294c5fa138
@ -8,6 +8,7 @@ class TabbedBrowser(TabWidget):
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
self.currentChanged.connect(self.index_changed)
|
||||
self.tabopen("http://ddg.gg/")
|
||||
|
||||
@pyqtSlot(str)
|
||||
@ -57,14 +58,25 @@ class TabbedBrowser(TabWidget):
|
||||
if self.currentWidget() == self.sender():
|
||||
self.cur_progress.emit(prog)
|
||||
|
||||
@pyqtSlot(int)
|
||||
def index_changed(self, idx):
|
||||
print("changed index")
|
||||
tab = self.widget(idx)
|
||||
self.cur_progress.emit(tab.progress)
|
||||
|
||||
class BrowserTab(QWebView):
|
||||
parent = None
|
||||
progress = 0
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
self.loadProgress.connect(self.set_progress)
|
||||
self.show()
|
||||
|
||||
def openurl(self, url):
|
||||
if not url.startswith('http://'):
|
||||
url = 'http://' + url
|
||||
super().load(QUrl(url))
|
||||
|
||||
def set_progress(self, prog):
|
||||
self.progress = prog
|
||||
|
@ -23,8 +23,6 @@ class MainWindow(QMainWindow):
|
||||
self.status = StatusBar(self.cwidget)
|
||||
self.vbox.addWidget(self.status)
|
||||
|
||||
|
||||
# FIXME: cur_progress also should be set on tab switch
|
||||
self.tabs.cur_progress.connect(self.status.lbl.set_progress)
|
||||
|
||||
#self.retranslateUi(MainWindow)
|
||||
|
Loading…
Reference in New Issue
Block a user