Handle multiple commands in KeyConfigParser.get_reverse_bindings_for

This commit is contained in:
Florian Bruhin 2017-02-06 15:48:05 +01:00
parent 98e6ccf548
commit 39508d984e

View File

@ -435,11 +435,13 @@ class KeyConfigParser(QObject):
def get_reverse_bindings_for(self, section): def get_reverse_bindings_for(self, section):
"""Get a dict of commands to a list of bindings for the section.""" """Get a dict of commands to a list of bindings for the section."""
cmd_to_keys = {} cmd_to_keys = {}
for key, cmd in self.get_bindings_for(section).items(): for key, full_cmd in self.get_bindings_for(section).items():
cmd_to_keys.setdefault(cmd, []) for cmd in full_cmd.split(';;'):
# put special bindings last cmd = cmd.strip()
if utils.is_special_key(key): cmd_to_keys.setdefault(cmd, [])
cmd_to_keys[cmd].append(key) # put special bindings last
else: if utils.is_special_key(key):
cmd_to_keys[cmd].insert(0, key) cmd_to_keys[cmd].append(key)
else:
cmd_to_keys[cmd].insert(0, key)
return cmd_to_keys return cmd_to_keys