(self, name, toclone)
Add a profile
Add a profile
Add a profile
def addprofile(self, name, toclone):
        """Add a profile"""
        guiget = self.builder.get_object

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

        newprofile = name
        if newprofile in values:
            i = 1
            while newprofile in values:
                i = i + 1
                newprofile = '%s %d' % (name, i)

        if self.config.add_profile(newprofile, toclone):
            res = model.append([newprofile, True])
            if res:
                path = model.get_path(res)
                treeview.set_cursor(path, column=treeview.get_column(0),
                                    start_editing=True)

        self.layouteditor.update_profiles()
def addprofile ( self , name , toclone ) : guiget = self . builder . get_object treeview = guiget ( 'profilelist' ) model = treeview . get_model ( ) values = [ r [ 0 ] for r in model ] newprofile = name if newprofile in values : i = 1 while newprofile in values : i = i + 1 newprofile = '%s %d' % ( name , i ) if self . config . add_profile ( newprofile , toclone ) : res = model . append ( [ newprofile , True ] ) if res : path = model . get_path ( res ) treeview . set_cursor ( path , column = treeview . get_column ( 0 ) , start_editing = True ) self . layouteditor . update_profiles ( )