Remove setting forward_unbound_keys.

It introduced a lot of unnecessary complexity (e.g. tracking KeyReleases
to their KeyPresses...) for little benefit.
This commit is contained in:
Florian Bruhin 2014-04-25 06:52:18 +02:00
parent 83f829ed93
commit d07e22bd91
3 changed files with 4 additions and 24 deletions

View File

@ -284,7 +284,7 @@ class QuteBrowser(QApplication):
# config
self.config.style_changed.connect(style.invalidate_caches)
for obj in [tabs, completion, self.mainwindow, config.cmd_history,
websettings, kp["normal"], modes.manager]:
websettings, kp["normal"]]:
self.config.changed.connect(obj.on_config_changed)
# statusbar

View File

@ -186,10 +186,6 @@ DATA = OrderedDict([
SettingValue(types.Bool(), "true"),
"Whether to automatically enter insert mode if an editable element "
"is focused after page load."),
('forward_unbound_keys',
SettingValue(types.Bool(), "false"),
"Whether to forward unbound keys to the website in normal mode."),
)),
('tabbar', sect.KeyValue(

View File

@ -75,7 +75,6 @@ class ModeManager(QObject):
_handlers: A dictionary of modes and their handlers.
_mode_stack: A list of the modes we're currently in, with the active
one on the right.
_forward_unbound_keys: If we should forward unbound keys.
Signals:
entered: Emitted when a mode is entered.
@ -94,8 +93,6 @@ class ModeManager(QObject):
self._handlers = {}
self.passthrough = []
self._mode_stack = []
self._forward_unbound_keys = config.get('general',
'forward_unbound_keys')
@property
def mode(self):
@ -160,13 +157,6 @@ class ModeManager(QObject):
raise ValueError("Can't leave normal mode!")
self.leave(self.mode)
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
"""Update local setting when config changed."""
if (section, option) == ('general', 'forward_unbound_keys'):
self._forward_unbound_keys = config.get('general',
'forward_unbound_keys')
def eventFilter(self, obj, evt):
"""Filter all events based on the currently set mode.
@ -213,17 +203,11 @@ class ModeManager(QObject):
# KeyPress in a non-passthrough mode - call handler and filter
# event from widgets (unless unhandled and configured to pass
# unhandled events through)
logging.debug("KeyPress, calling handler {}".format(handler))
logging.debug("KeyPress, calling handler {} and "
"filtering".format(handler))
self.key_pressed.emit(evt)
handled = handler(evt) if handler is not None else False
logging.debug("handled: {}, forward_unbound_keys: {} -> "
"filtering: {}".format(
handled, self._forward_unbound_keys,
handled or not self._forward_unbound_keys))
if handled or not self._forward_unbound_keys:
return True
else:
return False
return True
else:
# KeyRelease in a non-passthrough mode - filter event and
# ignore it entirely.