Use <> instead of @@ for special keys

This commit is contained in:
Florian Bruhin 2014-04-24 17:48:38 +02:00
parent 8648d88b51
commit 718295eb9f
3 changed files with 16 additions and 16 deletions

View File

@ -115,9 +115,9 @@ class CommandKeyParser(KeyParser):
if not sect.items():
logging.warn("No keybindings defined!")
for (key, cmd) in sect.items():
if key.startswith('@') and key.endswith('@'):
if key.startswith('<') and key.endswith('>'):
# normalize keystring
keystr = self._normalize_keystr(key.strip('@'))
keystr = self._normalize_keystr(key[1:-1])
logging.debug('registered special key: {} -> {}'.format(keystr,
cmd))
self.special_bindings[keystr] = cmd

View File

@ -68,14 +68,14 @@ SECTION_DESC = {
'keybind': (
"Bindings from a key(chain) to a command.\n"
"For special keys (can't be part of a keychain), enclose them in "
"@-signs. For modifiers, you can use either - or + as delimiters, and "
"<...>. For modifiers, you can use either - or + as delimiters, and "
"these names:\n"
" Control: Control, Ctrl\n"
" Meta: Meta, Windows, Mod4\n"
" Alt: Alt, Mod1\n"
" Shift: Shift\n"
"For simple keys (no @ signs), a capital letter means the key is "
"pressed with Shift. For modifier keys (with @ signs), you need "
"For simple keys (no <>-signs), a capital letter means the key is "
"pressed with Shift. For special keys (with <>-signs), you need "
"to explicitely add \"Shift-\" to match a key pressed with shift. "
"You can bind multiple commands by separating them with \";;\"."),
'aliases': (
@ -409,15 +409,15 @@ DATA = OrderedDict([
('PP', 'tabpaste sel'),
('-', 'zoomout'),
('+', 'zoomin'),
('@Ctrl-Q@', 'quit'),
('@Ctrl-Shift-T@', 'undo'),
('@Ctrl-W@', 'tabclose'),
('@Ctrl-T@', 'tabopen about:blank'),
('@Ctrl-F@', 'scroll_page 0 1'),
('@Ctrl-B@', 'scroll_page 0 -1'),
('@Ctrl-D@', 'scroll_page 0 0.5'),
('@Ctrl-U@', 'scroll_page 0 -0.5'),
('@Backspace@', 'back'),
('<Ctrl-Q>', 'quit'),
('<Ctrl-Shift-T>', 'undo'),
('<Ctrl-W>', 'tabclose'),
('<Ctrl-T>', 'tabopen about:blank'),
('<Ctrl-F>', 'scroll_page 0 1'),
('<Ctrl-B>', 'scroll_page 0 -1'),
('<Ctrl-D>', 'scroll_page 0 0.5'),
('<Ctrl-U>', 'scroll_page 0 -0.5'),
('<Backspace>', 'back'),
)),
('aliases', sect.ValueList(

View File

@ -46,7 +46,7 @@ class KeyParser(QObject):
_keystring: The currently entered key sequence
_timer: QTimer for delayed execution.
bindings: Bound keybindings
special_bindings: Bound special bindings (@Foo@).
special_bindings: Bound special bindings (<Foo>).
Signals:
keystring_updated: Emitted when the keystring is updated.
@ -71,7 +71,7 @@ class KeyParser(QObject):
else special_bindings)
def _handle_special_key(self, e):
"""Handle a new keypress with special keys (@Foo@).
"""Handle a new keypress with special keys (<Foo>).
Return True if the keypress has been handled, and False if not.