add support from simple auto top of frame flowables version-->3.2.9
authorrobin
Mon, 05 Oct 2015 16:20:47 +0100
changeset 4228 fd5bbccc7758
parent 4227 89285b665c3f
child 4230 5e8bf4c145be
add support from simple auto top of frame flowables version-->3.2.9
src/reportlab/__init__.py
src/reportlab/platypus/doctemplate.py
src/reportlab/platypus/flowables.py
--- a/src/reportlab/__init__.py	Thu Sep 03 14:59:27 2015 +0100
+++ b/src/reportlab/__init__.py	Mon Oct 05 16:20:47 2015 +0100
@@ -1,9 +1,9 @@
 #Copyright ReportLab Europe Ltd. 2000-2015
 #see license.txt for license details
 __doc__="""The Reportlab PDF generation library."""
-Version = "3.2.8"
+Version = "3.2.9"
 __version__=Version
-__date__='20150903'
+__date__='20151005'
 
 import sys, os, imp
 
--- a/src/reportlab/platypus/doctemplate.py	Thu Sep 03 14:59:27 2015 +0100
+++ b/src/reportlab/platypus/doctemplate.py	Mon Oct 05 16:20:47 2015 +0100
@@ -315,7 +315,6 @@
         flowables[0:0] = S
         del frame._generated_content
 
-
 class onDrawStr(str):
     def __new__(cls,value,onDraw,label,kind=None):
         self = str.__new__(cls,value)
@@ -516,6 +515,7 @@
         #context sensitive margins - set by story, not from outside
         self._leftExtraIndent = 0.0
         self._rightExtraIndent = 0.0
+        self._topFlowables = []
         self._frameBGs = []
 
         self._calc()
@@ -648,6 +648,8 @@
         f._leftExtraIndent = self._leftExtraIndent
         f._rightExtraIndent = self._rightExtraIndent
         f._frameBGs = self._frameBGs
+        if self._topFlowables:
+            self._hanging.extend(self._topFlowables)
 
     def handle_frameEnd(self,resume=0):
         ''' Handles the semantics of the end of a frame. This includes the selection of
--- a/src/reportlab/platypus/flowables.py	Thu Sep 03 14:59:27 2015 +0100
+++ b/src/reportlab/platypus/flowables.py	Mon Oct 05 16:20:47 2015 +0100
@@ -1980,3 +1980,17 @@
         if bool(self.funcWrap(aW,aH)):
             self.add_content(*(list(self.block)+[self]))
         return 0,0
+
+class SetTopFlowables(NullDraw):
+    _ZEROZSIZE = 1
+    def __init__(self,F,show=False):
+        self._F = F
+        self._show = show
+
+    def wrap(self,aW,aH):
+        doc = getattr(getattr(self,'canv',None),'_doctemplate',None)
+        if doc:
+            doc._topFlowables=self._F
+            if self._show and self._F:
+                doc.frame._generated_content = self._F
+        return 0,0