Skip to content
This repository was archived by the owner on Nov 29, 2022. It is now read-only.

Commit 9b85832

Browse files
committed
Fixed key binding reset key
Fixed issue #131 The reset key binding to default values key would remove all bindings insted of setting them to the default values. This commit fixes that by reloading the default vals.
1 parent 9ba2f5b commit 9b85832

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

mcomix/mcomix/keybindings.py

+13
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ def clear_all(self):
135135
self._action_to_callback = {}
136136
self._action_to_bindings = defaultdict(list)
137137
self._binding_to_action = {}
138+
139+
stored_action_bindings = keybindings_map.DEFAULT_BINDINGS.copy()
140+
141+
for action in keybindings_map.BINDING_INFO.keys():
142+
if action in stored_action_bindings:
143+
bindings = [
144+
Gtk.accelerator_parse(keyname)
145+
for keyname in stored_action_bindings[action] ]
146+
self._action_to_bindings[action] = bindings
147+
for binding in bindings:
148+
self._binding_to_action[binding] = action
149+
else:
150+
self._action_to_bindings[action] = []
138151

139152
def execute(self, keybinding):
140153
''' Executes an action that has been registered for the

0 commit comments

Comments
 (0)