Config bugfixes.

Stylesheet still broken, but at least keybindings work.
This commit is contained in:
Florian Bruhin 2014-02-26 07:58:18 +01:00
parent f079d6bf3b
commit 369ee1f47e
4 changed files with 14 additions and 9 deletions

View File

@ -249,12 +249,12 @@ class KeyParser(QObject):
# normalize keystring # normalize keystring
keystr = self._normalize_keystr(key.value.strip('@')) keystr = self._normalize_keystr(key.value.strip('@'))
logging.debug('registered mod key: {} -> {}'.format(keystr, logging.debug('registered mod key: {} -> {}'.format(keystr,
cmd)) cmd.value))
self._modifier_bindings[keystr] = cmd self._modifier_bindings[keystr] = cmd.value
else: else:
logging.debug('registered key: {} -> {}'.format(key.value, logging.debug('registered key: {} -> {}'.format(key.value,
cmd)) cmd.value))
self._bindings[key] = cmd self._bindings[key.value] = cmd.value
def handle(self, e): def handle(self, e):
"""Handle a new keypress and call the respective handlers. """Handle a new keypress and call the respective handlers.

View File

@ -147,7 +147,7 @@ class CommandParser(QObject):
if aliases: if aliases:
try: try:
alias = config.config.get('aliases', cmdstr) alias = config.config.get('aliases', cmdstr)
except config.NoOptionError: except KeyError:
pass pass
else: else:
return self._parse(alias, aliases=False) return self._parse(alias, aliases=False)

View File

@ -17,6 +17,8 @@
"""Utilities related to the look&feel of qutebrowser.""" """Utilities related to the look&feel of qutebrowser."""
import logging
import qutebrowser.config.config as config import qutebrowser.config.config as config
@ -30,8 +32,10 @@ def get_stylesheet(template):
The formatted template as string. The formatted template as string.
""" """
return template.strip().format(color=ColorDict(config.config['colors']), cdict = config.config['colors'].values
font=FontDict(config.config['fonts'])) fdict = config.config['fonts'].values
return template.strip().format(color=ColorDict(cdict),
font=FontDict(fdict))
class ColorDict(dict): class ColorDict(dict):

View File

@ -18,6 +18,7 @@
"""Templates for setting options.""" """Templates for setting options."""
import logging import logging
from collections import OrderedDict
import qutebrowser.commands.utils as cmdutils import qutebrowser.commands.utils as cmdutils
@ -250,7 +251,7 @@ class ValueListSection:
def __init__(self): def __init__(self):
"""Wrap types over default values. Take care when overriding this.""" """Wrap types over default values. Take care when overriding this."""
logging.debug("Default before wrapping: {}".format(self.default)) self.values = OrderedDict()
self.default = {self.types[0](key): self.types[1](value) self.default = {self.types[0](key): self.types[1](value)
for key, value in self.default.items()} for key, value in self.default.items()}
@ -272,7 +273,7 @@ class ValueListSection:
try: try:
return self.values[key] return self.values[key]
except KeyError: except KeyError:
return self.defaults[key] return self.default[key]
def __iter__(self): def __iter__(self):
"""Iterate over all set values.""" """Iterate over all set values."""