added SetPageTopFlowables; version --> 3.4.6
authorrobin <robin@reportlab.com>
Mon, 27 Mar 2017 15:03:20 +0100
changeset 4347 761e190b40af
parent 4346 081acecbf8f6
child 4348 c3ad4608fd48
added SetPageTopFlowables; version --> 3.4.6
src/reportlab/__init__.py
src/reportlab/platypus/doctemplate.py
src/reportlab/platypus/flowables.py
--- a/src/reportlab/__init__.py	Fri Mar 24 16:38:01 2017 +0000
+++ b/src/reportlab/__init__.py	Mon Mar 27 15:03:20 2017 +0100
@@ -1,9 +1,9 @@
 #Copyright ReportLab Europe Ltd. 2000-2017
 #see license.txt for license details
 __doc__="""The Reportlab PDF generation library."""
-Version = "3.4.5"
+Version = "3.4.6"
 __version__=Version
-__date__='20170324'
+__date__='20170327'
 
 import sys, os
 
--- a/src/reportlab/platypus/doctemplate.py	Fri Mar 24 16:38:01 2017 +0000
+++ b/src/reportlab/platypus/doctemplate.py	Mon Mar 27 15:03:20 2017 +0100
@@ -529,6 +529,7 @@
         self._leftExtraIndent = 0.0
         self._rightExtraIndent = 0.0
         self._topFlowables = []
+        self._pageTopFlowables = []
         self._frameBGs = []
 
         self._calc()
@@ -585,7 +586,7 @@
             del self._nextFrameIndex
         self.frame = self.pageTemplate.frames[0]
         self.frame._debug = self._debug
-        self.handle_frameBegin()
+        self.handle_frameBegin(pageTopFlowables=self._pageTopFlowables)
 
     def _setPageTemplate(self):
         if hasattr(self,'_nextPageTemplateCycle'):
@@ -652,7 +653,7 @@
             while len(self._hanging)==n:
                 self.handle_frameEnd()
 
-    def handle_frameBegin(self,resume=0):
+    def handle_frameBegin(self,resume=0,pageTopFlowables=None):
         '''What to do at the beginning of a frame'''
         f = self.frame
         if f._atTop:
@@ -661,6 +662,8 @@
         f._leftExtraIndent = self._leftExtraIndent
         f._rightExtraIndent = self._rightExtraIndent
         f._frameBGs = self._frameBGs
+        if pageTopFlowables:
+            self._hanging.extend(pageTopFlowables)
         if self._topFlowables:
             self._hanging.extend(self._topFlowables)
 
--- a/src/reportlab/platypus/flowables.py	Fri Mar 24 16:38:01 2017 +0000
+++ b/src/reportlab/platypus/flowables.py	Mon Mar 27 15:03:20 2017 +0100
@@ -40,7 +40,7 @@
             PageBreakIfNotEmpty CondPageBreak KeepTogether Macro CallerMacro ParagraphAndImage FailOnWrap
             FailOnDraw HRFlowable PTOContainer KeepInFrame ImageAndFlowables AnchorFlowable FrameBG
             FrameSplitter BulletDrawer DDIndenter LIIndenter ListItem ListFlowable TopPadder DocAssign
-            DocExec DocPara DocAssert DocIf DocWhile SetTopFlowables splitLines splitLine
+            DocExec DocPara DocAssert DocIf DocWhile SetTopFlowables splitLines splitLine SetPageTopFlowables
             BalancedColumns'''.split()
 
 class TraceInfo:
@@ -2237,7 +2237,21 @@
     def wrap(self,aW,aH):
         doc = getattr(getattr(self,'canv',None),'_doctemplate',None)
         if doc:
-            doc._topFlowables=self._F
+            doc._topFlowables = self._F
             if self._show and self._F:
                 doc.frame._generated_content = self._F
         return 0,0
+
+class SetPageTopFlowables(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._pageTopFlowables = self._F
+            if self._show and self._F:
+                doc.frame._generated_content = self._F
+        return 0,0