Mercurial > getan
changeset 565:2c6ff55be046
Each state stores the controller and the controller knows the config.
So we do not need to cache the config reference in the states.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 28 Sep 2020 15:07:32 +0200 |
parents | c8e63e919a90 |
children | 5ee84c9805f9 |
files | getan/states.py |
diffstat | 1 files changed, 10 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/states.py Mon Sep 28 14:48:51 2020 +0200 +++ b/getan/states.py Mon Sep 28 15:07:32 2020 +0200 @@ -42,7 +42,6 @@ def __init__(self, controller, view): self.controller = controller self.view = view - self.config = controller.get_config() self.set_focus() def keypress(self, size, key): @@ -68,7 +67,7 @@ class ProjectState(State): def handle_input(self, input): - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() logger.debug("ProjectState: handle input '%r'" % input) if keys.get_switch_time_mode() in input: self.view.switch_time_mode() @@ -104,7 +103,7 @@ def handle_input(self, key): logger.debug("PausedProjectsState: handle key '%r'" % key) - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() ret = super(PausedProjectsState, self).handle_input(key) if ret: return True @@ -175,7 +174,7 @@ return True def handle_input(self, key): - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() if keys.get_escape() in key: self.reset() self.set_next_state( @@ -262,7 +261,7 @@ def handle_signal(self, signum, frame): proj = self.project - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() if not proj: return @@ -292,7 +291,7 @@ def handle_input(self, key): logger.debug("RunningProjectsState: handle key '%r'" % key) - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() ret = super(RunningProjectsState, self).handle_input(key) if ret: return ret @@ -353,7 +352,7 @@ def handle_input(self, key): logger.debug("HandleUserInputState: handle key '%r'" % key) - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() if keys.get_escape() in key: return self.exit() @@ -506,7 +505,7 @@ def handle_input(self, key): logger.debug("EntryListState: pressed key '%r'" % key) - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() if keys.get_switch_lists() in key: self.view.clear() @@ -549,7 +548,7 @@ if ret: return ret - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() if keys.get_escape() in key: self.view.clear() self.set_next_state(self.projectlist_state) @@ -622,7 +621,7 @@ self.entries = [x.item for x in self.view.selection] def handle_input(self, key): - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() if 'y' in key: if self.entries: self.controller.delete_entries(self.entries) @@ -690,7 +689,7 @@ self.view.set_footer_text(self.msg('really'), 'question') def handle_input(self, key): - keys = self.config.get_keybinding() + keys = self.controller.get_config().get_keybinding() if 'y' in key and self.proj: logger.debug("MoveEntryState: move selected entries.") self.controller.move_entries(self.entries, self.proj)