(self, widget, num=None)
Change to a specific tab
Change to a specific tab
Change to a specific tab
def tab_change(self, widget, num=None):
        """Change to a specific tab"""
        if self.is_zoomed():
            self.unzoom()

        if num is None:
            err('must specify a tab to change to')

        maker = Factory()
        child = self.get_child()

        if not maker.isinstance(child, 'Notebook'):
            dbg('child is not a notebook, nothing to change to')
            return

        if num == -1:
            # Go to the next tab
            cur = child.get_current_page()
            pages = child.get_n_pages()
            if cur == pages - 1:
                num = 0
            else:
                num = cur + 1
        elif num == -2:
            # Go to the previous tab
            cur = child.get_current_page()
            if cur > 0:
                num = cur - 1
            else:
                num = child.get_n_pages() - 1

        child.set_current_page(num)
        # Work around strange bug in gtk-2.12.11 and pygtk-2.12.1
        # Without it, the selection changes, but the displayed page doesn't
        # change
        child.set_current_page(child.get_current_page())
def tab_change ( self , widget , num = None ) : if self . is_zoomed ( ) : self . unzoom ( ) if num is None : err ( 'must specify a tab to change to' ) maker = Factory ( ) child = self . get_child ( ) if not maker . isinstance ( child , 'Notebook' ) : dbg ( 'child is not a notebook, nothing to change to' ) return if num == - 1 : # Go to the next tab cur = child . get_current_page ( ) pages = child . get_n_pages ( ) if cur == pages - 1 : num = 0 else : num = cur + 1 elif num == - 2 : # Go to the previous tab cur = child . get_current_page ( ) if cur > 0 : num = cur - 1 else : num = child . get_n_pages ( ) - 1 child . set_current_page ( num ) # Work around strange bug in gtk-2.12.11 and pygtk-2.12.1 # Without it, the selection changes, but the displayed page doesn't # change child . set_current_page ( child . get_current_page ( ) )