From 02b24e8dfb4e7a2e65c363ba4e82708386e8e81a Mon Sep 17 00:00:00 2001 From: evanlee123 <31551958+evanlee123@users.noreply.github.com> Date: Wed, 6 Dec 2017 21:35:09 -0700 Subject: [PATCH 1/5] Update tabwidget.py --- qutebrowser/mainwindow/tabwidget.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 988455a08..01b9f0728 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -184,7 +184,7 @@ class TabWidget(QTabWidget): try: fields['protocol'] = self.tab_url(idx).scheme() except qtutils.QtValueError: - fields['protocol']= '' + fields['protocol'] = '' y = tab.scroller.pos_perc()[1] if y is None: From 4d13941290f28dfe5de2ec3be3238fba41fb263b Mon Sep 17 00:00:00 2001 From: evanlee123 <31551958+evanlee123@users.noreply.github.com> Date: Wed, 6 Dec 2017 23:57:19 -0700 Subject: [PATCH 2/5] added the scheme field to FakeURL --- tests/helpers/stubs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index 878c9e166..cb3c85896 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -131,11 +131,12 @@ class FakeUrl: """QUrl stub which provides .path(), isValid() and host().""" - def __init__(self, path=None, valid=True, host=None, url=None): + def __init__(self, path=None, valid=True, host=None, url=None, scheme = None): self.path = mock.Mock(return_value=path) self.isValid = mock.Mock(returl_value=valid) self.host = mock.Mock(returl_value=host) self.url = mock.Mock(return_value=url) + self.scheme = mock.Mock(return_value=scheme) class FakeNetworkReply: From 20ac618752a6e33f7cd8ed51e6e8da8213eee29b Mon Sep 17 00:00:00 2001 From: evanlee123 <31551958+evanlee123@users.noreply.github.com> Date: Thu, 7 Dec 2017 02:04:02 -0700 Subject: [PATCH 3/5] Simplified code in get_tab_fields changed self.tab_url(idx) to url in get_tab_fields() --- qutebrowser/mainwindow/tabwidget.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 01b9f0728..9dc6cd9bf 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -165,6 +165,8 @@ class TabWidget(QTabWidget): fields['perc_raw'] = tab.progress() fields['backend'] = objects.backend.name fields['private'] = ' [Private Mode] ' if tab.private else '' + + url = self.tab_url(idx) if tab.load_status() == usertypes.LoadStatus.loading: fields['perc'] = '[{}%] '.format(tab.progress()) @@ -172,17 +174,17 @@ class TabWidget(QTabWidget): fields['perc'] = '' try: - fields['host'] = self.tab_url(idx).host() + fields['host'] = url.host() except qtutils.QtValueError: fields['host'] = '' try: - fields['current_url'] = self.tab_url(idx).url() + fields['current_url'] = url.url() except qtutils.QtValueError: fields['current_url'] = '' try: - fields['protocol'] = self.tab_url(idx).scheme() + fields['protocol'] = url.scheme() except qtutils.QtValueError: fields['protocol'] = '' From d1a00eb93446e501e97871485738b903668a89a5 Mon Sep 17 00:00:00 2001 From: evanlee123 <31551958+evanlee123@users.noreply.github.com> Date: Thu, 7 Dec 2017 02:35:34 -0700 Subject: [PATCH 4/5] Clarity on protocol field --- qutebrowser/config/configdata.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index efcc07b35..7c94d4701 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1307,9 +1307,9 @@ tabs.title.format: * `{scroll_pos}`: Page scroll position. * `{host}`: Host of the current web page. * `{backend}`: Either ''webkit'' or ''webengine'' - * `{private}` : Indicates when private mode is enabled. - * `{current_url}` : URL of the current web page. - * `{protocol}` : Internet Protocol of the current web page. + * `{private}`: Indicates when private mode is enabled. + * `{current_url}`: URL of the current web page. + * `{protocol}`: Protocol (http/https/...) of the current web page tabs.title.format_pinned: default: '{index}' From 18609f1a2444cc533c4fabdf046f3da9ff6e3278 Mon Sep 17 00:00:00 2001 From: evanlee123 <31551958+evanlee123@users.noreply.github.com> Date: Thu, 7 Dec 2017 02:36:31 -0700 Subject: [PATCH 5/5] fixed spacing on FakeURL --- tests/helpers/stubs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index cb3c85896..d2c0fd746 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -131,7 +131,7 @@ class FakeUrl: """QUrl stub which provides .path(), isValid() and host().""" - def __init__(self, path=None, valid=True, host=None, url=None, scheme = None): + def __init__(self, path=None, valid=True, host=None, url=None, scheme=None): self.path = mock.Mock(return_value=path) self.isValid = mock.Mock(returl_value=valid) self.host = mock.Mock(returl_value=host)