@classmethod
    def _build_widget_subclass(cls):
        """
        Build the DataViewer subclass for this viewer
        """
        props = CustomWidgetBase._property_set + list(cls.ui.keys())
        widget_dict = {'LABEL': cls.name,
                       'ui': cls.ui,
                       'coordinator_cls': cls,
                       '_property_set': props}
        widget_dict.update(**dict((k, FormDescriptor(k))
                                  for k in cls.ui))
        widget_cls = type('%sWidget' % cls.__name__,
                          (CustomWidgetBase,),
                          widget_dict)

        cls._widget_cls = widget_cls
        qt_client.add(widget_cls)

        # add new classes to module namespace
        # needed for proper state saving/restoring
        for c in [widget_cls, cls]:
            w = getattr(getmodule(ViewerState), c.__name__, None)
            if w is not None:
                raise RuntimeError("Duplicate custom viewer detected %s" % c)

            setattr(getmodule(ViewerState), c.__name__, c)
dataset/ETHPy150Open glue-viz/glue/glue/viewers/custom/qt/custom_viewer.py/CustomViewer._build_widget_subclass/original