(self, model=None)
When a different tree is given.
When a different tree is given.
When a different tree is given .
def set_tree(self, model=None):
        """When a different tree is given."""
        self.closeContext()
        self.clear()
        self.model = model

        if model is not None:
            self.data = model.instances

            self._update_target_class_combo()
            self.tree_adapter = self._get_tree_adapter(self.model)
            self.ptree.clear()

            self.ptree.set_tree(
                self.tree_adapter,
                weight_adjustment=self.SIZE_CALCULATION[self.size_calc_idx][1],
                target_class_index=self.target_class_index,
            )

            self._update_depth_slider()
            self.color_palette = self.ptree.root.color_palette
            self._update_legend_colors()
            self._update_legend_visibility()
            self._update_info_box()

            self._update_main_area()

            self.openContext(
                model.domain.class_var if model.domain is not None else None
            )

        self.update_depth()

        # The forest widget sets the following attributes on the tree,
        # describing the settings on the forest widget. To keep the tree
        # looking the same as on the forest widget, we prefer these settings to
        # context settings, if set.
        if hasattr(model, "meta_target_class_index"):
            self.target_class_index = model.meta_target_class_index
            self.update_colors()
        if hasattr(model, "meta_size_calc_idx"):
            self.size_calc_idx = model.meta_size_calc_idx
            self.update_size_calc()
        if hasattr(model, "meta_depth_limit"):
            self.depth_limit = model.meta_depth_limit
            self.update_depth()

        self.Outputs.annotated_data.send(create_annotated_table(self.data, None))
def set_tree ( self , model = None ) : self . closeContext ( ) self . clear ( ) self . model = model if model is not None : self . data = model . instances self . _update_target_class_combo ( ) self . tree_adapter = self . _get_tree_adapter ( self . model ) self . ptree . clear ( ) self . ptree . set_tree ( self . tree_adapter , weight_adjustment = self . SIZE_CALCULATION [ self . size_calc_idx ] [ 1 ] , target_class_index = self . target_class_index , ) self . _update_depth_slider ( ) self . color_palette = self . ptree . root . color_palette self . _update_legend_colors ( ) self . _update_legend_visibility ( ) self . _update_info_box ( ) self . _update_main_area ( ) self . openContext ( model . domain . class_var if model . domain is not None else None ) self . update_depth ( ) # The forest widget sets the following attributes on the tree, # describing the settings on the forest widget. To keep the tree # looking the same as on the forest widget, we prefer these settings to # context settings, if set. if hasattr ( model , "meta_target_class_index" ) : self . target_class_index = model . meta_target_class_index self . update_colors ( ) if hasattr ( model , "meta_size_calc_idx" ) : self . size_calc_idx = model . meta_size_calc_idx self . update_size_calc ( ) if hasattr ( model , "meta_depth_limit" ) : self . depth_limit = model . meta_depth_limit self . update_depth ( ) self . Outputs . annotated_data . send ( create_annotated_table ( self . data , None ) )