def _set_packagebase(self, variant):
        self.setEnabled(variant is not None)
        self.variant = variant
        is_package = isinstance(variant, Package)
        prev_index = self.currentIndex()
        disabled_tabs = set()

        for d in self.tabs.itervalues():
            index = d["index"]
            if (not d["lazy"]) or (self.currentIndex() == index):
                self.widget(index).set_variant(variant)

        tab_index = self.tabs["variants"]["index"]
        if (isinstance(variant, Variant) and variant.index is not None) \
                or (is_package and variant.num_variants):
            n = variant.num_variants if is_package else variant.parent.num_variants
            label = "variants (%d)" % n
            self.setTabEnabled(tab_index, True)
        else:
            label = "variants"
            self.setTabEnabled(tab_index, False)
            disabled_tabs.add(tab_index)
        self.setTabText(tab_index, label)

        tab_index = self.tabs["tools"]["index"]
        if variant and variant.tools:
            label = "tools (%d)" % len(variant.tools)
            self.setTabEnabled(tab_index, True)
        else:
            label = "tools"
            self.setTabEnabled(tab_index, False)
            disabled_tabs.add(tab_index)
        self.setTabText(tab_index, label)

        """
        tab_index = self.tabs["help"]
        if self.help_widget.success:
            self.setTabEnabled(tab_index, True)
        else:
            self.setTabEnabled(tab_index, False)
            disabled_tabs.add(tab_index)
        """

        if prev_index in disabled_tabs:
            self.setCurrentIndex(0)
def _set_packagebase ( self , variant ) : self . setEnabled ( variant is not None ) self . variant = variant is_package = isinstance ( variant , Package ) prev_index = self . currentIndex ( ) disabled_tabs = set ( ) for d in self . tabs . itervalues ( ) : index = d [ "index" ] if ( not d [ "lazy" ] ) or ( self . currentIndex ( ) == index ) : self . widget ( index ) . set_variant ( variant ) tab_index = self . tabs [ "variants" ] [ "index" ] if ( isinstance ( variant , Variant ) and variant . index is not None ) or ( is_package and variant . num_variants ) : n = variant . num_variants if is_package else variant . parent . num_variants label = "variants (%d)" % n self . setTabEnabled ( tab_index , True ) else : label = "variants" self . setTabEnabled ( tab_index , False ) disabled_tabs . add ( tab_index ) self . setTabText ( tab_index , label ) tab_index = self . tabs [ "tools" ] [ "index" ] if variant and variant . tools : label = "tools (%d)" % len ( variant . tools ) self . setTabEnabled ( tab_index , True ) else : label = "tools" self . setTabEnabled ( tab_index , False ) disabled_tabs . add ( tab_index ) self . setTabText ( tab_index , label ) """
        tab_index = self.tabs["help"]
        if self.help_widget.success:
            self.setTabEnabled(tab_index, True)
        else:
            self.setTabEnabled(tab_index, False)
            disabled_tabs.add(tab_index)
        """ if prev_index in disabled_tabs : self . setCurrentIndex ( 0 )
tab_index = self.tabs["help"]
        if self.help_widget.success:
            self.setTabEnabled(tab_index, True)
        else:
            self.setTabEnabled(tab_index, False)
            disabled_tabs.add(tab_index)