diff --git a/frontends/src/quick_frontend/quick_widgets.py b/frontends/src/quick_frontend/quick_widgets.py index d9b8f823..36e7a45b 100644 --- a/frontends/src/quick_frontend/quick_widgets.py +++ b/frontends/src/quick_frontend/quick_widgets.py @@ -40,7 +40,11 @@ def register(base_cls, child_cls=None): @param child_cls: inherited class to use when Quick... class is requested, must inherit from base_cls. Can be None if it's the base_cls itself which register """ - classes_map[base_cls] = child_cls + # FIXME: we use base_cls.__name__ instead of base_cls directly because pyjamas because + # in the second case + classes_map[base_cls.__name__] = child_cls + + class WidgetAlreadyExistsError(Exception): pass @@ -66,7 +70,9 @@ class QuickWidgetsManager(object): @return: class actually used to create widget """ try: - cls = classes_map[class_] + # FIXME: we use base_cls.__name__ instead of base_cls directly because pyjamas bugs + # in the second case + cls = classes_map[class_.__name__] except KeyError: cls = class_ if cls is None: @@ -81,7 +87,7 @@ class QuickWidgetsManager(object): """ class_ = self.getRealClass(class_) try: - widgets_map = self._widgets[class_] + widgets_map = self._widgets[class_.__name__] except KeyError: return iter([]) else: @@ -139,8 +145,9 @@ class QuickWidgetsManager(object): except KeyError: hash_ = cls.getWidgetHash(target, _kwargs['profiles']) - # widget creation or retrieval - widgets_map = self._widgets.setdefault(cls, {}) # we sorts widgets by classes + ## widget creation or retrieval ## + + widgets_map = self._widgets.setdefault(cls.__name__, {}) # we sorts widgets by classes if not cls.SINGLE: widget = None # if the class is not SINGLE, we always create a new widget else: