[core/module] name of a widget now equals the module name

to make it easier to trigger events programmatically, the IDs for
modules are not auto-generated UUIDs anymore, but rather the module name
(which has to be unique, anyhow).
This commit is contained in:
tobi-wan-kenobi 2020-05-02 09:40:09 +02:00
parent a8ab4f9509
commit 8e71201030

View file

@ -32,16 +32,18 @@ class Module(core.input.Object):
super().__init__() super().__init__()
self.__config = config self.__config = config
self.__widgets = widgets if isinstance(widgets, list) else [ widgets ] self.__widgets = widgets if isinstance(widgets, list) else [ widgets ]
for widget in self.__widgets:
widget.module = self
self.module_name = self.__module__.split('.')[-1] self.module_name = self.__module__.split('.')[-1]
self.name = self.module_name self.name = self.module_name
self.alias = self.__config.get('__alias__', None) self.alias = self.__config.get('__alias__', None)
self.id = self.alias if self.alias else self.name
self.next_update = None self.next_update = None
self.theme = theme self.theme = theme
for widget in self.__widgets:
widget.module = self
def hidden(self): def hidden(self):
return False return False