Add KeyConfigStub.get_reverse_bindings_for
This commit is contained in:
parent
49977a32c4
commit
3ea6d4c527
@ -32,7 +32,7 @@ from PyQt5.QtWidgets import QCommonStyle, QLineEdit
|
||||
from qutebrowser.browser import browsertab
|
||||
from qutebrowser.browser.webkit import history
|
||||
from qutebrowser.config import configexc
|
||||
from qutebrowser.utils import usertypes
|
||||
from qutebrowser.utils import usertypes, utils
|
||||
from qutebrowser.mainwindow import mainwindow
|
||||
|
||||
|
||||
@ -471,6 +471,17 @@ class KeyConfigStub:
|
||||
def set_bindings_for(self, section, bindings):
|
||||
self.bindings[section] = bindings
|
||||
|
||||
def get_reverse_bindings_for(self, section):
|
||||
"""Get a dict of commands to a list of bindings for the section."""
|
||||
cmd_to_keys = collections.defaultdict(list)
|
||||
for key, cmd in self.bindings[section].items():
|
||||
# put special bindings last
|
||||
if utils.is_special_key(key):
|
||||
cmd_to_keys[cmd].append(key)
|
||||
else:
|
||||
cmd_to_keys[cmd].insert(0, key)
|
||||
return cmd_to_keys
|
||||
|
||||
|
||||
class UrlMarkManagerStub(QObject):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user