(self, count, parent, global_layout, child_order)
return(count)
Describe our current layout
Describe our current layout
Describe our current layout
def describe_layout(self, count, parent, global_layout, child_order):
        """Describe our current layout"""
        layout = {}
        maker = Factory()
        mytype = maker.type(self)
        if not mytype:
            err('unable to detemine own type. %s' % self)
            return({})

        layout['type'] = mytype
        layout['parent'] = parent
        layout['order'] = child_order

        if hasattr(self, 'get_position'):
            position = self.get_position()
            if hasattr(position, '__iter__'):
                position = ':'.join([str(x) for x in position])
            layout['position'] = position
        
        if hasattr(self, 'ismaximised'):
            layout['maximised'] = self.ismaximised
        
        if hasattr(self, 'isfullscreen'):
            layout['fullscreen'] = self.isfullscreen
        
        if hasattr(self, 'ratio'):
            layout['ratio'] = self.ratio

        if hasattr(self, 'get_size'):
            layout['size'] = self.get_size()

        if hasattr(self, 'title'):
            layout['title'] = self.title.text

        if mytype == 'Notebook':
            labels = []
            last_active_term = []
            for tabnum in range(0, self.get_n_pages()):
                page = self.get_nth_page(tabnum)
                label = self.get_tab_label(page)
                labels.append(label.get_custom_label())
                last_active_term.append(self.last_active_term[self.get_nth_page(tabnum)])
            layout['labels'] = labels
            layout['last_active_term'] = last_active_term
            layout['active_page'] = self.get_current_page()
        else:
            if hasattr(self, 'last_active_term') and self.last_active_term is not None:
                layout['last_active_term'] = self.last_active_term

        if mytype == 'Window':
            if self.uuid == self.terminator.last_active_window:
                layout['last_active_window'] = True
            else:
                layout['last_active_window'] = False

        name = 'child%d' % count
        count = count + 1

        global_layout[name] = layout

        child_order = 0
        for child in self.get_children():
            if hasattr(child, 'describe_layout'):
                count = child.describe_layout(count, name, global_layout, child_order)
            child_order = child_order + 1

        return(count)
def describe_layout ( self , count , parent , global_layout , child_order ) : layout = { } maker = Factory ( ) mytype = maker . type ( self ) if not mytype : err ( 'unable to detemine own type. %s' % self ) return ( { } ) layout [ 'type' ] = mytype layout [ 'parent' ] = parent layout [ 'order' ] = child_order if hasattr ( self , 'get_position' ) : position = self . get_position ( ) if hasattr ( position , '__iter__' ) : position = ':' . join ( [ str ( x ) for x in position ] ) layout [ 'position' ] = position if hasattr ( self , 'ismaximised' ) : layout [ 'maximised' ] = self . ismaximised if hasattr ( self , 'isfullscreen' ) : layout [ 'fullscreen' ] = self . isfullscreen if hasattr ( self , 'ratio' ) : layout [ 'ratio' ] = self . ratio if hasattr ( self , 'get_size' ) : layout [ 'size' ] = self . get_size ( ) if hasattr ( self , 'title' ) : layout [ 'title' ] = self . title . text if mytype == 'Notebook' : labels = [ ] last_active_term = [ ] for tabnum in range ( 0 , self . get_n_pages ( ) ) : page = self . get_nth_page ( tabnum ) label = self . get_tab_label ( page ) labels . append ( label . get_custom_label ( ) ) last_active_term . append ( self . last_active_term [ self . get_nth_page ( tabnum ) ] ) layout [ 'labels' ] = labels layout [ 'last_active_term' ] = last_active_term layout [ 'active_page' ] = self . get_current_page ( ) else : if hasattr ( self , 'last_active_term' ) and self . last_active_term is not None : layout [ 'last_active_term' ] = self . last_active_term if mytype == 'Window' : if self . uuid == self . terminator . last_active_window : layout [ 'last_active_window' ] = True else : layout [ 'last_active_window' ] = False name = 'child%d' % count count = count + 1 global_layout [ name ] = layout child_order = 0 for child in self . get_children ( ) : if hasattr ( child , 'describe_layout' ) : count = child . describe_layout ( count , name , global_layout , child_order ) child_order = child_order + 1 return ( count )