Rename widget to tab in some places

This also fixes the cur_url access.
This commit is contained in:
Florian Bruhin 2016-07-08 10:08:44 +02:00
parent b8086d1d13
commit 09f4c2199e

View File

@ -107,17 +107,17 @@ class TabWidget(QTabWidget):
def get_tab_fields(self, idx): def get_tab_fields(self, idx):
"""Get the tab field data.""" """Get the tab field data."""
widget = self.widget(idx) tab = self.widget(idx)
page_title = self.page_title(idx) page_title = self.page_title(idx)
fields = {} fields = {}
fields['id'] = widget.tab_id fields['id'] = tab.tab_id
fields['title'] = page_title fields['title'] = page_title
fields['title_sep'] = ' - ' if page_title else '' fields['title_sep'] = ' - ' if page_title else ''
fields['perc_raw'] = widget.progress fields['perc_raw'] = tab.progress()
if widget.load_status == usertypes.LoadStatus.loading: if tab.load_status() == usertypes.LoadStatus.loading:
fields['perc'] = '[{}%] '.format(widget.progress) fields['perc'] = '[{}%] '.format(tab.progress())
else: else:
fields['perc'] = '' fields['perc'] = ''
@ -126,7 +126,7 @@ class TabWidget(QTabWidget):
except qtutils.QtValueError: except qtutils.QtValueError:
fields['host'] = '' fields['host'] = ''
y = widget.scroll.pos_perc()[1] y = tab.scroll.pos_perc()[1]
if y is None: if y is None:
scroll_pos = '???' scroll_pos = '???'
elif y <= 0: elif y <= 0:
@ -225,11 +225,11 @@ class TabWidget(QTabWidget):
Return: Return:
The tab URL as QUrl. The tab URL as QUrl.
""" """
widget = self.widget(idx) tab = self.widget(idx)
if widget is None: if tab is None:
url = QUrl() url = QUrl()
else: else:
url = widget.cur_url url = tab.url()
# It's possible for url to be invalid, but the caller will handle that. # It's possible for url to be invalid, but the caller will handle that.
qtutils.ensure_valid(url) qtutils.ensure_valid(url)
return url return url