Moved inch and cm definitions to reportlab.lib.units and amended all demos
authorandy_robinson
Wed, 08 Mar 2000 13:06:39 +0000
changeset 42 ba8c232f544e
parent 41 75f8140d039b
child 43 71baccf1c57f
Moved inch and cm definitions to reportlab.lib.units and amended all demos
reportlab/demos/gadflypaper/gfe.py
reportlab/demos/odyssey/odyssey.py
reportlab/lib/colors.py
reportlab/pdfgen/test/testpdfgen.py
reportlab/platypus/layout.py
reportlab/platypus/test/testplatypus.py
reportlab/platypus/test/testtables.py
--- a/reportlab/demos/gadflypaper/gfe.py	Wed Mar 08 13:00:28 2000 +0000
+++ b/reportlab/demos/gadflypaper/gfe.py	Wed Mar 08 13:06:39 2000 +0000
@@ -31,9 +31,12 @@
 #
 ###############################################################################
 #	$Log: gfe.py,v $
+#	Revision 1.6  2000/03/08 13:06:39  andy_robinson
+#	Moved inch and cm definitions to reportlab.lib.units and amended all demos
+#
 #	Revision 1.5  2000/03/02 12:21:20  rgbecker
 #	Added recognition comment
-#
+#	
 #	Revision 1.4  2000/02/17 02:03:53  rgbecker
 #	Docstring & other fixes
 #	
@@ -46,7 +49,7 @@
 #	Revision 1.1.1.1  2000/02/15 15:15:57  rgbecker
 #	Initial setup of demos directory and contents.
 #	
-__version__=''' $Id: gfe.py,v 1.5 2000/03/02 12:21:20 rgbecker Exp $ '''
+__version__=''' $Id: gfe.py,v 1.6 2000/03/08 13:06:39 andy_robinson Exp $ '''
 __doc__=''
 
 #REPORTLAB_TEST_SCRIPT
@@ -73,7 +76,8 @@
 indexed table implementations, dynamic interfaces to remote data
 bases or or other data sources, and user defined computations."""
 
-inch=layout.inch
+from reportlab.lib.units import inch
+
 pageinfo = "%s / %s / %s" % (Author, email, Title)
 
 def myFirstPage(canvas, doc):
--- a/reportlab/demos/odyssey/odyssey.py	Wed Mar 08 13:00:28 2000 +0000
+++ b/reportlab/demos/odyssey/odyssey.py	Wed Mar 08 13:06:39 2000 +0000
@@ -31,9 +31,12 @@
 #
 ###############################################################################
 #	$Log: odyssey.py,v $
+#	Revision 1.6  2000/03/08 13:06:39  andy_robinson
+#	Moved inch and cm definitions to reportlab.lib.units and amended all demos
+#
 #	Revision 1.5  2000/02/18 11:00:57  rgbecker
 #	trailing text/Odyssey fix
-#
+#	
 #	Revision 1.4  2000/02/17 02:05:25  rgbecker
 #	Docstring & other fixes
 #	
@@ -46,7 +49,7 @@
 #	Revision 1.1.1.1  2000/02/15 15:09:29  rgbecker
 #	Initial setup of demos directory and contents.
 #	
-__version__=''' $Id: odyssey.py,v 1.5 2000/02/18 11:00:57 rgbecker Exp $ '''
+__version__=''' $Id: odyssey.py,v 1.6 2000/03/08 13:06:39 andy_robinson Exp $ '''
 ___doc__=''
 #odyssey.py
 #
@@ -69,10 +72,8 @@
 import time
 
 
-#from pagesizes import A4  #from PIDDLE distribution
-A4 = (595.275590551, 841.88976378)
-inch = INCH = 72
-cm = CM = inch / 2.54
+from reportlab.lib.units import inch, cm
+from reportlab.lib.pagesizes import A4
 
 #precalculate some basics
 top_margin = A4[1] - inch
--- a/reportlab/lib/colors.py	Wed Mar 08 13:00:28 2000 +0000
+++ b/reportlab/lib/colors.py	Wed Mar 08 13:06:39 2000 +0000
@@ -1,3 +1,4 @@
+#!/bin/env python
 ###############################################################################
 #
 #	ReportLab Public License Version 1.0
@@ -6,9 +7,9 @@
 #   license is the same as that of Python
 #
 #	(C) Copyright ReportLab Inc. 1998-2000.
+#
 #   adapted with permission from PIDDLE, original author Joe Strout
 #
-#
 # All Rights Reserved
 #
 # Permission to use, copy, modify, and distribute this software and its
@@ -32,9 +33,10 @@
 #
 ###############################################################################
 #	$Log: colors.py,v $
-#	Revision 1.1  2000/03/08 11:27:55  andy_robinson
-#	Initial Checkin
+#	Revision 1.2  2000/03/08 13:06:39  andy_robinson
+#	Moved inch and cm definitions to reportlab.lib.units and amended all demos
 #
+__version__=''' $Id: colors.py,v 1.2 2000/03/08 13:06:39 andy_robinson Exp $ '''
 
 import string
 import math
--- a/reportlab/pdfgen/test/testpdfgen.py	Wed Mar 08 13:00:28 2000 +0000
+++ b/reportlab/pdfgen/test/testpdfgen.py	Wed Mar 08 13:06:39 2000 +0000
@@ -32,9 +32,12 @@
 #
 ###############################################################################
 #	$Log: testpdfgen.py,v $
+#	Revision 1.6  2000/03/08 13:06:39  andy_robinson
+#	Moved inch and cm definitions to reportlab.lib.units and amended all demos
+#
 #	Revision 1.5  2000/02/17 02:08:34  rgbecker
 #	Docstring & other fixes
-#
+#	
 #	Revision 1.4  2000/02/16 09:42:50  rgbecker
 #	Conversion to reportlab package
 #	
@@ -44,14 +47,12 @@
 #	Revision 1.2  2000/02/15 15:47:09  rgbecker
 #	Added license, __version__ and Logi comment
 #	
-__version__=''' $Id: testpdfgen.py,v 1.5 2000/02/17 02:08:34 rgbecker Exp $ '''
+__version__=''' $Id: testpdfgen.py,v 1.6 2000/03/08 13:06:39 andy_robinson Exp $ '''
 __doc__='testscript for reportlab.pdfgen'
 #tests and documents new low-level canvas
 import string
 from reportlab.pdfgen import canvas   # gmcm 2000/10/13, pdfgen now a package
-
-inch = INCH = 72
-cm = CM = inch / 2.54
+from reportlab.lib.units import inch, cm
 
 #################################################################
 #
@@ -84,7 +85,7 @@
     """
     def __init__(self):
         self.comment1 = "A doc block"
-        self.code = "canvas.setTextOrigin(CM, CM)\ncanvas.textOut('Hello World')"
+        self.code = "canvas.setTextOrigin(cm, cm)\ncanvas.textOut('Hello World')"
         self.comment2 = "That was a doc block"
         self.drawHeight = 0
         
@@ -508,14 +509,14 @@
     p = c.beginPath()
     #make a chesboard effect, 1 cm squares
     for i in range(14):
-        x0 = (3 + i) * CM
+        x0 = (3 + i) * cm
         for j in range(7):
-            y0 = (16 + j) * CM
-            p.rect(x0, y0, 0.85*CM, 0.85*CM)
+            y0 = (16 + j) * cm
+            p.rect(x0, y0, 0.85*cm, 0.85*cm)
     c.addLiteral('%Begin clip path')
     c.clipPath(p)
     c.addLiteral('%End clip path')
-    t = c.beginText(3 * CM, 22.5 * CM)
+    t = c.beginText(3 * cm, 22.5 * cm)
     t.textLines("""This shows clipping at work.  We draw a chequerboard of rectangles
     into a path object, and clip it.  This then forms a mask which limits the region of
     the page on which one can draw.  This paragraph was drawn after setting the clipping
--- a/reportlab/platypus/layout.py	Wed Mar 08 13:00:28 2000 +0000
+++ b/reportlab/platypus/layout.py	Wed Mar 08 13:06:39 2000 +0000
@@ -31,9 +31,12 @@
 #
 ###############################################################################
 #	$Log: layout.py,v $
+#	Revision 1.7  2000/03/08 13:06:39  andy_robinson
+#	Moved inch and cm definitions to reportlab.lib.units and amended all demos
+#
 #	Revision 1.6  2000/02/23 10:53:33  rgbecker
 #	GMCM's memleak fixed
-#
+#	
 #	Revision 1.5  2000/02/17 02:09:05  rgbecker
 #	Docstring & other fixes
 #	
@@ -46,7 +49,7 @@
 #	Revision 1.2  2000/02/15 15:47:09  rgbecker
 #	Added license, __version__ and Logi comment
 #	
-__version__=''' $Id: layout.py,v 1.6 2000/02/23 10:53:33 rgbecker Exp $ '''
+__version__=''' $Id: layout.py,v 1.7 2000/03/08 13:06:39 andy_robinson Exp $ '''
 __doc__="""
 Page Layout And TYPography Using Scripts
 a page layout API on top of PDFgen
@@ -62,9 +65,9 @@
 
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfgen import canvas
+from reportlab.lib.units import inch
 
-inch = 72.0
-cm = inch / 2.54
+
 DEFAULT_PAGE_SIZE = (595.27,841.89)
 PAGE_HEIGHT = DEFAULT_PAGE_SIZE[1]
 TA_LEFT = 0
--- a/reportlab/platypus/test/testplatypus.py	Wed Mar 08 13:00:28 2000 +0000
+++ b/reportlab/platypus/test/testplatypus.py	Wed Mar 08 13:06:39 2000 +0000
@@ -32,9 +32,12 @@
 #
 ###############################################################################
 #	$Log: testplatypus.py,v $
+#	Revision 1.7  2000/03/08 13:06:39  andy_robinson
+#	Moved inch and cm definitions to reportlab.lib.units and amended all demos
+#
 #	Revision 1.6  2000/02/17 02:09:05  rgbecker
 #	Docstring & other fixes
-#
+#	
 #	Revision 1.5  2000/02/16 14:13:00  rgbecker
 #	Final Fixes for Linux
 #	
@@ -47,7 +50,7 @@
 #	Revision 1.2  2000/02/15 15:47:10  rgbecker
 #	Added license, __version__ and Logi comment
 #	
-__version__=''' $Id: testplatypus.py,v 1.6 2000/02/17 02:09:05 rgbecker Exp $ '''
+__version__=''' $Id: testplatypus.py,v 1.7 2000/03/08 13:06:39 andy_robinson Exp $ '''
 
 #tests and documents Page Layout API
 __doc__="""This is not obvious so here's a brief explanation.  This module is both
@@ -61,9 +64,7 @@
 import string
 from reportlab.pdfgen import canvas
 from reportlab.platypus import layout, tables
-
-inch = INCH = 72
-cm = CM = inch / 2.54
+from reportlab.lib.units import inch, cm
 
 #################################################################
 #
--- a/reportlab/platypus/test/testtables.py	Wed Mar 08 13:00:28 2000 +0000
+++ b/reportlab/platypus/test/testtables.py	Wed Mar 08 13:06:39 2000 +0000
@@ -32,9 +32,12 @@
 #
 ###############################################################################
 #	$Log: testtables.py,v $
+#	Revision 1.6  2000/03/08 13:06:39  andy_robinson
+#	Moved inch and cm definitions to reportlab.lib.units and amended all demos
+#
 #	Revision 1.5  2000/02/17 02:09:05  rgbecker
 #	Docstring & other fixes
-#
+#	
 #	Revision 1.4  2000/02/16 09:42:50  rgbecker
 #	Conversion to reportlab package
 #	
@@ -44,12 +47,11 @@
 #	Revision 1.2  2000/02/15 15:47:10  rgbecker
 #	Added license, __version__ and Logi comment
 #
-__version__=''' $Id: testtables.py,v 1.5 2000/02/17 02:09:05 rgbecker Exp $ '''
+__version__=''' $Id: testtables.py,v 1.6 2000/03/08 13:06:39 andy_robinson Exp $ '''
 __doc__='Test script for reportlab.tables'
 from reportlab.platypus import layout
 from reportlab.platypus import tables
-
-INCH = 72
+from reportlab.lib.units import inch
 
 def getTable():
     t = tables.Table(
@@ -77,7 +79,7 @@
     return styles
 
 def run():
-    doc = layout.SimpleFlowDocument('testtables.pdf', (8.5*INCH, 11*INCH), 1)
+    doc = layout.SimpleFlowDocument('testtables.pdf', (8.5*inch, 11*inch), 1)
     styles = makeStyles()
     lst = []
     for style in styles: