[core] Rename events for more clarity

This commit is contained in:
tobi-wan-kenobi 2020-04-12 20:11:02 +02:00
parent b5b62c8827
commit 9e32cdef5d
4 changed files with 8 additions and 8 deletions

View file

@ -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')

View file

@ -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):

View file

@ -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):

View file

@ -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()