From c39ec719598b93f96e92df7b58f10674f7c3eddc Mon Sep 17 00:00:00 2001 From: Lars Vierbergen Date: Thu, 7 Sep 2017 07:51:11 +0200 Subject: [PATCH] Let CycleControl pass commands to its child; let screenlayout respond to unqualified command --- modules/core.py | 1 + modules/cycle.py | 2 ++ modules/screenlayout.py | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/modules/core.py b/modules/core.py index 3de1fca..936f497 100644 --- a/modules/core.py +++ b/modules/core.py @@ -327,6 +327,7 @@ class WrappingControl(AbstractControl): self.child.load_state(state) def respond_to(self, command): + logging.debug('%s.respond_to: Passing command "%s" to child', self.__class__.__name__, command) return self.child.respond_to_ex(command) @property diff --git a/modules/cycle.py b/modules/cycle.py index 470e8ae..e466f58 100644 --- a/modules/cycle.py +++ b/modules/cycle.py @@ -120,6 +120,8 @@ class CycleControl(WrappingControl): elif command == ':prev': self.child.prev() return True + else: + return super().respond_to(command) def __str__(self): next_button = Button.LEFT diff --git a/modules/screenlayout.py b/modules/screenlayout.py index 5d57046..9fd0226 100644 --- a/modules/screenlayout.py +++ b/modules/screenlayout.py @@ -41,6 +41,13 @@ class ScreenLayoutCycleAction(OrderedDictCycleAction): return True return False + def respond_to(self, command: str): + if command == 'screenlayout': + self.next() + return True + else: + return super().respond_to(command) + def __str__(self): return self.__naming_func(super().__str__())