dabo Commit
Revision 1398
Date: 2005-10-03 11:21:30 -0700 (Mon, 03 Oct 2005)
Author: paul

Changed:
U   trunk/dabo/lib/reportWriter.py

Log:
The report writer now knows how to draw lines. I had been faking this in my
own reports using rectangles...



Diff:
Modified: trunk/dabo/lib/reportWriter.py
===================================================================
--- trunk/dabo/lib/reportWriter.py      2005-10-03 14:48:59 UTC (rev 1397)
+++ trunk/dabo/lib/reportWriter.py      2005-10-03 18:21:30 UTC (rev 1398)
@@ -220,6 +220,45 @@
                        d.add(r)
                        d.drawOn(c, x, y)
        
+               if object["type"] == "line":
+                       d = shapes.Drawing(width, height)
+                       d.rotate(rotation)
+       
+                       props = {}
+                       ## props available in reportlab that we use:
+                       ##   x,y,width,height
+                       ##   fillColor: None for transparent, or (r,g,b)
+                       ##   strokeColor: None for transparent, or (r,g,b)
+                       ##   strokeDashArray: None
+                       ##   strokeWidth: 0.25
+       
+                       ## props available that we don't currently use:
+                       ##   rx, ry
+                       ##   strokeMiterLimit: 0
+                       ##   strokeLineJoin: 0
+                       ##   strokeLineCap: 0
+                       ##
+       
+                       try:
+                               props["strokeWidth"] = 
self.getPt(eval(object["strokeWidth"]))
+                       except KeyError: 
+                               props["strokeWidth"] = self.default_strokeWidth
+       
+                       try:
+                               props["strokeColor"] = 
eval(object["strokeColor"])
+                       except KeyError:
+                               props["strokeColor"] = self.default_strokeColor
+       
+                       try:
+                               props["strokeDashArray"] = 
eval(object["strokeDashArray"])
+                       except KeyError:
+                               props["strokeDashArray"] = 
self.default_strokeDashArray
+       
+                       r = shapes.Line(0, 0, width, height)
+                       r.setProperties(props)
+                       d.add(r)
+                       d.drawOn(c, x, y)
+       
                elif object["type"] == "string":
                        ## Set the props for strings:
                        try: 




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to