From 9e32cdef5d3904c9bd256de4cb09aff20061136a Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Sun, 12 Apr 2020 20:11:02 +0200 Subject: [PATCH] [core] Rename events for more clarity --- bumblebee-status | 6 +++--- core/output.py | 4 ++-- core/theme.py | 2 +- tests/core/test_theme.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bumblebee-status b/bumblebee-status index a72dd57..d448773 100755 --- a/bumblebee-status +++ b/bumblebee-status @@ -32,8 +32,8 @@ def handle_input(output): modules[event['name']] = True except ValueError: pass - core.event.trigger('update-modules', modules.keys()) - core.event.trigger('update') + core.event.trigger('update', modules.keys()) + core.event.trigger('draw') poll.unregister(sys.stdin.fileno()) @@ -58,8 +58,8 @@ def main(): output.modules(modules) core.event.trigger('start') while True: - output.update() core.event.trigger('update') + core.event.trigger('draw') output.wait(config.interval()) core.event.trigger('stop') diff --git a/core/output.py b/core/output.py index 3f8cff5..9880531 100644 --- a/core/output.py +++ b/core/output.py @@ -105,9 +105,9 @@ class i3(object): self.__content = {} self.__theme = theme self.__config = config - core.event.register('update-modules', self.update) + core.event.register('update', self.update) core.event.register('start', self.draw, 'start') - core.event.register('update', self.draw, 'statusline') + core.event.register('draw', self.draw, 'statusline') core.event.register('stop', self.draw, 'stop') def theme(self, new_theme=None): diff --git a/core/theme.py b/core/theme.py index 1911742..7e7a0b7 100644 --- a/core/theme.py +++ b/core/theme.py @@ -43,7 +43,7 @@ class Theme(object): for colors in self.__data.get('colors', []): util.algorithm.merge(self.__keywords, self.load_keywords(colors)) - core.event.register('update', self.__start) + core.event.register('draw', self.__start) core.event.register('next-widget', self.__next_widget) def keywords(self): diff --git a/tests/core/test_theme.py b/tests/core/test_theme.py index 41e57d8..46f91d2 100644 --- a/tests/core/test_theme.py +++ b/tests/core/test_theme.py @@ -65,7 +65,7 @@ class theme(unittest.TestCase): self.assertEqual(self.cycleTheme['cycle'][2]['bg'], theme.get('bg')) with unittest.mock.patch('core.output.sys.stdout'): - core.event.trigger('update') + core.event.trigger('draw') self.assertEqual(self.cycleTheme['cycle'][0]['fg'], theme.get('fg')) self.assertEqual(self.cycleTheme['cycle'][0]['bg'], theme.get('bg')) @@ -109,7 +109,7 @@ class theme(unittest.TestCase): for i in range(0, len(expected)*3): self.assertEqual(expected[i%len(expected)], theme.get('fg', widget)) self.assertEqual(expected[i%len(expected)], theme.get('fg', widget)) # ensure multiple invocations are OK - core.event.trigger('update') + core.event.trigger('draw') def test_state(self): widget = core.widget.Widget()