commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r6571 - in trunk/gnue-reports: samples/foobulations src/adapters/filters


From: btami
Subject: r6571 - in trunk/gnue-reports: samples/foobulations src/adapters/filters/Char/char src/adapters/filters/Char/char/CHObjects
Date: Tue, 26 Oct 2004 16:18:03 -0500 (CDT)

Author: btami
Date: 2004-10-26 16:18:02 -0500 (Tue, 26 Oct 2004)
New Revision: 6571

Modified:
   trunk/gnue-reports/samples/foobulations/char.grd
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHObject.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHParser.py
   trunk/gnue-reports/src/adapters/filters/Char/char/Writer.py
Log:
implemented align attrib in Char filter

Modified: trunk/gnue-reports/samples/foobulations/char.grd
===================================================================
--- trunk/gnue-reports/samples/foobulations/char.grd    2004-10-26 17:49:14 UTC 
(rev 6570)
+++ trunk/gnue-reports/samples/foobulations/char.grd    2004-10-26 21:18:02 UTC 
(rev 6571)
@@ -8,19 +8,19 @@
    <out:report width="80" height="15">
 
     <out:pageheader height="4">
-      <out:label x="30" y="0" width="37">Monthly Accounting Foobulation 
Report</out:label>
+      <out:label x="0" y="0" width="80" align="center">Monthly Accounting 
Foobulation Report</out:label>
       <out:label x="0" y="2" width="4">Name</out:label>
       <out:label x="20" y="2" width="5">Color</out:label>
       <out:label x="40" y="2" width="4">Date</out:label>
-      <out:label x="65" y="2" width="5">Foobs</out:label>
+      <out:label x="75" y="2" width="5">Foobs</out:label>
       <out:label x="0" y="3" width="4">====</out:label>
       <out:label x="20" y="3" width="5">=====</out:label>
       <out:label x="40" y="3" width="4">====</out:label>
-      <out:label x="65" y="3" width="5">=====</out:label>
+      <out:label x="75" y="3" width="5">=====</out:label>
     </out:pageheader>
 
     <out:pagefooter height="3">
-      <out:label x="0" y="2" width="15">GNU Enterprise</out:label>
+      <out:label x="0" y="1" width="80">GNU Enterprise</out:label>
     </out:pagefooter>
     
         <section source="dtsFoo" name="mynameBreak">
@@ -38,19 +38,19 @@
             <out:detail height="1">
               <out:label x="20" y="0" width="15"><field 
name="color"/></out:label>
               <out:label x="40" y="0" width="25"><field 
name="foodate"/></out:label>
-              <out:label x="65" y="0" width="10"><field 
name="foobs"/></out:label>
+              <out:label x="70" y="0" width="10" align="right"><field 
name="foobs"/></out:label>
             </out:detail>
           </section>
 
           <out:groupfooter height="2">
             <out:label x="50" y="0" width="12"><field name="color"/> 
total</out:label>
-            <out:label x="65" y="0" width="10" bold="Y"><summ function="sum" 
section="details" field="foobs"/></out:label>
+            <out:label x="70" y="0" width="10" align="right" bold="Y"><summ 
function="sum" section="details" field="foobs"/></out:label>
           </out:groupfooter>
         </section>
 
           <out:groupfooter height="1">
             <out:label x="50" y="0" width="12"><field name="name"/> 
total</out:label>
-            <out:label x="65" y="0" width="10" bold="Y"><summ function="sum" 
section="mycolorBreak" field="foobs"/></out:label>
+            <out:label x="70" y="0" width="10" align="right" bold="Y"><summ 
function="sum" section="mycolorBreak" field="foobs"/></out:label>
           </out:groupfooter>
         </section>
 

Modified: 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHObject.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHObject.py     
2004-10-26 17:49:14 UTC (rev 6570)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHObject.py     
2004-10-26 21:18:02 UTC (rev 6571)
@@ -40,10 +40,9 @@
 
 class CHBand: 
   def __init__(self):
-    self.x = -1
-    self.y = -1
+    self.resetBand()
 
   def resetBand(self):
-    self.x = -1
+    self.x = 0
     self.y = -1
 

Modified: trunk/gnue-reports/src/adapters/filters/Char/char/CHParser.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHParser.py       
2004-10-26 17:49:14 UTC (rev 6570)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHParser.py       
2004-10-26 21:18:02 UTC (rev 6571)
@@ -170,10 +170,11 @@
             'align': {
                'Typecast': GTypecast.name,
                'ValueSet': {
+                  'none': {'Label': _('Not aligned')},
                   'left': {'Label': _('Left')},
                   'right': {'Label': _('Right')},
                   'center': {'Label': _('Centered')} },
-               'Default': "left",
+               'Default': "none",
                'Description': 'The justification of the label. Can be one of '
                               'the following: {left}, {right}, or {center}. '},
             'condensed': {

Modified: trunk/gnue-reports/src/adapters/filters/Char/char/Writer.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/Writer.py 2004-10-26 
17:49:14 UTC (rev 6570)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/Writer.py 2004-10-26 
21:18:02 UTC (rev 6571)
@@ -28,6 +28,10 @@
 
 __all__ = ['Writer']
 
+
+import string
+
+
 class Writer:
   reset = ""
   beginCondensed = ""
@@ -60,17 +64,18 @@
 
 
   def render(self, object, x, y, width, band,
-                  align=False, condensed=False, bold=False,
+                  align='none', condensed=False, bold=False,
                   italic=False, underline=False):
 
     # go to correct position in current band if needed...
     if y > band.y:
       self.newLine(y-band.y)
       band.y = y
-      band.x = -1
+      band.x = 0
 
     if x > band.x:
       self.output.write((x-band.x)*' ')
+      band.x = x
 
 
     # start style
@@ -84,7 +89,7 @@
       self.output.write(self.beginUnderline)
 
 
-    self.output.write(object)
+    self.output.write(_alignFunc[align](object, width))
 
 
     # end style
@@ -128,3 +133,10 @@
     for i in range(n):
       self.output.write(self.newLineCmd)
       self.currLine += 1
+
+
+_alignFunc = {'left'   : lambda obj, width: string.ljust(obj, width),
+              'right'  : lambda obj, width: string.rjust(obj, width),
+              'center' : lambda obj, width: string.center(obj, width),
+              'none'   : lambda obj, width: obj
+             }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]