Merge branch 'master' of ssh://cmpl.cc:2323/qutebrowser

This commit is contained in:
Florian Bruhin 2014-09-15 18:01:20 +02:00
commit 175d25b3c4
8 changed files with 45 additions and 28 deletions

View File

@ -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]

View File

@ -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
@ -35,6 +36,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

View File

@ -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
@ -54,6 +56,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?)

View File

@ -388,15 +388,17 @@ 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
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):
@ -466,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)

View File

@ -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."""

View File

@ -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:

View File

@ -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:

View File

@ -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()