reportlab: merge changes from the community trunk rtl-support
authorrgbecker
Wed, 18 Nov 2009 12:52:59 +0000
changeset 3256 f31a47336a0f
parent 3255 4583c245ad27
child 3257 997d7768ec59
child 3265 4a6ab8c8722f
reportlab: merge changes from the community trunk
demos/rlzope/readme.txt
demos/rlzope/rlzope.py
src/reportlab/graphics/barcode/lto.py
--- a/demos/rlzope/readme.txt	Wed Nov 18 11:03:23 2009 +0000
+++ b/demos/rlzope/readme.txt	Wed Nov 18 12:52:59 2009 +0000
@@ -14,7 +14,7 @@
 #
 # License : The ReportLab Toolkit's license (similar to BSD)
 #
-# Author : Jerome Alet - alet@unice.fr
+# Author : Jerome Alet - alet@librelogiciel.com
 #
 
 Installation instructions :
@@ -22,9 +22,9 @@
 
   0 - If not installed then install Zope.
 
-  1 - Install reportlab in the Zope/lib/python/Shared directory by unpacking 
+  1 - Install reportlab in the Zope/lib/python/Shared directory by unpacking
       the tarball and putting a reportlabs.pth file in site-packages for the Zope
-      used with Python.  The path value in the reportlabs.pth file must be 
+      used with Python.  The path value in the reportlabs.pth file must be
       relative.  For a typical Zope installation,  the path is "../../python/Shared".
       Remember to restart Zope so the new path is instantiated.
 
@@ -69,5 +69,5 @@
 
   8 - Enjoy !
 
-Send comments or bug reports at : alet@unice.fr
+Send comments or bug reports at : alet@librelogiciel.com
 
--- a/demos/rlzope/rlzope.py	Wed Nov 18 11:03:23 2009 +0000
+++ b/demos/rlzope/rlzope.py	Wed Nov 18 12:52:59 2009 +0000
@@ -8,7 +8,7 @@
 # License : the ReportLab Toolkit's one
 #       see : http://www.reportlab.com
 #
-# Author : Jerome Alet - alet@unice.fr
+# Author : Jerome Alet - alet@librelogiciel.com
 #
 #
 
@@ -73,7 +73,7 @@
                 ((width, height), image) = self.logo
                 canvas.drawImage(image, inch, doc.pagesize[1] - inch, width, height)
             canvas.setFont('Times-Roman', 10)
-            canvas.drawCentredString(inch + (doc.pagesize[0] - (1.5 * inch)) / 2, 0.25 * inch, "Contributed by Jerome Alet - alet@unice.fr")
+            canvas.drawCentredString(inch + (doc.pagesize[0] - (1.5 * inch)) / 2, 0.25 * inch, "Contributed by Jerome Alet - alet@librelogiciel.com")
             canvas.restoreState()
 
     def __init__(self, context, filename) :
--- a/src/reportlab/graphics/barcode/lto.py	Wed Nov 18 11:03:23 2009 +0000
+++ b/src/reportlab/graphics/barcode/lto.py	Wed Nov 18 12:52:59 2009 +0000
@@ -1,4 +1,4 @@
-# (c) 2008 Jerome Alet
+# (c) 2008 Jerome Alet - <alet@librelogiciel.com>
 # Licensing terms : ReportLab's license.
 
 import string
@@ -10,7 +10,7 @@
 class BaseLTOLabel(Standard39) :
     """
     Base class for LTO labels.
-    
+
     Specification taken from "IBM LTO Ultrium Cartridge Label Specification, Revision 3"
     available on  May 14th 2008 from :
     http://www-1.ibm.com/support/docview.wss?rs=543&context=STCVQ6R&q1=ssg1*&uid=ssg1S7000429&loc=en_US&cs=utf-8&lang=en+en
@@ -25,22 +25,22 @@
     CODEGAP = CODEBARWIDTH
     CODELQUIET = 10 * CODEBARWIDTH
     CODERQUIET = 10 * CODEBARWIDTH
-    def __init__(self, prefix="", 
-                       number=None, 
-                       subtype="1", 
-                       border=None, 
+    def __init__(self, prefix="",
+                       number=None,
+                       subtype="1",
+                       border=None,
                        checksum=False,
                        availheight=None) :
         """
            Initializes an LTO label.
-        
+
            prefix : Up to six characters from [A-Z][0-9]. Defaults to "".
            number : Label's number or None. Defaults to None.
            subtype : LTO subtype string , e.g. "1" for LTO1. Defaults to "1".
            border : None, or the width of the label's border. Defaults to None.
            checksum : Boolean indicates if checksum char has to be printed. Defaults to False.
            availheight : Available height on the label, or None for automatic. Defaults to None.
-        """   
+        """
         self.height = max(availheight, self.CODEBARHEIGHT)
         self.border = border
         if (len(subtype) != 1) \
@@ -51,10 +51,10 @@
             raise ValueError, "Invalid prefix '%s'" % prefix
         label = "%sL%s" % ((prefix + str(number or 0).zfill(6 - len(prefix)))[:6],
                            subtype)
-        if len(label) != 8 :    
+        if len(label) != 8 :
             raise ValueError, "Invalid set of parameters (%s, %s, %s)" \
                                 % (prefix, number, subtype)
-        self.label = label        
+        self.label = label
         Standard39.__init__(self,
                             label,
                             ratio=self.CODERATIO,
@@ -65,24 +65,24 @@
                             rquiet=self.CODERQUIET,
                             quiet=True,
                             checksum=checksum)
-    
+
     def drawOn(self, canvas, x, y) :
         """Draws the LTO label onto the canvas."""
         canvas.saveState()
         canvas.translate(x, y)
         if self.border :
             canvas.setLineWidth(self.border)
-            canvas.roundRect(0, 0, 
-                        self.LABELWIDTH, 
-                        self.LABELHEIGHT, 
+            canvas.roundRect(0, 0,
+                        self.LABELWIDTH,
+                        self.LABELHEIGHT,
                         self.LABELROUND)
         Standard39.drawOn(self,
-                          canvas, 
+                          canvas,
                           (self.LABELWIDTH-self.CODENOMINALWIDTH)/2.0,
                           self.LABELHEIGHT-self.height)
-        canvas.restoreState()                         
-                    
-class VerticalLTOLabel(BaseLTOLabel) :                    
+        canvas.restoreState()
+
+class VerticalLTOLabel(BaseLTOLabel) :
     """
     A class for LTO labels with rectangular blocks around the tape identifier.
     """
@@ -140,13 +140,13 @@
             canvas.saveState()
             canvas.translate(xblocks+(i*self.BLOCKWIDTH), 0)
             if self.colored and part.isdigit() :
-                canvas.setFillColorRGB(*getattr(colors, 
-                                                self.COLORSCHEME[int(part)], 
+                canvas.setFillColorRGB(*getattr(colors,
+                                                self.COLORSCHEME[int(part)],
                                                 colors.Color(1, 1, 1)).rgb())
             else:
                 canvas.setFillColorRGB(1, 1, 1)
             canvas.rect(0, 0, self.BLOCKWIDTH, self.BLOCKHEIGHT, fill=True)
-            canvas.translate((self.BLOCKWIDTH+canvas.stringWidth(part, *newfont))/2.0, 
+            canvas.translate((self.BLOCKWIDTH+canvas.stringWidth(part, *newfont))/2.0,
                              (self.BLOCKHEIGHT/2.0))
             canvas.rotate(90.0)
             canvas.setFont(*newfont)
@@ -154,12 +154,12 @@
             canvas.drawCentredString(0, 0, part)
             canvas.restoreState()
         canvas.restoreState()
-        
-def test() :        
+
+def test() :
     """Test this."""
     from reportlab.pdfgen.canvas import Canvas
     from reportlab.lib import pagesizes
-    
+
     canvas = Canvas("labels.pdf", pagesize=pagesizes.A4)
     canvas.setFont("Helvetica", 30)
     (width, height) = pagesizes.A4
@@ -189,8 +189,8 @@
     count += 1
     VerticalLTOLabel("RL", count, "3",
                     border=0.0125, colored=True).drawOn(canvas, xpos, ypos)
-    canvas.showPage()      
+    canvas.showPage()
     canvas.save()
-    
-if __name__ == "__main__" :    
+
+if __name__ == "__main__" :
     test()