[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7072 - in trunk/gnue-reports/src/adapters/filters/Char/universal
From: |
btami |
Subject: |
[gnue] r7072 - in trunk/gnue-reports/src/adapters/filters/Char/universal: . CHObjects |
Date: |
Wed, 2 Mar 2005 05:37:29 -0600 (CST) |
Author: btami
Date: 2005-03-02 05:37:28 -0600 (Wed, 02 Mar 2005)
New Revision: 7072
Modified:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHObject.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageFooter.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHSummaryPage.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHTitlePage.py
trunk/gnue-reports/src/adapters/filters/Char/universal/Writer.py
Log:
fixed pagination
Modified:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHObject.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHObject.py
2005-03-01 22:35:00 UTC (rev 7071)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHObject.py
2005-03-02 11:37:28 UTC (rev 7072)
@@ -42,13 +42,16 @@
splittable = False # This band is not splittable across pages
def __init__(self):
self._inits = [self.resetBand]
- self.height = 0
def resetBand(self):
self.x = 0
self.y = -1
- self.buffer = [] * self.height
+ self.buffer = []
+ # Make sure buffer is big enough
+ for i in xrange(self.height):
+ self.buffer.append([])
+
def process(self, writer):
for child in self._children:
child.process(writer, self)
Modified:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageFooter.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageFooter.py
2005-03-01 22:35:00 UTC (rev 7071)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageFooter.py
2005-03-02 11:37:28 UTC (rev 7072)
@@ -41,7 +41,6 @@
def process(self, writer):
writer.pageFooterDone = True
if writer.currLine < writer.reportHeight - self.height:
- writer.printLines([""] * (writer.reportHeight - self.height -
writer.currLine))
+ writer.printLines([""] * (writer.reportHeight - self.height -
writer.currLine), self._type)
CHBand.process(self, writer)
-
\ No newline at end of file
Modified:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHSummaryPage.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHSummaryPage.py
2005-03-01 22:35:00 UTC (rev 7071)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHSummaryPage.py
2005-03-02 11:37:28 UTC (rev 7072)
@@ -35,19 +35,18 @@
class CHSummaryPage(CHObject, CHBand):
def __init__(self, parent=None, type='CHSummaryPage'):
CHObject.__init__(self, parent, type=type)
+ self.height = parent.height
CHBand.__init__(self)
def process(self, writer):
if writer.PageFooter and (not writer.pageFooterDone):
writer.PageFooter.process(writer)
+ writer.newPage()
elif writer.currLine < writer.reportHeight:
- writer.printLines([""] * (writer.reportHeight - writer.currLine))
- writer.newPage()
+ writer.printLines([""] * (writer.reportHeight - writer.currLine),
self._type)
-
writer.pageHeaderDone = True
writer.pageFooterDone = True
CHBand.process(self, writer)
-
\ No newline at end of file
Modified:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHTitlePage.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHTitlePage.py
2005-03-01 22:35:00 UTC (rev 7071)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHTitlePage.py
2005-03-02 11:37:28 UTC (rev 7072)
@@ -36,10 +36,14 @@
class CHTitlePage(CHObject, CHBand):
def __init__(self, parent=None, type='CHTitlePage'):
CHObject.__init__(self, parent, type=type)
+ self.height = parent.height
CHBand.__init__(self)
+
-
def process(self, writer):
writer.pageHeaderDone = True
writer.pageFooterDone = True
- CHBand.process(self, writer)
\ No newline at end of file
+
+ CHBand.process(self, writer)
+ writer.newPage()
+
Modified: trunk/gnue-reports/src/adapters/filters/Char/universal/Writer.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/universal/Writer.py
2005-03-01 22:35:00 UTC (rev 7071)
+++ trunk/gnue-reports/src/adapters/filters/Char/universal/Writer.py
2005-03-02 11:37:28 UTC (rev 7072)
@@ -54,42 +54,37 @@
self.output.write(self.printdef['page_end'])
self.output.write(self.printdef['job_end'])
+
def renderBand(self, band):
# self.output.write("[[ Begin Band %s ]]" % band._type)
for line in band.buffer:
line.sort()
- self.output.write(self.printdef['line_begin'])
ll = len(line)
cx = 0
+ outputLine = ''
# Make sure fields don't overlap
- for i in xrange(len(line)):
+ for i in xrange(ll):
x, text, prefix, postfix = line[i]
if i < ll - 1:
text = text[:line[i+1][0] - x]
# Move us to correct X position
if cx < x:
- self.output.write(self.printdef.escape(' '*(x-cx)))
+ outputLine += self.printdef.escape(' '*(x-cx))
cx = x
+
+ outputLine += prefix + \
+ self.printdef.escape(text).encode(_encoding,'replace') +
\
+ postfix
+ cx += len(text)
- self.output.write(prefix + \
-
self.printdef.escape(text).encode(_encoding,'replace') + \
- postfix)
- cx = cx + len(text)
+ self.printLine(outputLine, band._type)
+# self.output.write("[[ End Band %s ]]" % band._type)
- self.output.write(self.printdef['line_end'])
- # self.output.write("[[ End Band %s ]]" % band._type)
-
-
def render(self, object, x, y, width, band,
align='none', condensed=False, bold=False,
italic=False, underline=False):
- # Make sure buffer is big enough
- for i in xrange(y-len(band.buffer)+1):
- band.buffer.append([])
- self.currLine += 1
-
try:
curline = band.buffer[y]
except:
@@ -117,15 +112,9 @@
postfix += self.printdef['bold_end']
if condensed:
postfix += self.printdef['condensed_end']
-
curline.append((x, _alignFunc[align](object[:width], width), prefix,
postfix))
- # go to correct position in current band if needed...
-# if width > len(object):
-# self.output.write(self.printdef.escape((width-len(object))*' '))
-# band.x = x + width
-
def newPage(self):
if self.pageNumber > 1:
@@ -137,23 +126,27 @@
self.output.write(self.printdef['page_begin'])
- def printLines(self, lines):
+
+ def printLine(self, line, bandtype):
if self.PageFooter and (not self.pageFooterDone):
if self.currLine + 1 > self.reportHeight - self.PageFooter.height:
self.PageFooter.process(self)
+ self.newPage()
- if self.currLine + 1 > self.reportHeight:
- self.newPage()
-
- if self.PageHeader and (not self.pageHeaderDone):
+ if self.PageHeader and (not self.pageHeaderDone) and bandtype !=
'CHSummaryPage':
self.PageHeader.process(self)
- for line in lines:
- self.output.write( self.printdef['line_begin'] + \
- line + \
- self.printdef['line_end'] )
- self.currLine += 1
+# print self.reportHeight, self.PageFooter.height, self.currLine
+ self.output.write( self.printdef['line_begin'] + \
+ line + \
+ self.printdef['line_end'] )
+ self.currLine += 1
+
+ def printLines(self, lines, bandtype):
+ for line in lines:
+ self.printLine(line, bandtype)
+
_alignFunc = {'left' : lambda obj, width: string.ljust(obj, width),
'right' : lambda obj, width: string.rjust(obj, width),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7072 - in trunk/gnue-reports/src/adapters/filters/Char/universal: . CHObjects,
btami <=