def control_list(control_type, *a, **k): if control_type == RadioButtonControl: return RadioButtonGroup(*a, **k) c = _control_list_classes.get(control_type, None) if not c: c = mixin(ControlList, control_type) c.State = mixin(ControlList.State, control_type.State) _control_list_classes[control_type] = c return c(control_type, *a, **k)
def decorator(self, method): raise isinstance(self, SlotManager) or AssertionError function = partial(method, self) event_list = events.split('.') num_events = len(event_list) event = event_list if num_events > 1 else events base_class = MultiSubjectSlot if num_events > 1 else SubjectSlot slot = wraps(method)(mixin(base_class, CallableSlotMixin)(event=event, extra_kws=k, extra_args=a, listener=function, function=function)) self.register_slot(slot) return slot