[core] fix minimize for all modules (nic, traffic, etc.)

make it possible to toggle the display state of a widget between
"displayed" and "minimized" also for modules that re-create their
widgets during each iteration.

see #661
This commit is contained in:
Tobias Witek 2020-06-23 20:03:17 +02:00
parent 34dadadf90
commit 441e7d5041
4 changed files with 26 additions and 18 deletions

View file

@ -171,7 +171,8 @@ class Module(core.input.Object):
"""
def add_widget(self, full_text="", name=None):
widget = core.widget.Widget(full_text=full_text, name=name)
widget_id = "{}::{}".format(self.name, len(self.widgets()))
widget = core.widget.Widget(full_text=full_text, name=name, widget_id=widget_id)
self.widgets().append(widget)
widget.module = self
return widget