(self)
return
Optimally adjust col widths to accomodate the longest entry
            in each column - usually only called  on first redraw
Optimally adjust col widths to accomodate the longest entry
            in each column - usually only called  on first redraw
Optimally adjust col widths to accomodate the longest entry in each column - usually only called on first redraw
def adjustColumnWidths(self):
        """Optimally adjust col widths to accomodate the longest entry
            in each column - usually only called  on first redraw"""

        #self.cols = self.model.getColumnCount()
        try:
            fontsize = self.thefont[1]
        except:
            fontsize = self.fontsize
        scale = 8.5 * float(fontsize)/12
        for col in range(self.cols):
            colname = self.model.getColumnName(col)
            if colname in self.model.columnwidths:
                w = self.model.columnwidths[colname]
            else:
                w = self.cellwidth
            maxlen = self.model.getlongestEntry(col)
            size = maxlen * scale
            if size < w:
                continue
            #print col, size, self.cellwidth
            if size >= self.maxcellwidth:
                size = self.maxcellwidth
            self.model.columnwidths[colname] = size + float(fontsize)/12*6
        return
def adjustColumnWidths ( self ) : #self.cols = self.model.getColumnCount() try : fontsize = self . thefont [ 1 ] except : fontsize = self . fontsize scale = 8.5 * float ( fontsize ) / 12 for col in range ( self . cols ) : colname = self . model . getColumnName ( col ) if colname in self . model . columnwidths : w = self . model . columnwidths [ colname ] else : w = self . cellwidth maxlen = self . model . getlongestEntry ( col ) size = maxlen * scale if size < w : continue #print col, size, self.cellwidth if size >= self . maxcellwidth : size = self . maxcellwidth self . model . columnwidths [ colname ] = size + float ( fontsize ) / 12 * 6 return