(self, _button)
Add a new layout to the list
Add a new layout to the list
Add a new layout to the list
def on_layoutaddbutton_clicked(self, _button):
        """Add a new layout to the list"""
        terminator = Terminator()
        current_layout = terminator.describe_layout()
        guiget = self.builder.get_object

        treeview = guiget('layoutlist')
        model = treeview.get_model()
        values = [ r[0] for r in model ]

        name = _('New Layout')
        if name in values:
            i = 0
            while name in values:
                i = i + 1
                name = '%s %d' % (_('New Layout'), i)

        if self.config.add_layout(name, current_layout):
            res = model.append([name, True])
            if res:
                path = model.get_path(res)
                treeview.set_cursor(path, start_editing=True)

        self.config.save()
def on_layoutaddbutton_clicked ( self , _button ) : terminator = Terminator ( ) current_layout = terminator . describe_layout ( ) guiget = self . builder . get_object treeview = guiget ( 'layoutlist' ) model = treeview . get_model ( ) values = [ r [ 0 ] for r in model ] name = _ ( 'New Layout' ) if name in values : i = 0 while name in values : i = i + 1 name = '%s %d' % ( _ ( 'New Layout' ) , i ) if self . config . add_layout ( name , current_layout ) : res = model . append ( [ name , True ] ) if res : path = model . get_path ( res ) treeview . set_cursor ( path , start_editing = True ) self . config . save ( )