Push canvas into flowables during wrap/split
authorrgbecker
Thu, 06 Jul 2000 12:40:38 +0000
changeset 325 d3e82931bd56
parent 324 11a8568f6df7
child 326 159576a5816e
Push canvas into flowables during wrap/split
reportlab/platypus/doctemplate.py
reportlab/platypus/frames.py
--- a/reportlab/platypus/doctemplate.py	Wed Jul 05 16:07:00 2000 +0000
+++ b/reportlab/platypus/doctemplate.py	Thu Jul 06 12:40:38 2000 +0000
@@ -31,9 +31,12 @@
 #
 ###############################################################################
 #	$Log: doctemplate.py,v $
+#	Revision 1.25  2000/07/06 12:40:37  rgbecker
+#	Push canvas into flowables during wrap/split
+#
 #	Revision 1.24  2000/07/05 12:22:21  rgbecker
 #	Force _calc in SimpleDocTemplae.build
-#
+#	
 #	Revision 1.23  2000/07/03 15:39:51  rgbecker
 #	Documentation fixes
 #	
@@ -105,7 +108,7 @@
 #	Revision 1.1  2000/05/12 12:53:33  rgbecker
 #	Initial try at a document template class
 #	
-__version__=''' $Id: doctemplate.py,v 1.24 2000/07/05 12:22:21 rgbecker Exp $ '''
+__version__=''' $Id: doctemplate.py,v 1.25 2000/07/06 12:40:37 rgbecker Exp $ '''
 __doc__="""
 This module contains the core structure of platypus.
 
@@ -443,7 +446,7 @@
 			else:
 				if self.allowSplitting:
 					# see if this is a splittable thing
-					S = self.frame.split(f)
+					S = self.frame.split(f,self.canv)
 					n = len(S)
 				else:
 					n = 0
--- a/reportlab/platypus/frames.py	Wed Jul 05 16:07:00 2000 +0000
+++ b/reportlab/platypus/frames.py	Thu Jul 06 12:40:38 2000 +0000
@@ -31,13 +31,16 @@
 #
 ###############################################################################
 #	$Log: frames.py,v $
+#	Revision 1.3  2000/07/06 12:40:38  rgbecker
+#	Push canvas into flowables during wrap/split
+#
 #	Revision 1.2  2000/06/13 13:03:31  aaron_watters
 #	more documentation changes
-#
+#	
 #	Revision 1.1  2000/06/01 15:23:06  rgbecker
 #	Platypus re-organisation
 #	
-__version__=''' $Id: frames.py,v 1.2 2000/06/13 13:03:31 aaron_watters Exp $ '''
+__version__=''' $Id: frames.py,v 1.3 2000/07/06 12:40:38 rgbecker Exp $ '''
 __doc__="""
 """
 class Frame:
@@ -117,7 +120,9 @@
 		s = self.atTop and 0 or flowable.getSpaceBefore()
 		h = y - p - s
 		if h>0:
+			flowable.canv = canv #so they can use stringWidth etc
 			w, h = flowable.wrap(self.width, h)
+			del flowable.canv
 		else:
 			return 0
 
@@ -138,12 +143,15 @@
 
 	add = _add
 
-	def split(self,flowable):
+	def split(self,flowable,canv):
 		'''As the flowable to split using up the available space.'''
 		y = self.y
 		p = self.y1p
 		s = self.atTop and 0 or flowable.getSpaceBefore()
-		return flowable.split(self.width, y-p-s)
+		flowable.canv = canv	#some flowables might need this
+		r = flowable.split(self.width, y-p-s)
+		del flowable.canv
+		return r
 
 
 	def drawBoundary(self,canv):