How to use the jupyter-innotater.jupyter_innotater.mixins.ChildrenChangeNotifierMixin function in jupyter-innotater

To help you get started, we’ve selected a few jupyter-innotater examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ideonate / jupyter-innotater / jupyter-innotater / jupyter_innotater / combine.py View on Github external
def contains_widget(self, widget):
        for innot in self.childinnotations:
            if innot.contains_widget(widget):
                return True
        return False

    def list_innotations_tree(self):
        return [self, *self.childinnotations]

    def __len__(self):
        if len(self.childinnotations) > 0:
            return len(self.childinnotations[0])
        return 0


class RepeatInnotation(Innotation, ChildrenChangeNotifierMixin):

    def __init__(self, *args, **kwargs):

        super().__init__(*args, **kwargs)

        self.rows_count = 0

        self.childinnotationconfigs = args

        self.childinnotations = []

        self.min_repeats = kwargs.get('min_repeats', 0)
        self.max_repeats = kwargs.get('max_repeats', 10)

        if self.max_repeats < self.min_repeats:
            raise Exception("min_repeats is greater than max_repeats")
github ideonate / jupyter-innotater / jupyter-innotater / jupyter_innotater / innotaterwidget.py View on Github external
def _observe_targets(self, targets):
        for dw in targets:
            dw.widget_observe(self.update_data, names='value')
            if isinstance(dw, ChildrenChangeNotifierMixin):
                dw.on_children_changed(self.new_children_handler)
            if isinstance(dw, DataChangeNotifierMixin):
                dw.on_data_changed(self.updated_data_handler)