reportlab/platypus/doctemplate.py
changeset 1669 31cb4c337e0d
parent 1668 448a9205be12
child 1672 d16919470fea
equal deleted inserted replaced
1668:448a9205be12 1669:31cb4c337e0d
     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.53 2002/07/07 22:29:02 andy_robinson Exp $
     4 #$Header: /tmp/reportlab/reportlab/platypus/doctemplate.py,v 1.54 2002/07/09 16:47:43 rgbecker Exp $
     5 
     5 
     6 __version__=''' $Id: doctemplate.py,v 1.53 2002/07/07 22:29:02 andy_robinson Exp $ '''
     6 __version__=''' $Id: doctemplate.py,v 1.54 2002/07/09 16:47:43 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.
   732 		if onLaterPages is _doNothing and hasattr(self,'onLaterPages'):
   732 		if onLaterPages is _doNothing and hasattr(self,'onLaterPages'):
   733 			self.pageTemplates[1].beforeDrawPage = self.onLaterPages
   733 			self.pageTemplates[1].beforeDrawPage = self.onLaterPages
   734 		BaseDocTemplate.build(self,flowables)
   734 		BaseDocTemplate.build(self,flowables)
   735 
   735 
   736 
   736 
       
   737 def progressCB(typ, value):
       
   738 	"""Example prototype for progress monitoring.
       
   739 
       
   740 	This aims to provide info about what is going on
       
   741 	during a big job.  It should enable, for example, a reasonably
       
   742 	smooth progress bar to be drawn.  We design the argument
       
   743 	signature to be predictable and conducive to programming in
       
   744 	other (type safe) languages.  If set, this will be called
       
   745 	repeatedly with pairs of values.  The first is a string
       
   746 	indicating the type of call; the second is a numeric value.
       
   747 
       
   748 	typ 'STARTING', value = 0
       
   749 	typ 'SIZE_EST', value = numeric estimate of job size
       
   750 	typ 'PASS', value = number of this rendering pass
       
   751 	typ 'PROGRESS', value = number between 0 and SIZE_EST
       
   752 	typ 'PAGE', value = page number of page
       
   753 	type 'FINISHED', value = 0
       
   754 
       
   755 	The sequence is
       
   756 		STARTING - always called once
       
   757 		SIZE_EST - always called once
       
   758 		PROGRESS - called often
       
   759 		PAGE - called often when page is emitted
       
   760 		FINISHED - called when really, really finished
       
   761 	
       
   762 	some juggling is needed to accurately estimate numbers of
       
   763 	pages in pageDrawing mode.
       
   764 
       
   765 	NOTE: the SIZE_EST is a guess.  It is possible that the
       
   766 	PROGRESS value may slightly exceed it, or may even step
       
   767 	back a little on rare occasions.  The only way to be
       
   768 	really accurate would be to do two passes, and I don't
       
   769 	want to take that performance hit.
       
   770 	"""
       
   771 	print 'PROGRESS MONITOR:  %-10s   %d' % (typ, value)
       
   772 
       
   773 
   737 	##########################################################
   774 	##########################################################
   738 	##
   775 	##
   739 	##	 testing
   776 	##	 testing
   740 	##
   777 	##
   741 	##########################################################
   778 	##########################################################