comparison sat_frontends/quick_frontend/quick_widgets.py @ 3114:060ac43627fc

quick frontend (widgets): fixed widget creation in getOrCreateWidget: when a new widget was created, it was overwritting the exiting instances list. This patch fixes it.
author Goffi <goffi@goffi.org>
date Fri, 17 Jan 2020 17:55:57 +0100
parents 91891a108d6f
children 3018d153a615
comparison
equal deleted inserted replaced
3113:b067736d5099 3114:060ac43627fc
223 223
224 if widget is None: 224 if widget is None:
225 # we need to create a new widget 225 # we need to create a new widget
226 log.debug("Creating new widget for target {} {}".format(target, cls)) 226 log.debug("Creating new widget for target {} {}".format(target, cls))
227 widget = cls(*_args, **_kwargs) 227 widget = cls(*_args, **_kwargs)
228 widgets_map[hash_] = [widget] 228 widgets_map.setdefault(hash_, []).append(widget)
229 229
230 if on_new_widget == C.WIDGET_NEW: 230 if on_new_widget == C.WIDGET_NEW:
231 self.host.newWidget(widget) 231 self.host.newWidget(widget)
232 elif callable(on_new_widget): 232 elif callable(on_new_widget):
233 on_new_widget(widget) 233 on_new_widget(widget)