reportlab/platypus/doctemplate.py
changeset 1530 1dedd3370a99
parent 1505 e45994cb76bb
child 1668 448a9205be12
equal deleted inserted replaced
1529:dacdc24dc278 1530:1dedd3370a99
     1 #copyright ReportLab Inc. 2000
     1 #copyright ReportLab Inc. 2000
     2 #see license.txt for license details
     2 #see license.txt for license details
     3 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/platypus/doctemplate.py?cvsroot=reportlab
     3 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/platypus/doctemplate.py?cvsroot=reportlab
     4 #$Header: /tmp/reportlab/reportlab/platypus/doctemplate.py,v 1.51 2002/02/13 16:44:29 rgbecker Exp $
     4 #$Header: /tmp/reportlab/reportlab/platypus/doctemplate.py,v 1.52 2002/03/12 15:18:03 rgbecker Exp $
     5 
     5 
     6 __version__=''' $Id: doctemplate.py,v 1.51 2002/02/13 16:44:29 rgbecker Exp $ '''
     6 __version__=''' $Id: doctemplate.py,v 1.52 2002/03/12 15:18:03 rgbecker Exp $ '''
     7 
     7 
     8 __doc__="""
     8 __doc__="""
     9 This module contains the core structure of platypus.
     9 This module contains the core structure of platypus.
    10 
    10 
    11 Platypus constructs documents.	Document styles are determined by DocumentTemplates.
    11 Platypus constructs documents.	Document styles are determined by DocumentTemplates.
    30 """
    30 """
    31 
    31 
    32 from reportlab.platypus.flowables import *
    32 from reportlab.platypus.flowables import *
    33 from reportlab.platypus.paragraph import Paragraph
    33 from reportlab.platypus.paragraph import Paragraph
    34 from reportlab.platypus.frames import Frame
    34 from reportlab.platypus.frames import Frame
    35 from reportlab.rl_config import defaultPageSize, _verbose
    35 from reportlab.rl_config import defaultPageSize, verbose
    36 import reportlab.lib.sequencer
    36 import reportlab.lib.sequencer
    37 
    37 
    38 from types import *
    38 from types import *
    39 import sys
    39 import sys
    40 
    40 
   580 		for l in self._indexingFlowables:
   580 		for l in self._indexingFlowables:
   581 			l.notify(kind, stuff)
   581 			l.notify(kind, stuff)
   582 
   582 
   583 	def pageRef(self, label):
   583 	def pageRef(self, label):
   584 		"""hook to register a page number"""
   584 		"""hook to register a page number"""
   585 		if _verbose: print "pageRef called with label '%s' on page %d" % (
   585 		if verbose: print "pageRef called with label '%s' on page %d" % (
   586 			label, self.page)
   586 			label, self.page)
   587 		self._pageRefs[label] = self.page
   587 		self._pageRefs[label] = self.page
   588 
   588 
   589 	def multiBuild(self, story,
   589 	def multiBuild(self, story,
   590 				   filename=None,
   590 				   filename=None,
   601 		#print self._indexingFlowables
   601 		#print self._indexingFlowables
   602 		
   602 		
   603 		passes = 0
   603 		passes = 0
   604 		while 1:
   604 		while 1:
   605 			passes = passes + 1
   605 			passes = passes + 1
   606 			if _verbose: print 'building pass '+str(passes) + '...',
   606 			if verbose: print 'building pass '+str(passes) + '...',
   607 
   607 
   608 			for fl in self._indexingFlowables:
   608 			for fl in self._indexingFlowables:
   609 				fl.beforeBuild()
   609 				fl.beforeBuild()
   610 
   610 
   611 			# work with a copy of the story, since it is consumed
   611 			# work with a copy of the story, since it is consumed
   633 			## else:
   633 			## else:
   634 				## print 'failed'
   634 				## print 'failed'
   635 			if passes > maxPasses:
   635 			if passes > maxPasses:
   636 				raise IndexError, "Index entries not resolved after %d passes" % maxPasses
   636 				raise IndexError, "Index entries not resolved after %d passes" % maxPasses
   637 
   637 
   638 		if _verbose: print 'saved'
   638 		if verbose: print 'saved'
   639 
   639 
   640 	#these are pure virtuals override in derived classes
   640 	#these are pure virtuals override in derived classes
   641 	#NB these get called at suitable places by the base class
   641 	#NB these get called at suitable places by the base class
   642 	#so if you derive and override the handle_xxx methods
   642 	#so if you derive and override the handle_xxx methods
   643 	#it's up to you to ensure that they maintain the needed consistency
   643 	#it's up to you to ensure that they maintain the needed consistency