dabo Commit
Revision 4035
Date: 2008-04-14 11:20:08 -0700 (Mon, 14 Apr 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4035

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

Log:
If you have two groups that both want to start on a new page, 2 new pages
would happen instead of the expected 1. Fixed.

Also reworked slightly the drawing of images, to not hide exceptions
raised from reportlab.
 
 


Diff:
Modified: trunk/dabo/lib/reportWriter.py
===================================================================
--- trunk/dabo/lib/reportWriter.py      2008-04-14 18:10:17 UTC (rev 4034)
+++ trunk/dabo/lib/reportWriter.py      2008-04-14 18:20:08 UTC (rev 4035)
@@ -1117,21 +1117,21 @@
                        p.rect(-1, -1, width+2, height+2)
                        c.clipPath(p, stroke=stroke)
        
-                       if mode == "clip":
+                       imageFile = obj.getProp("expr")
+                       if imageFile and not os.path.exists(imageFile):
+                               imageFile = os.path.join(self.HomeDirectory, 
imageFile)
+                       if imageFile:
+                               imageFile = str(imageFile)      
+
+                       if imageFile and mode == "clip":
                                # Need to set w,h to None for the drawImage, 
which will draw it in its
                                # "natural" state 1:1 pixel:point, which could 
flow out of the object's
                                # width/height, resulting in clipping.
                                width, height = None, None
 
-                       imageFile = obj.getProp("expr")
-                       if not os.path.exists(imageFile):
-                               imageFile = os.path.join(self.HomeDirectory, 
imageFile)
-                       imageFile = str(imageFile)
+                       if imageFile:
+                               c.drawImage(imageFile, 0, 0, width, height, 
mask)
 
-                       try:
-                               c.drawImage(imageFile, 0, 0, width, height, 
mask)
-                       except:
-                               pass
                elif objType == "BarGraph":
                        # Do these imports here so as not to require the huge 
matplotlib unless
                        # necessary (I was unable to get my py2exe configured 
correctly to handle
@@ -1557,16 +1557,18 @@
                        processVariables()
 
                        # print group headers for this group if necessary:
+                       brandNewPage = False
                        for idx, group in enumerate(groups):
                                vv = self._groupValues[group["expr"]]
                                if vv["curVal"] != group.getProp("expr"):
                                        vv["curVal"] = group.getProp("expr")
                                        np = eval(group.get("startOnNewPage", 
"False")) \
                                                        and self.RecordNumber > 0
-                                       if np:
+                                       if np and not brandNewPage:
                                                endPage()
                                                beginPage()
                                                y = None
+                                               brandNewPage = True  ## don't 
start multiple new pages
                                        y = printBand("groupHeader", y, group)
 
 




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to