(self)
Clean up any empty tabs and if we only have one tab left, die
Clean up any empty tabs and if we only have one tab left, die
Clean up any empty tabs and if we only have one tab left die
def hoover(self):
        """Clean up any empty tabs and if we only have one tab left, die"""
        numpages = self.get_n_pages()
        while numpages > 0:
            numpages = numpages - 1
            page = self.get_nth_page(numpages)
            if not page:
                dbg('Removing empty page: %d' % numpages)
                self.remove_page(numpages)

        if self.get_n_pages() == 1:
            dbg('Last page, removing self')
            child = self.get_nth_page(0)
            self.remove_page(0)
            parent = self.get_parent()
            parent.remove(self)
            self.cnxids.remove_all()
            parent.add(child)
            del(self)
            # Find the last terminal in the new parent and give it focus
            terms = parent.get_visible_terminals()
            list(terms.keys())[-1].grab_focus()
def hoover ( self ) : numpages = self . get_n_pages ( ) while numpages > 0 : numpages = numpages - 1 page = self . get_nth_page ( numpages ) if not page : dbg ( 'Removing empty page: %d' % numpages ) self . remove_page ( numpages ) if self . get_n_pages ( ) == 1 : dbg ( 'Last page, removing self' ) child = self . get_nth_page ( 0 ) self . remove_page ( 0 ) parent = self . get_parent ( ) parent . remove ( self ) self . cnxids . remove_all ( ) parent . add ( child ) del ( self ) # Find the last terminal in the new parent and give it focus terms = parent . get_visible_terminals ( ) list ( terms . keys ( ) ) [ - 1 ] . grab_focus ( )