Don't warn on prompt keychain bindings
This commit is contained in:
parent
cfd70e7821
commit
7c351caf77
@ -212,7 +212,7 @@ class QuteBrowser(QApplication):
|
||||
'insert': PassthroughKeyParser('keybind.insert', self),
|
||||
'passthrough': PassthroughKeyParser('keybind.passthrough', self),
|
||||
'command': PassthroughKeyParser('keybind.command', self),
|
||||
'prompt': PassthroughKeyParser('keybind.prompt', self),
|
||||
'prompt': PassthroughKeyParser('keybind.prompt', self, warn=False),
|
||||
'yesno': PromptKeyParser(self),
|
||||
}
|
||||
self.modeman = ModeManager()
|
||||
|
@ -51,6 +51,8 @@ class BaseKeyParser(QObject):
|
||||
Attributes:
|
||||
bindings: Bound keybindings
|
||||
special_bindings: Bound special bindings (<Foo>).
|
||||
warn_on_keychains: Whether a warning should be logged when binding
|
||||
keychains in a section which does not support them.
|
||||
_keystring: The currently entered key sequence
|
||||
_timer: QTimer for delayed execution.
|
||||
_confsectname: The name of the configsection.
|
||||
@ -77,6 +79,7 @@ class BaseKeyParser(QObject):
|
||||
supports_count = supports_chains
|
||||
self._supports_count = supports_count
|
||||
self._supports_chains = supports_chains
|
||||
self.warn_on_keychains = True
|
||||
self.bindings = {}
|
||||
self.special_bindings = {}
|
||||
|
||||
@ -340,7 +343,7 @@ class BaseKeyParser(QObject):
|
||||
elif self._supports_chains:
|
||||
logging.debug("registered key: {} -> {}".format(key, cmd))
|
||||
self.bindings[key] = cmd
|
||||
else:
|
||||
elif self.warn_on_keychains:
|
||||
logging.warning(
|
||||
"Ignoring keychain '{}' in section '{}' because "
|
||||
"keychains are not supported there.".format(key, sectname))
|
||||
|
@ -67,11 +67,15 @@ class PassthroughKeyParser(CommandKeyParser):
|
||||
Used for insert/passthrough modes.
|
||||
"""
|
||||
|
||||
def __init__(self, confsect, parent=None):
|
||||
def __init__(self, confsect, parent=None, warn=True):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
confsect: The config section to use.
|
||||
parent: Qt parent.
|
||||
warn: Whether to warn if an ignored key was bound.
|
||||
"""
|
||||
super().__init__(parent, supports_chains=False)
|
||||
if not warn:
|
||||
self.warn_on_keychains = False
|
||||
self.read_config(confsect)
|
||||
|
Loading…
Reference in New Issue
Block a user