Changeset 4035

Show
Ignore:
Timestamp:
04/14/08 11:20:08 (3 months ago)
Author:
paul
Message:

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.



Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/lib/reportWriter.py

    r3887 r4035  
    11181118            c.clipPath(p, stroke=stroke) 
    11191119     
    1120             if mode == "clip": 
     1120            imageFile = obj.getProp("expr") 
     1121            if imageFile and not os.path.exists(imageFile): 
     1122                imageFile = os.path.join(self.HomeDirectory, imageFile) 
     1123            if imageFile: 
     1124                imageFile = str(imageFile)   
     1125 
     1126            if imageFile and mode == "clip": 
    11211127                # Need to set w,h to None for the drawImage, which will draw it in its 
    11221128                # "natural" state 1:1 pixel:point, which could flow out of the object's 
     
    11241130                width, height = None, None 
    11251131 
    1126             imageFile = obj.getProp("expr") 
    1127             if not os.path.exists(imageFile): 
    1128                 imageFile = os.path.join(self.HomeDirectory, imageFile) 
    1129             imageFile = str(imageFile) 
    1130  
    1131             try: 
     1132            if imageFile: 
    11321133                c.drawImage(imageFile, 0, 0, width, height, mask) 
    1133             except: 
    1134                 pass 
     1134 
    11351135        elif objType == "BarGraph": 
    11361136            # Do these imports here so as not to require the huge matplotlib unless 
     
    15581558 
    15591559            # print group headers for this group if necessary: 
     1560            brandNewPage = False 
    15601561            for idx, group in enumerate(groups): 
    15611562                vv = self._groupValues[group["expr"]] 
     
    15641565                    np = eval(group.get("startOnNewPage", "False")) \ 
    15651566                            and self.RecordNumber > 0 
    1566                     if np
     1567                    if np and not brandNewPage
    15671568                        endPage() 
    15681569                        beginPage() 
    15691570                        y = None 
     1571                        brandNewPage = True  ## don't start multiple new pages 
    15701572                    y = printBand("groupHeader", y, group) 
    15711573