From 8ae8fbb98900bcf059ddf4614e673510723a604d Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Fri, 14 Feb 2020 21:39:01 +0100 Subject: [PATCH] [engine] Add override for widget IDs Add a generic ".id" parameter that allows a user to override the auto-generated IDs for a widget - the parameter is a list of IDs that will replace each widget's ID in turn. see #547 --- bumblebee/engine.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bumblebee/engine.py b/bumblebee/engine.py index 1159884..377dfc4 100644 --- a/bumblebee/engine.py +++ b/bumblebee/engine.py @@ -295,8 +295,12 @@ class Engine(object): self._current_module = module module.update_wrapper(module.widgets()) if module.error is None: + widget_ids = module.parameter('id', '').split(',') + idx = 0 for widget in module.widgets(): widget.link_module(module) + widget.id = widget_ids[idx] if idx < len(widget_ids) else widget.id + idx = idx + 1 self._output.draw(widget=widget, module=module, engine=self) else: self._output.draw(widget=module.errorWidget(), module=module, engine=self)