(self, newdict, rows=None, columns=None)
return
Create table model
Create table model
Create table model
def setupModel(self, newdict, rows=None, columns=None):
        """Create table model"""

        if newdict != None:
            self.data = copy.deepcopy(newdict)
            for k in self.keywords:
                if k in self.data:
                    self.__dict__[self.keywords[k]] = self.data[k]
                    del self.data[k]
            #read in the record list order
            if 'reclist' in self.data:
                temp = self.data['reclist']
                del self.data['reclist']
                self.reclist = temp
            else:
                self.reclist = self.data.keys()
        else:
            #just make a new empty model
            self.createEmptyModel()

        if not set(self.reclist) == set(self.data.keys()):
            print ('reclist does not match data keys')
        #restore last column order
        if hasattr(self, 'columnOrder') and self.columnOrder != None:
            self.columnNames=[]
            for i in self.columnOrder.keys():
                self.columnNames.append(self.columnOrder[i])
                i=i+1
        self.defaulttypes = ['text', 'number']
        #setup default display for column types
        self.default_display = {'text' : 'showstring',
                                'number' : 'numtostring'}
        #set default sort order as first col
        if len(self.columnNames)>0:
            self.sortkey = self.columnNames[0]
        else:
            self.sortkey = None
        #add rows and cols if they are given in the constructor
        if newdict == None:
            if rows != None:
                self.autoAddRows(rows)
            if columns != None:
                self.autoAddColumns(columns)
        self.filteredrecs = None
        return
def setupModel ( self , newdict , rows = None , columns = None ) : if newdict != None : self . data = copy . deepcopy ( newdict ) for k in self . keywords : if k in self . data : self . __dict__ [ self . keywords [ k ] ] = self . data [ k ] del self . data [ k ] #read in the record list order if 'reclist' in self . data : temp = self . data [ 'reclist' ] del self . data [ 'reclist' ] self . reclist = temp else : self . reclist = self . data . keys ( ) else : #just make a new empty model self . createEmptyModel ( ) if not set ( self . reclist ) == set ( self . data . keys ( ) ) : print ( 'reclist does not match data keys' ) #restore last column order if hasattr ( self , 'columnOrder' ) and self . columnOrder != None : self . columnNames = [ ] for i in self . columnOrder . keys ( ) : self . columnNames . append ( self . columnOrder [ i ] ) i = i + 1 self . defaulttypes = [ 'text' , 'number' ] #setup default display for column types self . default_display = { 'text' : 'showstring' , 'number' : 'numtostring' } #set default sort order as first col if len ( self . columnNames ) > 0 : self . sortkey = self . columnNames [ 0 ] else : self . sortkey = None #add rows and cols if they are given in the constructor if newdict == None : if rows != None : self . autoAddRows ( rows ) if columns != None : self . autoAddColumns ( columns ) self . filteredrecs = None return