src/reportlab/graphics/widgets/table.py
branchpy33
changeset 3721 0c93dd8ff567
parent 3617 ae5744e97c42
child 3723 99aa837b6703
equal deleted inserted replaced
3720:7a059dde5bf5 3721:0c93dd8ff567
    60         self.fontColor = colors.black
    60         self.fontColor = colors.black
    61         self.alignment = 'right'
    61         self.alignment = 'right'
    62         self.textAnchor = 'start'
    62         self.textAnchor = 'start'
    63 
    63 
    64 
    64 
    65         for k, v in kw.items():
    65         for k, v in list(kw.items()):
    66             if k in self.__class__._attrMap.keys():
    66             if k in list(self.__class__._attrMap.keys()):
    67                 setattr(self, k, v)
    67                 setattr(self, k, v)
    68                 print 'setting %s = %s'%(k, v)
    68                 print('setting %s = %s'%(k, v))
    69             else:
    69             else:
    70                 raise ValueError('invalid argument supplied for class %s'%self.__class__)
    70                 raise ValueError('invalid argument supplied for class %s'%self.__class__)
    71 
    71 
    72     def demo(self):
    72     def demo(self):
    73         """ returns a sample of this widget with data
    73         """ returns a sample of this widget with data
   102         row_step = self.height / float(rows)
   102         row_step = self.height / float(rows)
   103         col_step = self.width / float(cols)
   103         col_step = self.width / float(cols)
   104         #print "(row_step,col_step)=(%s, %s)"%(row_step,col_step)
   104         #print "(row_step,col_step)=(%s, %s)"%(row_step,col_step)
   105         # draw the grid
   105         # draw the grid
   106         if self.horizontalDividerStrokeColor:
   106         if self.horizontalDividerStrokeColor:
   107             for i in xrange(rows): # make horizontal lines
   107             for i in range(rows): # make horizontal lines
   108                 x1 = self.x
   108                 x1 = self.x
   109                 x2 = self.x + self.width
   109                 x2 = self.x + self.width
   110                 y = self.y + row_step*i
   110                 y = self.y + row_step*i
   111                 #print 'line (%s, %s), (%s, %s)'%(x1, y, x2, y)
   111                 #print 'line (%s, %s), (%s, %s)'%(x1, y, x2, y)
   112                 line = shapes.Line(x1, y, x2, y)
   112                 line = shapes.Line(x1, y, x2, y)
   113                 line.strokeDashArray = self.dividerDashArray
   113                 line.strokeDashArray = self.dividerDashArray
   114                 line.strokeWidth = self.horizontalDividerStrokeWidth
   114                 line.strokeWidth = self.horizontalDividerStrokeWidth
   115                 line.strokeColor = self.horizontalDividerStrokeColor
   115                 line.strokeColor = self.horizontalDividerStrokeColor
   116                 g.add(line)
   116                 g.add(line)
   117         if self.verticalDividerStrokeColor:
   117         if self.verticalDividerStrokeColor:
   118             for i in xrange(cols): # make vertical lines
   118             for i in range(cols): # make vertical lines
   119                 x = self.x+col_step*i
   119                 x = self.x+col_step*i
   120                 y1 = self.y
   120                 y1 = self.y
   121                 y2 = self.y + self.height
   121                 y2 = self.y + self.height
   122                 #print 'line (%s, %s), (%s, %s)'%(x, y1, x, y2)
   122                 #print 'line (%s, %s), (%s, %s)'%(x, y1, x, y2)
   123                 line = shapes.Line(x, y1, x, y2)
   123                 line = shapes.Line(x, y1, x, y2)