tables.py: fix buglet in command adding
authorrgbecker
Fri, 01 Oct 2004 10:40:15 +0000
changeset 2393 6b3e47730acc
parent 2392 6c59b0eb312d
child 2394 0ad681a30b43
tables.py: fix buglet in command adding
reportlab/platypus/tables.py
--- a/reportlab/platypus/tables.py	Wed Sep 29 10:18:32 2004 +0000
+++ b/reportlab/platypus/tables.py	Fri Oct 01 10:40:15 2004 +0000
@@ -601,11 +601,7 @@
             setattr(self,k,v)
 
     def _addCommand(self,cmd):
-        if cmd[0] == 'BACKGROUND':
-            self._bkgrndcmds.append(cmd)
-        if cmd[0] == 'ROWBACKGROUNDS':
-            self._bkgrndcmds.append(cmd)
-        if cmd[0] == 'COLBACKGROUNDS':
+        if cmd[0] in ('BACKGROUND','ROWBACKGROUNDS','COLBACKGROUNDS'):
             self._bkgrndcmds.append(cmd)
         elif cmd[0] == 'SPAN':
             self._spanCmds.append(cmd)
@@ -945,9 +941,6 @@
             canv = self.canv
             if callable(arg):
                 apply(arg,(self,canv, x0, y0, w, h))
-            elif cmd == 'BACKGROUND':
-                canv.setFillColor(colors.toColor(arg))
-                canv.rect(x0, y0, w, h, stroke=0,fill=1)
             elif cmd == 'ROWBACKGROUNDS':
                 #Need a list of colors to cycle through.  The arguments
                 #might be already colours, or convertible to colors, or
@@ -978,7 +971,9 @@
                         canv.setFillColor(color)
                         canv.rect(x0, y0, w, h, stroke=0,fill=1)
                     x0 = x0 +w
-                
+            else:   #cmd=='BACKGROUND'
+                canv.setFillColor(colors.toColor(arg))
+                canv.rect(x0, y0, w, h, stroke=0,fill=1)
 
     def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)):
         if self._curcellstyle is not cellstyle: