commit-gnue
[Top][All Lists]
Advanced

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

r6566 - in trunk/gnue-reports/src/adapters/filters/Char: . char char/CHO


From: btami
Subject: r6566 - in trunk/gnue-reports/src/adapters/filters/Char: . char char/CHObjects
Date: Tue, 26 Oct 2004 06:42:53 -0500 (CDT)

Author: btami
Date: 2004-10-26 06:42:50 -0500 (Tue, 26 Oct 2004)
New Revision: 6566

Added:
   trunk/gnue-reports/src/adapters/filters/Char/char/
   trunk/gnue-reports/src/adapters/filters/Char/char/Adapter.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHDetail.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHGroupFooter.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHGroupHeader.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHLabel.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHObject.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHPageFooter.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHPageHeader.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHSummaryPage.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHTitlePage.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/__init__.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHParser.py
   trunk/gnue-reports/src/adapters/filters/Char/char/CHReport.py
   trunk/gnue-reports/src/adapters/filters/Char/char/PrinterDefs.py
   trunk/gnue-reports/src/adapters/filters/Char/char/Writer.py
   trunk/gnue-reports/src/adapters/filters/Char/char/__init__.py
Removed:
   trunk/gnue-reports/src/adapters/filters/Char/base/
   trunk/gnue-reports/src/adapters/filters/Char/esc-p/
   trunk/gnue-reports/src/adapters/filters/Char/pcl5/
   trunk/gnue-reports/src/adapters/filters/Char/text/
Log:
put filted defs into one file

Added: trunk/gnue-reports/src/adapters/filters/Char/char/Adapter.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/Adapter.py        
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/Adapter.py        
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,80 @@
+#
+# 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
+#
+# FILE:
+# Adapter.py
+#
+# 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 PrinterDefs import *
+
+
+class TransformAdapter(Base):
+  def __init__(self, *args, **parms):
+    Base.__init__(self, *args, **parms)
+    self.writer = eval(self.parameters['formatter'])()
+
+  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)
+
+#    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/char/CHObjects/CHDetail.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHDetail.py     
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHDetail.py     
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,48 @@
+#
+# 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
+#
+# FILE:
+# CHDetail.py
+#
+# DESCRIPTION:
+# Class that contains xml objects for GNUe Reports'
+# "Char" markup.
+#
+# NOTES:
+#
+
+__all__ = ['CHDetail']
+
+from CHObject import CHObject, CHBand
+
+class CHDetail(CHObject, CHBand): 
+  def __init__(self, parent=None, type='CHDetail'):
+    CHObject.__init__(self, parent, type=type)
+    CHBand.__init__(self)
+
+  def process(self, writer):
+    for child in self._children:
+      child.process(writer, self)
+
+    if self.height > self.y+1:
+      writer.newLine(self.height-self.y-1)
+
+    self.resetBand()
+ 
\ No newline at end of file

Added: 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHGroupFooter.py
===================================================================
--- 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHGroupFooter.py    
    2004-10-25 15:37:47 UTC (rev 6565)
+++ 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHGroupFooter.py    
    2004-10-26 11:42:50 UTC (rev 6566)
@@ -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
+#
+# FILE:
+# CHGroupFooter.py
+#
+# 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)
+
+  def process(self, writer):
+    for child in self._children:
+      child.process(writer, self)
+
+    if self.height > self.y+1:
+      writer.newLine(self.height-self.y-1)
+
+    self.resetBand()

Added: 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHGroupHeader.py
===================================================================
--- 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHGroupHeader.py    
    2004-10-25 15:37:47 UTC (rev 6565)
+++ 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHGroupHeader.py    
    2004-10-26 11:42:50 UTC (rev 6566)
@@ -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
+#
+# FILE:
+# CHGroupHeader.py
+#
+# 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)
+
+  def process(self, writer):
+    for child in self._children:
+      child.process(writer, self)
+
+    if self.height > self.y+1:
+      writer.newLine(self.height-self.y-1)
+
+    self.resetBand()

Added: trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHLabel.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHLabel.py      
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHLabel.py      
2004-10-26 11:42:50 UTC (rev 6566)
@@ -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
+#
+# FILE:
+# CHLabel.py
+#
+# 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/char/CHObjects/CHObject.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHObject.py     
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHObject.py     
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,49 @@
+#
+# 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
+#
+# FILE:
+# CHObject.py
+#
+# 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: 
+  def __init__(self):
+    self.x = -1
+    self.y = -1
+
+  def resetBand(self):
+    self.x = -1
+    self.y = -1
+

Added: 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHPageFooter.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHPageFooter.py 
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHPageFooter.py 
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,52 @@
+#
+# 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
+#
+# FILE:
+# CHPageFooter.py
+#
+# 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.newLine(writer.reportHeight - self.height - writer.currLine)
+
+    for child in self._children:
+      child.process(writer, self)
+
+    if self.height > self.y+1:
+      writer.newLine(self.height-self.y-1)
+
+    self.resetBand()

Added: 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHPageHeader.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHPageHeader.py 
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHPageHeader.py 
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,49 @@
+#
+# 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
+#
+# FILE:
+# CHPageHeader.py
+#
+# 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
+    for child in self._children:
+      child.process(writer, self)
+
+    if self.height > self.y+1:
+      writer.newLine(self.height-self.y-1)
+
+    self.resetBand()

Added: 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHSummaryPage.py
===================================================================
--- 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHSummaryPage.py    
    2004-10-25 15:37:47 UTC (rev 6565)
+++ 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHSummaryPage.py    
    2004-10-26 11:42:50 UTC (rev 6566)
@@ -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
+#
+# FILE:
+# CHSummaryPage.py
+#
+# 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.newLine(writer.reportHeight - writer.currLine)
+    writer.newPage()
+
+      
+    writer.pageHeaderDone = True
+    writer.pageFooterDone = True
+
+    for child in self._children:
+      child.process(writer, self)

Added: 
trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHTitlePage.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHTitlePage.py  
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/CHTitlePage.py  
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,48 @@
+#
+# 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
+#
+# FILE:
+# CHTitlePage.py
+#
+# 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
+    
+    for child in self._children:
+      child.process(writer, self)
+
+    writer.newPage()

Added: trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/__init__.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/__init__.py     
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHObjects/__init__.py     
2004-10-26 11:42:50 UTC (rev 6566)
@@ -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
+#
+# FILE:
+# CHObjects/__init__.py
+#
+# 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/char/CHParser.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHParser.py       
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHParser.py       
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,240 @@
+#
+# 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
+#
+# FILE:
+# Parser.py
+#
+# 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': {
+                  'left': {'Label': _('Left')},
+                  'right': {'Label': _('Right')},
+                  'center': {'Label': _('Centered')} },
+               'Default': "left",
+               '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):
+  def __init__(self):
+    GParser.xmlHandler.__init__(self)
+
+    self.xmlElements = getXMLelements()

Added: trunk/gnue-reports/src/adapters/filters/Char/char/CHReport.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/CHReport.py       
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/CHReport.py       
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,64 @@
+#
+# 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
+#
+# FILE:
+# CHReport.py
+#
+# 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/char/PrinterDefs.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/PrinterDefs.py    
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/PrinterDefs.py    
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1,74 @@
+#
+# 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
+#
+# FILE:
+# PrinterDefs.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+from Writer import Writer
+
+
+class text(Writer):
+  newLineCmd = "\n"
+  newPageCmd = "\n" + 8*("%s" % "o---------")
+
+
+class escp(Writer):
+  # reset, 10 CPI, draft(not NLQ)
+  reset = "address@hidden"
+
+  beginCondensed = "\x0F"
+  endCondensed = "\x12"
+
+  beginBold = "\x1BE"
+  endBold = "\x1BF"
+
+  beginItalic = "\x1B4"
+  endItalic = "\x1B5"
+
+  beginUnderline = "\x1B-1"
+  endUnderline = "\x1B-0"
+
+  newLineCmd = "\r\n"
+  newPageCmd = "\x0C"
+
+
+class pcl5(Writer):
+  # reset, fixed font, 
+  reset = "\x1BE\x1B(s0P"
+  # 16.67 CPI / 10 CPI
+  beginCondensed = "\x1B(s16.67H"
+  endCondensed = "\x1B(s10H"
+
+  beginBold = "\x1B(s3B"
+  endBold = "\x1B(s0B"
+
+  beginItalic = "\x1B(s1S"
+  endItalic = "\x1B(s0S"
+
+  beginUnderline = "\x1B&d1D"
+  endUnderline = "\x1B&d@"
+
+  newLineCmd = "\r\n"
+  newPageCmd = "\x1B&l0H"

Added: trunk/gnue-reports/src/adapters/filters/Char/char/Writer.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/Writer.py 2004-10-25 
15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/Writer.py 2004-10-26 
11:42:50 UTC (rev 6566)
@@ -0,0 +1,130 @@
+#
+# 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
+#
+# FILE:
+# Writer.py
+#
+# DESCRIPTION:
+#
+# NOTES:
+#
+
+__all__ = ['Writer']
+
+class Writer:
+  reset = ""
+  beginCondensed = ""
+  endCondensed = ""
+  beginBold = ""
+  endBold = ""
+  beginItalic = ""
+  endItalic = ""
+  beginUnderline = ""
+  endUnderline = ""
+  newLineCmd = "\n"
+  newPageCmd = "\n"
+
+
+  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.reset)
+
+
+  def finalize(self):
+    self.output.write(self.reset)
+
+
+  def render(self, object, x, y, width, band,
+                  align=False, 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
+
+    if x > band.x:
+      self.output.write((x-band.x)*' ')
+
+
+    # start style
+    if condensed:
+      self.output.write(self.beginCondensed)
+    if bold:
+      self.output.write(self.beginBold)
+    if italic:
+      self.output.write(self.beginItalic)
+    if underline:
+      self.output.write(self.beginUnderline)
+
+
+    self.output.write(object)
+
+
+    # end style
+    if condensed:
+      self.output.write(self.endCondensed)
+    if bold:
+      self.output.write(self.endBold)
+    if italic:
+      self.output.write(self.endItalic)
+    if underline:
+      self.output.write(self.endUnderline)
+
+
+    # go to correct position in current band if needed...
+    if width > len(object):
+      self.output.write((width-len(object))*' ')
+      
+    band.x = x + width
+
+
+  def newPage(self):
+    self.pageNumber += 1
+    self.currLine = 0
+    self.pageHeaderDone = False
+    self.pageFooterDone = False
+    
+    self.output.write(self.newPageCmd)
+
+
+  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.newLineCmd)
+      self.currLine += 1

Added: trunk/gnue-reports/src/adapters/filters/Char/char/__init__.py
===================================================================
--- trunk/gnue-reports/src/adapters/filters/Char/char/__init__.py       
2004-10-25 15:37:47 UTC (rev 6565)
+++ trunk/gnue-reports/src/adapters/filters/Char/char/__init__.py       
2004-10-26 11:42:50 UTC (rev 6566)
@@ -0,0 +1 @@
+from Adapter import *





reply via email to

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