Made imageCaching a positive quantity and proeprty of the canvas
authorrgbecker
Wed, 21 Mar 2001 14:12:02 +0000
changeset 735 5dffc9c425d6
parent 734 8a205011f053
child 736 b8a3d767415a
Made imageCaching a positive quantity and proeprty of the canvas
docs/userguide/ch6_tables.py
docs/userguide/ch7_custom.py
reportlab/pdfgen/canvas.py
reportlab/pdfgen/pdfimages.py
reportlab/platypus/tables.py
reportlab/rl_config.py
--- a/docs/userguide/ch6_tables.py	Tue Mar 20 17:22:39 2001 +0000
+++ b/docs/userguide/ch6_tables.py	Wed Mar 21 14:12:02 2001 +0000
@@ -1,7 +1,7 @@
 #copyright ReportLab Inc. 2000
 #see license.txt for license details
 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/docs/userguide/ch6_tables.py?cvsroot=reportlab
-#$Header: /tmp/reportlab/docs/userguide/ch6_tables.py,v 1.16 2000/10/25 08:57:45 rgbecker Exp $
+#$Header: /tmp/reportlab/docs/userguide/ch6_tables.py,v 1.17 2001/03/21 14:12:02 rgbecker Exp $
 from genuserguide import *
 from reportlab.platypus import Image
 
@@ -224,7 +224,6 @@
 I = Image('%s')
 I.drawHeight = 1.25*inch*I.drawHeight / I.drawWidth
 I.drawWidth = 1.25*inch
-I.noImageCaching = 1
 P0 = Paragraph('''
                <b>A pa<font color=red>r</font>a<i>graph</i></b>
                <super><font color=yellow>1</font></super>''',
--- a/docs/userguide/ch7_custom.py	Tue Mar 20 17:22:39 2001 +0000
+++ b/docs/userguide/ch7_custom.py	Wed Mar 21 14:12:02 2001 +0000
@@ -1,7 +1,7 @@
 #copyright ReportLab Inc. 2000
 #see license.txt for license details
 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/docs/userguide/ch7_custom.py?cvsroot=reportlab
-#$Header: /tmp/reportlab/docs/userguide/ch7_custom.py,v 1.6 2000/10/25 08:57:45 rgbecker Exp $
+#$Header: /tmp/reportlab/docs/userguide/ch7_custom.py,v 1.7 2001/03/21 14:12:02 rgbecker Exp $
 from genuserguide import *
 
 heading1("Writing your own $Flowable$ Objects")
@@ -78,5 +78,4 @@
 		self.canv.rotate(90)
 		Image.draw(self)
 I = RotatedImage('%s')
-I.noImageCaching = 1
 """ % I,'I')
--- a/reportlab/pdfgen/canvas.py	Tue Mar 20 17:22:39 2001 +0000
+++ b/reportlab/pdfgen/canvas.py	Wed Mar 21 14:12:02 2001 +0000
@@ -1,8 +1,8 @@
 #copyright ReportLab Inc. 2000
 #see license.txt for license details
 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/pdfgen/canvas.py?cvsroot=reportlab
-#$Header: /tmp/reportlab/reportlab/pdfgen/canvas.py,v 1.70 2001/03/16 14:51:50 rgbecker Exp $
-__version__=''' $Id: canvas.py,v 1.70 2001/03/16 14:51:50 rgbecker Exp $ '''
+#$Header: /tmp/reportlab/reportlab/pdfgen/canvas.py,v 1.71 2001/03/21 14:12:02 rgbecker Exp $
+__version__=''' $Id: canvas.py,v 1.71 2001/03/21 14:12:02 rgbecker Exp $ '''
 __doc__=""" 
 The Canvas object is the primary interface for creating PDF files. See
 doc/userguide.pdf for copious examples.
@@ -136,6 +136,7 @@
         #to also set the text matrix accordingly.  You can now choose your
         #drawing coordinates.
         self.bottomup = bottomup
+        self.imageCaching = rl_config.defaultImageCaching
         self._make_preamble()
 
         #initial graphics state
@@ -1045,7 +1046,7 @@
                     dataline = outstream.read(60)
                 imagedata.append('EI')
             else:
-                if hasattr(self,'noImageCaching') and self.noImageCaching:
+                if not self.imageCaching:
                     imagedata = pdfutils.cacheImageFile(image,returnInMemory=1)
                 else:
                     if not pdfutils.cachedImageExists(image):
--- a/reportlab/pdfgen/pdfimages.py	Tue Mar 20 17:22:39 2001 +0000
+++ b/reportlab/pdfgen/pdfimages.py	Wed Mar 21 14:12:02 2001 +0000
@@ -1,8 +1,8 @@
 #copyright ReportLab Inc. 2000
 #see license.txt for license details
 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/pdfgen/pdfimages.py?cvsroot=reportlab
-#$Header: /tmp/reportlab/reportlab/pdfgen/pdfimages.py,v 1.9 2001/03/16 14:47:56 rgbecker Exp $
-__version__=''' $Id: pdfimages.py,v 1.9 2001/03/16 14:47:56 rgbecker Exp $ '''
+#$Header: /tmp/reportlab/reportlab/pdfgen/pdfimages.py,v 1.10 2001/03/21 14:12:02 rgbecker Exp $
+__version__=''' $Id: pdfimages.py,v 1.10 2001/03/21 14:12:02 rgbecker Exp $ '''
 __doc__="""
 Image functionality sliced out of canvas.py for generalization
 """
@@ -13,7 +13,6 @@
 from types import StringType
 from reportlab.pdfbase import pdfutils
 from reportlab.lib.utils import fp_str
-
 from reportlab.lib.utils import import_zlib, import_Image
 
 class PDFImage:
@@ -106,8 +105,7 @@
             if os.path.splitext(image)[1] in ['.jpg', '.JPG', '.jpeg', '.JPEG']:
                 (imagedata, imgwidth, imgheight) = self.jpg_imagedata()
             else:
-                if hasattr(self,'noImageCaching') and self.noImageCaching \
-					or hasattr(canvas,'noImageCaching') and canvas.noImageCaching:
+                if not canvas.imageCaching:
                     imagedata = pdfutils.cacheImageFile(image,returnInMemory=1)
                 else:
                     imagedata = self.cache_imagedata()
--- a/reportlab/platypus/tables.py	Tue Mar 20 17:22:39 2001 +0000
+++ b/reportlab/platypus/tables.py	Wed Mar 21 14:12:02 2001 +0000
@@ -1,8 +1,8 @@
 #copyright ReportLab Inc. 2000
 #see license.txt for license details
 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/platypus/tables.py?cvsroot=reportlab
-#$Header: /tmp/reportlab/reportlab/platypus/tables.py,v 1.36 2001/03/19 23:48:00 aaron_watters Exp $
-__version__=''' $Id: tables.py,v 1.36 2001/03/19 23:48:00 aaron_watters Exp $ '''
+#$Header: /tmp/reportlab/reportlab/platypus/tables.py,v 1.37 2001/03/21 14:12:02 rgbecker Exp $
+__version__=''' $Id: tables.py,v 1.37 2001/03/21 14:12:02 rgbecker Exp $ '''
 __doc__="""
 Tables are created by passing the constructor a tuple of column widths, a tuple of row heights and the data in
 row order. Drawing of the table can be controlled by using a TableStyle instance. This allows control of the
@@ -931,7 +931,6 @@
 	I = Image(os.path.join(os.path.dirname(reportlab.platypus.__file__),'..','demos','pythonpoint','leftlogo.gif'))
 	I.drawHeight = 1.25*inch*I.drawHeight / I.drawWidth
 	I.drawWidth = 1.25*inch
-	I.noImageCaching = 1
 	P = Paragraph("<para align=center spaceb=3>The <b>ReportLab Left <font color=red>Logo</font></b> Image</para>", styleSheet["BodyText"])
 	data=  [['A', 'B', 'C', Paragraph("<b>A pa<font color=red>r</font>a<i>graph</i></b><super><font color=yellow>1</font></super>",styleSheet["BodyText"]), 'D'],
 			['00', '01', '02', [I,P], '04'],
--- a/reportlab/rl_config.py	Tue Mar 20 17:22:39 2001 +0000
+++ b/reportlab/rl_config.py	Wed Mar 21 14:12:02 2001 +0000
@@ -4,6 +4,8 @@
 defaultEncoding = 'WinAnsiEncoding'		# 'WinAnsi' or 'MacRoman'
 defaultPageSize=pagesizes.A4			#check in reportlab/lib/pagesizes for other possibilities
 
+defaultImageCaching = 1					#set to zero to remove those annoying cached images
+
 #places to search for Type 1 Font files
 if sys.platform=='win32':
 	T1SearchPathPath=['c:\\Program Files\\Adobe\\Acrobat 4.0\\Resource\\Font']