commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7742 - trunk/gnue-common/src/printing/pdftable


From: jamest
Subject: [gnue] r7742 - trunk/gnue-common/src/printing/pdftable
Date: Thu, 21 Jul 2005 14:43:42 -0500 (CDT)

Author: jamest
Date: 2005-07-21 14:43:40 -0500 (Thu, 21 Jul 2005)
New Revision: 7742

Modified:
   trunk/gnue-common/src/printing/pdftable/pdftable.py
Log:
added bottom/top border support
fixed last column ending x coord


Modified: trunk/gnue-common/src/printing/pdftable/pdftable.py
===================================================================
--- trunk/gnue-common/src/printing/pdftable/pdftable.py 2005-07-20 11:54:10 UTC 
(rev 7741)
+++ trunk/gnue-common/src/printing/pdftable/pdftable.py 2005-07-21 19:43:40 UTC 
(rev 7742)
@@ -191,7 +191,8 @@
   # Define a column on the report
   # --------------------------------------------------------------------------
   def addColumn(self, align, minSize, overflow="", highlight=None, 
-                leftBorder=0, rightBorder=0, sectionType="default"):    
+                leftBorder=0, rightBorder=0, topBorder=0, bottomBorder=0,
+                sectionType="default"):    
     """
     Defines a column on the record for the specified section
     
@@ -200,7 +201,9 @@
                      large for the column width.
     @param highlight: The color of background to use in this column.
     @param leftBorder: The width of the left side border in points.
-    @param rightBorder: The width of the right side border in points.   
+    @param rightBorder: The width of the right side border in points.
+    @param topBorder: The width of the top side border in points.
+    @param bottomBorder: The width of the bottom side border in points.        
   
     @param sectionType: The name of the section to which this column should be 
added.
     """
     try:
@@ -213,6 +216,8 @@
                                        'columnCoords'     :[],
                                        'columnLeftBorder' :[],
                                        'columnRightBorder':[],
+                                       'columnTopBorder'  :[],
+                                       'columnBottomBorder':[],
                                        'headerList':    [[]],                  
                  
                                     }
       secType = self.definedSectionTypes[sectionType]
@@ -223,6 +228,8 @@
     secType['columnHighlight'].append(highlight)
     secType['columnLeftBorder'].append(leftBorder)
     secType['columnRightBorder'].append(rightBorder)
+    secType['columnTopBorder'].append(topBorder)
+    secType['columnBottomBorder'].append(bottomBorder)
 
   # ==========================================================================
   # Section level functions
@@ -350,8 +357,12 @@
       self.drawHorizBorderedBox(leftmargin, boxy, self.width-leftmargin*2,
                                 boxh, subtotalColor, lines=lineWidth * 
self.scale)
     elif highlighted:
+      # If there is a bottom border we need to not draw over the top
+      # of the previous rows border.  Currently minimum must be 1 point      
+      adjustment = max([self._currentSection['columnBottomBorder'][0],1])
+      print adjustment
       self.drawHorizBorderedBox(leftmargin, boxy, self.width-leftmargin*2,
-                                boxh, highlightColor, lines=0)
+                                boxh-adjustment, highlightColor, lines=0)
 
     canvas.setFont(font, size)
 
@@ -367,7 +378,7 @@
       if i < len(self._currentSection['columnCoords'])-1:
         hlx2 = self._currentSection['columnCoords'][i+1][0]-self.columnGap/2.0
       else:
-        hlx2 = self.width-leftmargin*2
+        hlx2 = self.width-leftmargin
       
       # Column highlight support          
       highlightColumn = self._currentSection['columnHighlight'][i]
@@ -380,13 +391,13 @@
           color = colors.Blacker(highlightColor,.98)
         else:
           color = highlightColumn
-          
-        self.drawHorizBorderedBox(hlx1, boxy - adjust, hlx2-hlx1, boxh, 
+        
+        self.drawHorizBorderedBox(hlx1, boxy - adjust, 
+                                  hlx2-hlx1, boxh, 
                                   color, lines=0)
       
       # Column border support
-      leftBorder = self._currentSection['columnLeftBorder'][i]
-      
+      leftBorder = self._currentSection['columnLeftBorder'][i]      
       if leftBorder:
         canvas.setLineWidth(leftBorder*self.scale)
         canvas.line(hlx1, boxy, hlx1, boxy + boxh)
@@ -395,7 +406,17 @@
       if rightBorder:
         canvas.setLineWidth(rightBorder*self.scale)
         canvas.line(hlx2, boxy, hlx2, boxy + boxh)
-      
+
+      topBorder =self._currentSection['columnTopBorder'][i]
+      if topBorder:
+        canvas.setLineWidth(topBorder*self.scale)
+        canvas.line(hlx1, boxy + boxh, hlx2, boxy + boxh)
+
+      bottomBorder = self._currentSection['columnBottomBorder'][i]
+      if bottomBorder:
+        canvas.setLineWidth(bottomBorder*self.scale)
+        canvas.line(hlx1, boxy, hlx2, boxy)
+                      
       if col:      
         align= self._currentSection['columnAligns'][i]
         x1, x2 = self._currentSection['columnCoords'][i]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]