def on_widget(self, instance, value):
        stack = self.ids.stack

        # determine if we can just highlight the current one
        # or if we need to rebuild the breadcrumb
        prefs = [btn.widget_ref() for btn in self.parents]
        if value in prefs:
            # ok, so just toggle this one instead.
            index = prefs.index(value)
            for btn in self.parents:
                btn.state = "normal"
            self.parents[index].state = "down"
            return

        # we need to rebuild the breadcrumb.
        stack.clear_widgets()
        if not value:
            return
        widget = value
        parents = []
        while True:
            btn = ConsoleButton(text=widget.__class__.__name__)
            btn.widget_ref = weakref.ref(widget)
            btn.bind(on_release=self.highlight_widget)
            parents.append(btn)
            if widget == widget.parent:
                break
            widget = widget.parent
        for btn in reversed(parents):
            stack.add_widget(btn)
        self.ids.sv.scroll_x = 1
        self.parents = parents
        btn.state = "down"
dataset/ETHPy150Open kivy/kivy/kivy/modules/console.py/ConsoleAddonBreadcrumbView.on_widget/original