Allow empty keys in config

This commit is contained in:
Florian Bruhin 2014-05-02 06:59:46 +02:00
parent 678abca244
commit 836a5e04a5
3 changed files with 5 additions and 2 deletions

1
TODO
View File

@ -40,7 +40,6 @@ Ctrl+A/X to increase/decrease last number in URL
command completion gets hidden when doing a new ValueList value command completion gets hidden when doing a new ValueList value
logging contexts logging contexts
catch import errors for PyQt and QtWebKit catch import errors for PyQt and QtWebKit
Allow binding to empty values for keys to override defaults
How do we handle empty values in input bar? How do we handle empty values in input bar?
- Add more element-selection-detection code (with options?) based on: - Add more element-selection-detection code (with options?) based on:
-> javascript: http://stackoverflow.com/a/2848120/2085149 -> javascript: http://stackoverflow.com/a/2848120/2085149

View File

@ -430,6 +430,8 @@ class Command(BaseType):
typestr = 'command' typestr = 'command'
def validate(self, value): def validate(self, value):
if not value:
return
if value.split()[0] not in cmdutils.cmd_dict: if value.split()[0] not in cmdutils.cmd_dict:
raise ValidationError(value, "must be a valid command!") raise ValidationError(value, "must be a valid command!")

View File

@ -309,7 +309,9 @@ class BaseKeyParser(QObject):
if not sect.items(): if not sect.items():
logging.warn("No keybindings defined!") logging.warn("No keybindings defined!")
for (key, cmd) in sect.items(): for (key, cmd) in sect.items():
if key.startswith('<') and key.endswith('>'): if not cmd:
continue
elif key.startswith('<') and key.endswith('>'):
keystr = self._normalize_keystr(key[1:-1]) keystr = self._normalize_keystr(key[1:-1])
logging.debug("registered special key: {} -> {}".format(keystr, logging.debug("registered special key: {} -> {}".format(keystr,
cmd)) cmd))