From 0c9d7723c852d4fe01ca668f2c4aacbaa64ff831 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 12 Sep 2014 20:15:20 +0200 Subject: [PATCH 01/10] Fix on_config_changed for tabbar (renamed to tabs) --- qutebrowser/widgets/tabbedbrowser.py | 2 +- qutebrowser/widgets/tabwidget.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/widgets/tabbedbrowser.py b/qutebrowser/widgets/tabbedbrowser.py index 43bc9ebd8..cd9432d94 100644 --- a/qutebrowser/widgets/tabbedbrowser.py +++ b/qutebrowser/widgets/tabbedbrowser.py @@ -411,7 +411,7 @@ class TabbedBrowser(tabwidget.TabWidget): super().on_config_changed(section, option) for tab in self._tabs: tab.on_config_changed(section, option) - if (section, option) == ('tabbar', 'show-favicons'): + if (section, option) == ('tabs', 'show-favicons'): show = config.get('tabs', 'show-favicons') for i, tab in enumerate(self.widgets()): if show: diff --git a/qutebrowser/widgets/tabwidget.py b/qutebrowser/widgets/tabwidget.py index b3fdc733b..9301d9fbe 100644 --- a/qutebrowser/widgets/tabwidget.py +++ b/qutebrowser/widgets/tabwidget.py @@ -83,7 +83,7 @@ class TabWidget(QTabWidget): def on_config_changed(self, section, option): """Update attributes when config changed.""" self.tabBar().on_config_changed(section, option) - if section == 'tabbar': + if section == 'tabs': self._init_config() From e29264fe5bb0b3b245157c1145651b0268866b7c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 12 Sep 2014 20:40:58 +0200 Subject: [PATCH 02/10] Update TODO/BUGS --- doc/BUGS | 2 ++ doc/TODO | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/doc/BUGS b/doc/BUGS index b7075d2c1..66693ef72 100644 --- a/doc/BUGS +++ b/doc/BUGS @@ -35,6 +35,8 @@ Webview Input ----- +- going to passthrough mode (Ctrl-V) then clicking element to go to insert + mode, then leaving insert mode clears statusbar text. - seir sometimes sees "-- COMMAND MODE --" even though that should never happen. - Shift-Insert in commandline pastes clipboard instead of primary selection diff --git a/doc/TODO b/doc/TODO index 30e3c569b..a0a25b355 100644 --- a/doc/TODO +++ b/doc/TODO @@ -54,6 +54,13 @@ Downloads Improvements / minor features ============================= +- Command/page to show all keybindings? +- File moves: + - state should be in data, not config + - data/cache should be in subdirs on Windows if everything is in the same + dir. +- view_source using pygments +- check what exceptions open() calls could possibly throw - Improve -m error message when we're inside the qutebrowser dir (maybe use a Tk gui?) - Sane default for editor (maybe via QDesktopServices or so?) From 5ee5b2f41e2afe5134aa426e1b3c76f9d794f18e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 12 Sep 2014 20:43:28 +0200 Subject: [PATCH 03/10] Describe session saving in TODO --- doc/TODO | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/TODO b/doc/TODO index a0a25b355..640ea33b6 100644 --- a/doc/TODO +++ b/doc/TODO @@ -32,6 +32,8 @@ New big features Certificate Patrol https://chrome.google.com/webstore/detail/remove-google-redirects/ccenmflbeofaceccfhhggbagkblihpoh - session handling / saving + -> commandline parameter for session name, then tab list and history gets + saved under that name and can be re-loaded. - multi window (see notes) - IPC, like dwb -x (see notes) - Bookmarks From 74b45aea47a0a5dae2548ee17305dec0e710d32b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 13 Sep 2014 00:42:16 +0200 Subject: [PATCH 04/10] conftypes: Better handling of ShellCommand. --- qutebrowser/config/configtypes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index fada5ae1b..82b94ee3c 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -909,7 +909,7 @@ class WebKitBytesList(List): "set!".format(self.length)) -class ShellCommand(String): +class ShellCommand(BaseType): """A shellcommand which is split via shlex. @@ -920,7 +920,7 @@ class ShellCommand(String): typestr = 'shell-command' def __init__(self, placeholder=False, none_ok=False): - super().__init__(none_ok=none_ok) + super().__init__(none_ok) self.placeholder = placeholder def validate(self, value): @@ -929,9 +929,12 @@ class ShellCommand(String): return else: raise ValidationError(value, "may not be empty!") - super().validate(value) if self.placeholder and '{}' not in self.transform(value): raise ValidationError(value, "needs to contain a {}-placeholder.") + try: + shlex.split(value) + except ValueError as e: + raise ValidationError(value, str(e)) def transform(self, value): if not value: From 339189603723b0eab57c23b10713961ec98e18c3 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 14 Sep 2014 21:12:03 +0200 Subject: [PATCH 05/10] Disable workaround for PyQt 5.3.2 --- qutebrowser/browser/webpage.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py index ccd45b790..795e7a1d0 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webpage.py @@ -242,21 +242,21 @@ class BrowserPage(QWebPage): return super().extension(ext, opt, out) return handler(opt, out) except: # pylint: disable=bare-except - # WORKAROUND: - # - # Due to a bug in PyQt, exceptions inside extension() get - # swallowed: - # http://www.riverbankcomputing.com/pipermail/pyqt/2014-August/034722.html - # - # We used to re-raise the exception with a single-shot QTimer here, - # but that lead to a strange proble with a KeyError with some - # random jinja template stuff as content. For now, we only log it, - # so it doesn't pass 100% silently. - # - # FIXME: This should be fixed with PyQt 5.3.2 - re-check when it's - # out and raise the exception normally if possible. - log.webview.exception("Error inside WebPage::extension") - return False + if PYQT_VERSION >= 0x50302: + raise + else: + # WORKAROUND: + # + # Due to a bug in PyQt, exceptions inside extension() get + # swallowed: + # http://www.riverbankcomputing.com/pipermail/pyqt/2014-August/034722.html + # + # We used to re-raise the exception with a single-shot QTimer + # here, but that lead to a strange proble with a KeyError with + # some random jinja template stuff as content. For now, we only + # log it, so it doesn't pass 100% silently. + log.webview.exception("Error inside WebPage::extension") + return False def javaScriptAlert(self, _frame, msg): """Override javaScriptAlert to use the statusbar.""" From 35978171116df91ba2d9ae1021bd5bd076b83380 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 14 Sep 2014 21:23:40 +0200 Subject: [PATCH 06/10] Adjust version numbers in README --- README.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 90e7e6e34..5108e1eff 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -68,9 +68,9 @@ Requirements The following software and libraries are required to run qutebrowser: * http://www.python.org/[Python] 3.4 -* http://qt-project.org/[Qt] 5.2 or newer (5.3.1 recommended) +* http://qt-project.org/[Qt] 5.2.0 or newer (5.3.2 recommended) * QtWebKit -* http://www.riverbankcomputing.com/software/pyqt/intro[PyQt] 5.2 or newer +* http://www.riverbankcomputing.com/software/pyqt/intro[PyQt] 5.2.0 or newer (5.3.1 recommended) for Python 3 * https://pypi.python.org/pypi/setuptools/[pkg_resources/setuptools] * http://fdik.org/pyPEG/[pyPEG2] From 00193df99e134cfd33846f57eb41674b16132629 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 15 Sep 2014 06:52:34 +0200 Subject: [PATCH 07/10] hints: Fix URL resolving crash with new WebElement API. --- qutebrowser/browser/hints.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 97b133ff7..b4473f686 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -388,8 +388,9 @@ class HintManager(QObject): Return: A QUrl with the absolute URL, or None. """ - text = elem['href'] - if not text: + try: + text = elem['href'] + except KeyError: return None if baseurl is None: baseurl = self._context.baseurl From ad2435fa0be60cb524d63a5243763378d19830eb Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 15 Sep 2014 06:53:05 +0200 Subject: [PATCH 08/10] hints: Small cleanup --- qutebrowser/browser/hints.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index b4473f686..320cda79d 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -392,10 +392,10 @@ class HintManager(QObject): text = elem['href'] except KeyError: return None - if baseurl is None: - baseurl = self._context.baseurl url = QUrl(text) if url.isRelative(): + if baseurl is None: + baseurl = self._context.baseurl url = baseurl.resolved(url) qtutils.ensure_valid(url) return url From 81aa08593bbb98f3341609451fd29af61a215baa Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 15 Sep 2014 06:54:05 +0200 Subject: [PATCH 09/10] hints: Ignore invalid href's instead of crashing. --- qutebrowser/browser/hints.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 320cda79d..3e050f3c9 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -393,11 +393,12 @@ class HintManager(QObject): except KeyError: return None url = QUrl(text) + if not url.isValid(): + return None if url.isRelative(): if baseurl is None: baseurl = self._context.baseurl url = baseurl.resolved(url) - qtutils.ensure_valid(url) return url def _find_prevnext(self, frame, prev=False): @@ -467,7 +468,7 @@ class HintManager(QObject): raise cmdexc.CommandError("No {} links found!".format( "prev" if prev else "forward")) url = self._resolve_url(elem, baseurl) - if url is None or not url.isValid(): + if url is None: raise cmdexc.CommandError("No {} links found!".format( "prev" if prev else "forward")) self.openurl.emit(url, newtab) From 197af8c2841aa81ec6d905523269819e0ca4cf93 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 15 Sep 2014 06:54:37 +0200 Subject: [PATCH 10/10] Update TODO --- doc/BUGS | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/BUGS b/doc/BUGS index 66693ef72..53dcf7756 100644 --- a/doc/BUGS +++ b/doc/BUGS @@ -15,6 +15,7 @@ Downloads Webview ------- +- Hinting got really slow (new webelement api?) - Hint positions wrong in wordpress admin interface - Rightclick -> Copy link copies relative links - F on duckduckgo result page opens in current page