예제 #1
0
 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]
예제 #2
0
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]
예제 #3
0
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]
예제 #4
0
 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
예제 #5
0
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]
예제 #6
0
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]