def widget_type(cls, pobj): ptype = type(pobj) for t in classlist(ptype)[::-1]: if t in cls._mapping: if isinstance(cls._mapping[t], types.FunctionType): return cls._mapping[t](pobj) return cls._mapping[t]
def wtype(pobj): if pobj.constant: # constant params shouldn't be editable return ipywidgets.HTML for t in classlist(type(pobj))[::-1]: if t in ptype2wtype: return ptype2wtype[t]
def widget_type(cls, pobj): ptype = type(pobj) for t in classlist(ptype)[::-1]: if t not in cls.mapping: continue wtype = cls.mapping[t] if isinstance(wtype, types.FunctionType): return wtype(pobj) return wtype
def wtype(pobj): if pobj.constant: # Ensure constant parameters cannot be edited return HTMLWidget for t in classlist(type(pobj))[::-1]: if t in ptype2wtype: return ptype2wtype[t]
def wtype(pobj): if pobj.constant: # Ensure constant parameters cannot be edited return ipywidgets.HTML for t in classlist(type(pobj))[::-1]: if t in ptype2wtype: return ptype2wtype[t]