[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r6900 - in trunk/gnue-reports: . samples/foobulations src/adapter
From: |
jcater |
Subject: |
[gnue] r6900 - in trunk/gnue-reports: . samples/foobulations src/adapters/filters/Char src/adapters/filters/Char/etc/printdef src/adapters/filters/Char/universal src/adapters/filters/Char/universal/CHObjects |
Date: |
Thu, 13 Jan 2005 21:23:02 -0600 (CST) |
Author: jcater
Date: 2005-01-13 21:23:01 -0600 (Thu, 13 Jan 2005)
New Revision: 6900
Added:
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/test.grp
trunk/gnue-reports/src/adapters/filters/Char/universal/
trunk/gnue-reports/src/adapters/filters/Char/universal/Adapter.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHDetail.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHGroupFooter.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHGroupHeader.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHLabel.py
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/CHPageHeader.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/CHObjects/__init__.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHParser.py
trunk/gnue-reports/src/adapters/filters/Char/universal/CHReport.py
trunk/gnue-reports/src/adapters/filters/Char/universal/PrinterDef.py
trunk/gnue-reports/src/adapters/filters/Char/universal/Writer.py
trunk/gnue-reports/src/adapters/filters/Char/universal/__init__.py
Modified:
trunk/gnue-reports/samples/foobulations/char.grd
trunk/gnue-reports/setup.cvs
trunk/gnue-reports/setup.py
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/escp.grp
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/html.grp
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/lineprinter.grp
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/pcl5.grp
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/ps2-letter.grp
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/text-dos.grp
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/text.grp
Log:
Added a char/universal driver which is basically a copy of the char/char
driver, but generalized into a print-definition-style setup; I anticipate that
universal will replace char when working.
Modified: trunk/gnue-reports/samples/foobulations/char.grd
===================================================================
--- trunk/gnue-reports/samples/foobulations/char.grd 2005-01-14 03:12:10 UTC
(rev 6899)
+++ trunk/gnue-reports/samples/foobulations/char.grd 2005-01-14 03:23:01 UTC
(rev 6900)
@@ -8,7 +8,7 @@
<out:report width="80" height="15">
<out:pageheader height="4">
- <out:label x="0" y="0" width="80" align="center">Monthly Accounting
Foobulation Report</out:label>
+ <out:label x="0" y="0" width="80" align="center" bold="Y"
underline="Y">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>
Modified: trunk/gnue-reports/setup.cvs
===================================================================
--- trunk/gnue-reports/setup.cvs 2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/setup.cvs 2005-01-14 03:23:01 UTC (rev 6900)
@@ -34,6 +34,7 @@
createLink ('src/adapters/filters/Labels/etc', '%s/share/gnue/filters/Labels'
% CONFDIR, overwrite=1)
createLink ('src/adapters/filters/SimpleTabulation/etc',
'%s/share/gnue/filters/SimpleTabulation' % CONFDIR, overwrite=1)
+createLink ('src/adapters/filters/Char/etc/printdef',
'%s/share/gnue/filters/Char' % CONFDIR, overwrite=1)
createLink ('etc/sample.report-filters.conf',
'%s/etc/sample.report-filters.conf' % CONFDIR, overwrite=1)
# Add our GNUe RPC resource files to the config directory
Modified: trunk/gnue-reports/setup.py
===================================================================
--- trunk/gnue-reports/setup.py 2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/setup.py 2005-01-14 03:23:01 UTC (rev 6900)
@@ -69,6 +69,7 @@
# The Data
filterLabels = self.allfiles ("src/adapters/filters/Labels/etc/")
filterSimple = self.allfiles ("src/adapters/filters/SimpleTabulation/etc/")
+ filterChar = self.allfiles ("src/adapters/filters/Char/etc/printdef/")
grpcfiles = ["grpc/GRServer.grpc"]
man1files = self.allfiles ("doc/man")
docfiles = self.allfiles ("doc") + ["etc/sample.report-filters.conf"]
@@ -83,6 +84,7 @@
params ["data_files"] = \
[("share/gnue/filters/Labels", filterLabels),
("share/gnue/filters/SimpleTabulation", filterSimple),
+ ("share/gnue/filters/Char", filterChar),
("share/gnue/grpc", grpcfiles),
("share/man/man1", man1files),
("share/doc/gnue-reports", docfiles),
Modified: trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/escp.grp
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/escp.grp
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/escp.grp
2005-01-14 03:23:01 UTC (rev 6900)
@@ -29,5 +29,4 @@
doublewide_begin=
doublewide_end=
doubleheight_begin=
-doublewide_end=
-
+doubleheight_end=
Modified: trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/html.grp
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/html.grp
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/html.grp
2005-01-14 03:23:01 UTC (rev 6900)
@@ -33,5 +33,5 @@
doublewide_begin=<font size="+2">
doublewide_end=</font>
doubleheight_begin=<font size="+2">
-doublewide_end=</font>
+doubleheight_end=</font>
Modified:
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/lineprinter.grp
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/lineprinter.grp
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/lineprinter.grp
2005-01-14 03:23:01 UTC (rev 6900)
@@ -28,5 +28,5 @@
doublewide_begin=
doublewide_end=
doubleheight_begin=
-doublewide_end=
+doubleheight_end=
Modified: trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/pcl5.grp
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/pcl5.grp
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/pcl5.grp
2005-01-14 03:23:01 UTC (rev 6900)
@@ -28,4 +28,4 @@
doublewide_begin=
doublewide_end=
doubleheight_begin=
-doublewide_end=
+doubleheight_end=
Modified:
trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/ps2-letter.grp
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/ps2-letter.grp
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/ps2-letter.grp
2005-01-14 03:23:01 UTC (rev 6900)
@@ -20,7 +20,7 @@
job_begin=
job_end=
page_begin=
-page_end=\0x012
+page_end=
graphics_begin=
graphics_end=
line_begin=
@@ -36,5 +36,4 @@
doublewide_begin=
doublewide_end=
doubleheight_begin=
-doublewide_end=
-
+doubleheight_end=
Added: trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/test.grp
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/test.grp
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/test.grp
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,33 @@
+description=Test Debugging Sequences
+mime_type=text/plain
+
+default_lines=66
+default_columns=80
+graphics_format=none
+
+# Escape sequences
+# As a test, replace all 'a's with \a
+escape_map=
+
+# Various escape sequences
+job_begin={bjob}
+job_end={ejob}
+page_begin={bpage}
+page_end={epage}
+graphics_begin={bgraphics}
+graphics_end={egraphics}
+line_begin={bline}
+line_end={eline}\n
+underline_begin={buline}
+underline_end={euline}
+condensed_begin={bcond}
+condensed_end={econd}
+bold_begin={bbold}
+bold_end={ebold}
+italic_begin={bitalic}
+italic_end={eitalic}
+doublewide_begin={bdwide}
+doublewide_end={edwide}
+doubleheight_begin={bdheight}
+doubleheight_end={edheight}
+
Modified: trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/text-dos.grp
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/text-dos.grp
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/text-dos.grp
2005-01-14 03:23:01 UTC (rev 6900)
@@ -28,5 +28,6 @@
doublewide_begin=
doublewide_end=
doubleheight_begin=
-doublewide_end=
+doubleheight_end=
+
Modified: trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/text.grp
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/text.grp
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/etc/printdef/text.grp
2005-01-14 03:23:01 UTC (rev 6900)
@@ -28,5 +28,5 @@
doublewide_begin=
doublewide_end=
doubleheight_begin=
-doublewide_end=
+doubleheight_end=
Added: trunk/gnue-reports/src/adapters/filters/Char/universal/Adapter.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/universal/Adapter.py
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/universal/Adapter.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,82 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2003-2004 Free Software Foundation
+#
+# $Id: Adapter.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains the base filter adapter for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+from gnue.reports.base.GROutputAdapter import TransformAdapter as Base
+from CHParser import loadFile
+from PrinterDef import PrinterDefinition
+from Writer import Writer
+
+
+class TransformAdapter(Base):
+ def __init__(self, *args, **parms):
+ Base.__init__(self, *args, **parms)
+ self.writer = Writer(
+ PrinterDefinition(self.parameters.get('formatter','text')))
+
+ def open(self):
+ # We need a temp file
+ self.input, self.infile = self.createTempFile()
+ return self.input
+
+ def close(self):
+
+ # We are finished with the intermediate file
+ self.input.close()
+
+ # Get a file for output from the destination adapter.
+ self.writer.output = self.destination.getOutputHandle()
+
+ report = loadFile(self.infile, initialize=True)
+
+# print report.dumpXML()
+
+ self.parse(report)
+
+# infile.close()
+
+ try:
+ mimetype = self.parameters['mimetype']
+ except:
+ mimetype = self.MIMETYPE
+
+
+ # Let the destination adapter do its thing
+ self.destination.close(mimetype=mimetype)
+
+ # clean up our temp files
+ self.deleteTempFile(self.infile)
+
+
+ def parse(self, report):
+ self.writer.initialize(report)
+
+ report.process(self.writer)
+
+ self.writer.finalize()
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHDetail.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHDetail.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHDetail.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,39 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHDetail.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+__all__ = ['CHDetail']
+
+from CHObject import CHObject, CHBand
+
+class CHDetail(CHObject, CHBand):
+ splittable = True # This band is splittable across pages
+ def __init__(self, parent=None, type='CHDetail'):
+ CHObject.__init__(self, parent, type=type)
+ CHBand.__init__(self)
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHGroupFooter.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHGroupFooter.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHGroupFooter.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,38 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHGroupFooter.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+__all__ = ['CHGroupFooter']
+
+from CHObject import CHObject, CHBand
+
+class CHGroupFooter(CHObject, CHBand):
+ def __init__(self, parent=None, type='CHGroupFooter'):
+ CHObject.__init__(self, parent, type=type)
+ CHBand.__init__(self)
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHGroupHeader.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHGroupHeader.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHGroupHeader.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,39 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHGroupHeader.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+__all__ = ['CHGroupHeader']
+
+from CHObject import CHObject, CHBand
+
+class CHGroupHeader(CHObject, CHBand):
+ def __init__(self, parent=None, type='CHGroupHeader'):
+ CHObject.__init__(self, parent, type=type)
+ CHBand.__init__(self)
+
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHLabel.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHLabel.py
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHLabel.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,42 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHLabel.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+__all__ = ['CHLabel']
+
+from CHObject import CHObject
+
+class CHLabel(CHObject):
+ def __init__(self, parent=None, type='CHLabel'):
+ CHObject.__init__(self, parent, type=type)
+
+ def process(self, writer, band):
+ writer.render(self.getChildrenAsContent(), self.x, self.y, self.width,
band,
+ align=self.align, condensed=self.condensed, bold=self.bold,
+ italic=self.italic, underline=self.underline)
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHObject.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHObject.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHObject.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,57 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHObject.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+__all__ = ['CHObject', 'CHBand']
+
+from gnue.common.definitions.GObjects import GObj
+
+
+class CHObject(GObj):
+ def __init__(self, parent=None, type='CHObject'):
+ GObj.__init__(self, parent, type=type)
+
+
+class CHBand:
+ 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
+
+ def process(self, writer):
+ for child in self._children:
+ child.process(writer, self)
+
+ writer.renderBand(self)
+ self.resetBand()
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageFooter.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageFooter.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageFooter.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,47 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHPageFooter.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+__all__ = ['CHPageFooter']
+
+from CHObject import CHObject, CHBand
+
+
+class CHPageFooter(CHObject, CHBand):
+ def __init__(self, parent=None, type='CHPageFooter'):
+ CHObject.__init__(self, parent, type=type)
+ CHBand.__init__(self)
+
+ def process(self, writer):
+ writer.pageFooterDone = True
+ if writer.currLine < writer.reportHeight - self.height:
+ writer.printLines([""] * (writer.reportHeight - self.height -
writer.currLine))
+
+ CHBand.process(self, writer)
+
\ No newline at end of file
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageHeader.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageHeader.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHPageHeader.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,44 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHPageHeader.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+__all__ = ['CHPageHeader']
+
+from CHObject import CHObject, CHBand
+
+
+class CHPageHeader(CHObject, CHBand):
+ def __init__(self, parent=None, type='CHPageHeader'):
+ CHObject.__init__(self, parent, type=type)
+ CHBand.__init__(self)
+
+ def process(self, writer):
+ writer.pageHeaderDone = True
+ CHBand.process(self, writer)
+
\ No newline at end of file
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHSummaryPage.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHSummaryPage.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHSummaryPage.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,53 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHSummaryPage.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+# NOTES:
+#
+
+__all__ = ['CHSummaryPage']
+
+from CHObject import CHObject, CHBand
+
+class CHSummaryPage(CHObject, CHBand):
+ def __init__(self, parent=None, type='CHSummaryPage'):
+ CHObject.__init__(self, parent, type=type)
+ CHBand.__init__(self)
+
+
+ def process(self, writer):
+ if writer.PageFooter and (not writer.pageFooterDone):
+ writer.PageFooter.process(writer)
+ elif writer.currLine < writer.reportHeight:
+ writer.printLines([""] * (writer.reportHeight - writer.currLine))
+ writer.newPage()
+
+
+ writer.pageHeaderDone = True
+ writer.pageFooterDone = True
+
+ CHBand.process(self, writer)
+
\ No newline at end of file
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHTitlePage.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHTitlePage.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/CHTitlePage.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,45 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHTitlePage.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains xml objects for GNUe Reports'
+"Char" markup.
+"""
+#
+# NOTES:
+#
+
+__all__ = ['CHTitlePage']
+
+from CHObject import CHObject, CHBand
+
+class CHTitlePage(CHObject, CHBand):
+ def __init__(self, parent=None, type='CHTitlePage'):
+ CHObject.__init__(self, parent, type=type)
+ CHBand.__init__(self)
+
+
+ def process(self, writer):
+ writer.pageHeaderDone = True
+ writer.pageFooterDone = True
+ CHBand.process(self, writer)
\ No newline at end of file
Added:
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/__init__.py
===================================================================
---
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/__init__.py
2005-01-14 03:12:10 UTC (rev 6899)
+++
trunk/gnue-reports/src/adapters/filters/Char/universal/CHObjects/__init__.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,38 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: __init__.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Classes related to the banded layout
+"""
+# NOTES:
+#
+
+from CHDetail import CHDetail
+from CHGroupHeader import CHGroupHeader
+from CHGroupFooter import CHGroupFooter
+from CHLabel import CHLabel
+from CHObject import CHObject
+from CHPageFooter import CHPageFooter
+from CHPageHeader import CHPageHeader
+from CHSummaryPage import CHSummaryPage
+from CHTitlePage import CHTitlePage
Added: trunk/gnue-reports/src/adapters/filters/Char/universal/CHParser.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/universal/CHParser.py
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/universal/CHParser.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,245 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHParser.py 6763 2004-11-30 23:36:21Z jcater $
+#
+# DESCRIPTION:
+"""
+Class that contains a SAX-based xml processor for GNUe Reports'
+"Char" markup.
+"""
+#
+# NOTES:
+#
+
+__all__ = ['loadFile', 'xmlReportHandler', 'getXMLelements']
+
+from gnue.common.datasources import GDataSource
+from gnue.common.formatting import GTypecast
+from gnue.common.definitions import GParser
+from gnue.common.logic import GTrigger
+import copy, types
+
+
+
+
+########
+######## Please keep this file neat !!!
+########
+
+
+
+
+#######################################################
+# This method loads a report from an XML file and returns
+# a Report object. If initialize is 1 (default), then
+# the report is initialized and ready to go.
+#######################################################
+
+def loadFile(buffer, connections=None, initialize=0):
+ return GParser.loadXMLObject (buffer, xmlReportHandler, 'CHReport', 'report',
+ initialize, attributes={})
+
+
+
+xmlElements = None
+
+
+def getXMLelements():
+
+ global xmlElements
+
+ import CHObjects
+ import CHReport
+
+ if xmlElements == None:
+
+ #
+ #
+ xmlElements = {
+ 'report': {
+ 'BaseClass': CHReport.CHReport,
+ 'Required': 1,
+ 'SingleInstance': 1,
+ 'Attributes': {
+ 'width': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The width of the report in text columns.' },
+ 'height': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The height of the report in text rows. ' },
+ 'description': {
+ 'Typecast': GTypecast.text }
+ },
+ 'ParentTags': None
+ },
+
+ 'titlepage': {
+ 'BaseClass': CHObjects.CHTitlePage,
+ 'SingleInstance': 1,
+ 'ParentTags': ('report',)
+ },
+
+ 'summarypage': {
+ 'BaseClass': CHObjects.CHSummaryPage,
+ 'SingleInstance': 1,
+ 'ParentTags': ('report',)
+ },
+
+ 'pageheader': {
+ 'BaseClass': CHObjects.CHPageHeader,
+ 'Attributes': {
+ 'height': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The height of the page header in text rows. ' }
+ },
+ 'SingleInstance': 1,
+ 'ParentTags': ('report',)
+ },
+
+ 'pagefooter': {
+ 'BaseClass': CHObjects.CHPageFooter,
+ 'Attributes': {
+ 'height': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The height of the page footer in text rows. ' },
+ },
+ 'SingleInstance': 1,
+ 'ParentTags': ('report',)
+ },
+
+ 'groupheader': {
+ 'BaseClass': CHObjects.CHGroupHeader,
+ 'Attributes': {
+ 'height': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The height of the group header in text rows. '
},
+ },
+ 'ParentTags': ('report',)
+ },
+
+ 'groupfooter': {
+ 'BaseClass': CHObjects.CHGroupFooter,
+ 'Attributes': {
+ 'height': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The height of the group footer in text rows. '
},
+ },
+ 'ParentTags': ('report',)
+ },
+
+ 'detail': {
+ 'BaseClass': CHObjects.CHDetail,
+ 'Attributes': {
+ 'height': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The height of the group footer in text rows. '
},
+ },
+ 'SingleInstance': 1,
+ 'ParentTags': ('report',)
+ },
+
+ 'label': {
+ 'BaseClass': CHObjects.CHLabel,
+ 'MixedContent': True,
+ 'KeepWhitespace': True,
+ 'Attributes': {
+ 'align': {
+ 'Typecast': GTypecast.name,
+ 'ValueSet': {
+ 'none': {'Label': _('Not aligned')},
+ 'left': {'Label': _('Left')},
+ 'right': {'Label': _('Right')},
+ 'center': {'Label': _('Centered')} },
+ 'Default': "none",
+ 'Description': 'The justification of the label. Can be one of '
+ 'the following: {left}, {right}, or {center}. '},
+ 'condensed': {
+ 'Typecast': GTypecast.boolean,
+ 'Default': False,
+ 'Description': 'TODO '},
+ 'bold': {
+ 'Typecast': GTypecast.boolean,
+ 'Default': False,
+ 'Description': 'TODO '},
+ 'italic': {
+ 'Typecast': GTypecast.boolean,
+ 'Default': False,
+ 'Description': 'TODO '},
+ 'underline': {
+ 'Typecast': GTypecast.boolean,
+ 'Default': False,
+ 'Description': 'TODO '},
+ 'width': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The width of the label in text columns.' },
+ 'height': {
+ 'Required': False,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The height of the label in text rows. ' },
+ 'x': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The column starting position of the label.
Based upon leftmost column of report being 0.' },
+ 'y': {
+ 'Required': True,
+ 'Typecast': GTypecast.whole,
+ 'Description': 'The row starting position of the label. Based
upon the top row of the report being 0.' }
+ },
+ 'ParentTags': ('titlepage',
+ 'summarypage',
+ 'pageheader',
+ 'pagefooter',
+ 'groupheader',
+ 'groupfooter',
+ 'detail',)
+ },
+
+ }
+
+
+ return GParser.buildImportableTags('report',xmlElements)
+
+
+#######################################################
+#
+# xmlReportHandler
+#
+# This class is called by the XML parser to
+# process the xml file.
+#
+#######################################################
+
+class xmlReportHandler (GParser.xmlHandler):
+
+ ignore_unknown_namespaces = True
+ default_namespace = 'GNUe:Reports:Char'
+
+ def __init__(self):
+ GParser.xmlHandler.__init__(self)
+ self.xmlElements = getXMLelements()
Added: trunk/gnue-reports/src/adapters/filters/Char/universal/CHReport.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/universal/CHReport.py
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/universal/CHReport.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,63 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000-2004 Free Software Foundation
+#
+# $Id: CHReport.py 6706 2004-11-22 12:26:58Z btami $
+#
+# DESCRIPTION:
+# Class that contains xml objects for GNUe Reports'
+# "Char" markup.
+#
+# NOTES:
+#
+
+__all__ = ['CHReport']
+
+
+from gnue.common.definitions.GObjects import GObj
+from gnue.common.definitions.GRootObj import GRootObj
+from gnue.common.apps import GDebug
+import CHParser
+
+
+class CHReport(GRootObj, GObj):
+ def __init__(self, parent=None):
+ GRootObj.__init__(self, 'report', CHParser.getXMLelements, CHParser)
+ GObj.__init__(self, parent, type='CHReport')
+
+
+ def process(self, writer):
+ writer.PageHeader = self.findChildOfType('CHPageHeader')
+ writer.PageFooter = self.findChildOfType('CHPageFooter')
+
+ TitlePage = self.findChildOfType('CHTitlePage')
+ if TitlePage:
+ TitlePage.process(writer)
+
+ for child in self._children:
+ if child._type in ('CHDetail', 'CHGroupHeader', 'CHGroupFooter'):
+ child.process(writer)
+
+ SummaryPage = self.findChildOfType('CHSummaryPage')
+ if SummaryPage:
+ SummaryPage.process(writer)
+
+ if writer.PageFooter and (not writer.pageFooterDone):
+ writer.PageFooter.process(writer)
+ writer.newPage()
Added: trunk/gnue-reports/src/adapters/filters/Char/universal/PrinterDef.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/universal/PrinterDef.py
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/universal/PrinterDef.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,82 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2004 Free Software Foundation
+#
+# $Id: PrinterDefs.py 6764 2004-12-01 00:34:26Z jcater $
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from gnue.common.formatting.GTypecast import escaped
+from gnue.common.apps import GConfig
+import os.path
+
+
+location =
GConfig.getInstalledBase('reports_shared','common_shared','install_prefix')
+
+class PrinterDefinition:
+ def __init__(self, definition):
+
+ f = open(os.path.join(location,'filters','Char',"%s.grp" % definition))
+
+ self._values = values = {}
+ self._escapes = escapes = {}
+ for line in f.readlines():
+ line = line[:-1].lstrip()
+ if not line or line[0] == '#':
+ continue
+ try:
+ name,value = line.split('=',1)
+ except:
+ continue
+ if name[-1:] == '+':
+ name = name[:-1]
+ appending = True
+ else:
+ appending = False
+ name = name.strip().lower()
+ if not name or not value: continue
+ value = escaped(value)
+ if name == 'escape_map':
+ # Special case
+ escapes[value[0]] = value[1:]
+ else:
+ if appending:
+ values[name] = values.get(name,"") + value
+ else:
+ values[name] = value
+
+ def __getitem__(self, key):
+ return self._values.get(key,'')
+
+ def escape(self, value):
+ value = (value or '')
+ for char, replace in self._escapes.items():
+ value = value.replace(char, replace)
+ return value
+
+
+if __name__ == '__main__':
+ import sys
+ p = PrinterDefinition('../etc/printdef/%s.grp' % (sys.argv[1:2][0] or
'escp'))
+ print repr(p.escape('(\\Test)'))
+
+
\ No newline at end of file
Added: trunk/gnue-reports/src/adapters/filters/Char/universal/Writer.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/universal/Writer.py
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/universal/Writer.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,175 @@
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2003-2004 Free Software Foundation
+#
+# $Id: Writer.py 6764 2004-12-01 00:34:26Z jcater $
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+__all__ = ['Writer']
+
+
+import string
+
+
+class Writer:
+
+ def __init__(self, printdef):
+ self.printdef = printdef
+
+ def initialize(self, report):
+ self.reportHeight = report.height
+ self.reportWidth = report.width
+
+ self.pageNumber = 1
+ self.currLine = 0
+
+ self.pageHeaderDone = False
+ self.pageFooterDone = False
+
+ self.output.write(self.printdef['job_begin'])
+
+
+ def finalize(self):
+ if self.pageNumber > 1:
+ 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
+ # Make sure fields don't overlap
+ for i in xrange(len(line)):
+ 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)))
+ cx = x + len(line)
+ self.output.write(prefix + \
+ self.printdef.escape(text) + \
+ postfix)
+
+ 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:
+ curline = band.buffer[y] = []
+
+ prefix = postfix = ""
+ # start style
+ if condensed:
+ prefix += self.printdef['condensed_begin']
+ if bold:
+ prefix += self.printdef['bold_begin']
+ if italic:
+ prefix += self.printdef['italic_begin']
+ if underline:
+ prefix += self.printdef['underline_begin']
+
+
+ # end style... these should be the
+ # reverse of the "Start" lines above.
+ if underline:
+ postfix += self.printdef['underline_end']
+ if italic:
+ postfix += self.printdef['italic_end']
+ if bold:
+ postfix += self.printdef['bold_end']
+ if condensed:
+ postfix += self.printdef['condensed_end']
+
+
+ curline.append((x, _alignFunc[align](object, 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:
+ self.output.write(self.printdef['page_end'])
+ self.pageNumber += 1
+ self.currLine = 0
+ self.pageHeaderDone = False
+ self.pageFooterDone = False
+
+ self.output.write(self.printdef['page_begin'])
+
+ def printLines(self, lines):
+ if self.PageFooter and (not self.pageFooterDone):
+ if self.currLine + 1 > self.reportHeight - self.PageFooter.height:
+ self.PageFooter.process(self)
+
+ if self.currLine + 1 > self.reportHeight:
+ self.newPage()
+
+ if self.PageHeader and (not self.pageHeaderDone):
+ self.PageHeader.process(self)
+
+ for line in lines:
+ self.output.write( self.printdef['line_begin'] + \
+ line + \
+ self.printdef['line_end'] )
+ self.currLine += 1
+
+ def newLine(self, n=1):
+ if self.PageFooter and (not self.pageFooterDone):
+ if self.currLine + 1 > self.reportHeight - self.PageFooter.height:
+ self.PageFooter.process(self)
+
+ if self.currLine + 1 > self.reportHeight:
+ self.newPage()
+
+ if self.PageHeader and (not self.pageHeaderDone):
+ self.PageHeader.process(self)
+
+ for i in range(n):
+ self.output.write(self.printdef['line_begin'] +
self.printdef['line_end'])
+ 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: string.ljust(obj, width),
+ }
Added: trunk/gnue-reports/src/adapters/filters/Char/universal/__init__.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/universal/__init__.py
2005-01-14 03:12:10 UTC (rev 6899)
+++ trunk/gnue-reports/src/adapters/filters/Char/universal/__init__.py
2005-01-14 03:23:01 UTC (rev 6900)
@@ -0,0 +1,3 @@
+# $Id: __init__.py 6706 2004-11-22 12:26:58Z btami $
+
+from Adapter import *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r6900 - in trunk/gnue-reports: . samples/foobulations src/adapters/filters/Char src/adapters/filters/Char/etc/printdef src/adapters/filters/Char/universal src/adapters/filters/Char/universal/CHObjects,
jcater <=