[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/reports filters/SimpleTabulation/text.xsl ...
From: |
Bajusz Tamás |
Subject: |
gnue/reports filters/SimpleTabulation/text.xsl ... |
Date: |
Fri, 20 Dec 2002 03:44:11 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Bajusz Tamás <address@hidden> 02/12/20 03:44:11
Modified files:
reports/filters/SimpleTabulation: text.xsl
reports/packaging/mcmillan/hooks: hook-gnue.reports.GREngine.py
hook-gnue.reports.GRFilters.py
reports/src/adapters/filters/SimpleTabulation/tabulator:
Adapter.py
reports/src/adapters/filters/SimpleTabulation/tabulator/formatters:
html.py
pdf.py
Log message:
l
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/filters/SimpleTabulation/text.xsl.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GREngine.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GRFilters.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/Adapter.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/html.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/pdf.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gnue/reports/filters/SimpleTabulation/text.xsl
diff -c gnue/reports/filters/SimpleTabulation/text.xsl:1.3
gnue/reports/filters/SimpleTabulation/text.xsl:1.4
*** gnue/reports/filters/SimpleTabulation/text.xsl:1.3 Thu Aug 8 12:53:46 2002
--- gnue/reports/filters/SimpleTabulation/text.xsl Fri Dec 20 03:44:11 2002
***************
*** 83,99 ****
<xsl:param name="colwidth"></xsl:param>
<xsl:choose>
<xsl:when test="@align='right'">
! <xsl:value-of select="substring($space80, 1, $colwidth -
string-length($colname))"/>
! <xsl:value-of select="$colname"/>
</xsl:when>
<xsl:when test="@align='center'">
! <xsl:value-of select="substring($space80, 1, ($colwidth -
string-length($colname)) div 2)"/>
! <xsl:value-of select="$colname"/>
! <xsl:value-of select="substring($space80, 1, ($colwidth -
string-length($colname)) div 2)"/>
</xsl:when>
<xsl:otherwise>
! <xsl:value-of select="$colname"/>
! <xsl:value-of select="substring($space80, 1, $colwidth -
string-length($colname))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
--- 83,99 ----
<xsl:param name="colwidth"></xsl:param>
<xsl:choose>
<xsl:when test="@align='right'">
! <xsl:value-of select="substring($space80, 1, $colwidth -
string-length(normalize-space($colname)))"/>
! <xsl:value-of select="normalize-space($colname)"/>
</xsl:when>
<xsl:when test="@align='center'">
! <xsl:value-of select="substring($space80, 1, ($colwidth -
string-length(normalize-space($colname))) div 2)"/>
! <xsl:value-of select="normalize-space($colname)"/>
! <xsl:value-of select="substring($space80, 1, ($colwidth -
string-length(normalize-space($colname))) div 2)"/>
</xsl:when>
<xsl:otherwise>
! <xsl:value-of select="normalize-space($colname)"/>
! <xsl:value-of select="substring($space80, 1, $colwidth -
string-length(normalize-space($colname)))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
***************
*** 109,125 ****
<xsl:variable name="colwidth"><xsl:value-of
select="@width"/></xsl:variable>
<xsl:choose>
<xsl:when test="$align='right'">
! <xsl:value-of select="substring($space80, 1, $colwidth -
string-length($value))"/>
! <xsl:value-of select="$value"/>
</xsl:when>
<xsl:when test="$align='center'">
! <xsl:value-of select="substring($space80, 1, ($colwidth -
string-length($value)) div 2)"/>
! <xsl:value-of select="$value"/>
! <xsl:value-of select="substring($space80, 1, ($colwidth -
string-length($value)) div 2)"/>
</xsl:when>
<xsl:otherwise>
! <xsl:value-of select="$value"/>
! <xsl:value-of select="substring($space80, 1, $colwidth -
string-length($value))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
--- 109,125 ----
<xsl:variable name="colwidth"><xsl:value-of
select="@width"/></xsl:variable>
<xsl:choose>
<xsl:when test="$align='right'">
! <xsl:value-of select="substring($space80, 1, $colwidth -
string-length(normalize-space($value)))"/>
! <xsl:value-of select="normalize-space($value)"/>
</xsl:when>
<xsl:when test="$align='center'">
! <xsl:value-of select="substring($space80, 1, ($colwidth -
string-length(normalize-space($value))) div 2)"/>
! <xsl:value-of select="normalize-space($value)"/>
! <xsl:value-of select="substring($space80, 1, ($colwidth -
string-length(normalize-space($value))) div 2)"/>
</xsl:when>
<xsl:otherwise>
! <xsl:value-of select="normalize-space($value)"/>
! <xsl:value-of select="substring($space80, 1, $colwidth -
string-length(normalize-space($value)))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
Index: gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GREngine.py
diff -c gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GREngine.py:1.1
gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GREngine.py:1.2
*** gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GREngine.py:1.1
Wed Nov 13 22:55:35 2002
--- gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GREngine.py Fri Dec
20 03:44:11 2002
***************
*** 1,7 ****
hiddenimports = [
! 'gnue.reports.adapters.destination.file.stdout',
! 'gnue.reports.adapters.destination.file.text',
! 'gnue.reports.adapters.destination.printer.bsd',
! 'gnue.reports.adapters.destination.fax.hylafax',
! 'gnue.reports.adapters.destination.email.smtp',
! 'gnue.reports.adapters.destination.email.sendmail']
--- 1,7 ----
hiddenimports = [
! 'gnue.reports.adapters.destinations.file.stdout',
! 'gnue.reports.adapters.destinations.file.text',
! 'gnue.reports.adapters.destinations.printer.bsd',
! 'gnue.reports.adapters.destinations.fax.hylafax',
! 'gnue.reports.adapters.destinations.email.smtp',
! 'gnue.reports.adapters.destinations.email.sendmail']
Index: gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GRFilters.py
diff -c
gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GRFilters.py:1.1
gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GRFilters.py:1.2
*** gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GRFilters.py:1.1
Wed Nov 13 22:55:35 2002
--- gnue/reports/packaging/mcmillan/hooks/hook-gnue.reports.GRFilters.py
Fri Dec 20 03:44:11 2002
***************
*** 1,8 ****
hiddenimports = [
! 'gnue.reports.adapters.filters.raw',
! 'gnue.reports.adapters.filters.merge_rtf',
! 'gnue.reports.adapters.filters.merge_ps',
! 'gnue.reports.adapters.filters.merge_psfax',
! 'gnue.reports.adapters.filters.merge_latex',
! 'gnue.reports.adapters.filters.4xslt',
! 'gnue.reports.adapters.filters.sablotron']
\ No newline at end of file
--- 1,15 ----
hiddenimports = [
! 'gnue.reports.adapters.filters.general.raw',
! 'gnue.reports.adapters.filters.general.sablotron',
! 'gnue.reports.adapters.filters.SimpleTabulation.tabulator',
! 'gnue.reports.adapters.filters.SimpleTabulation.tabulator.formatters.csv',
! 'gnue.reports.adapters.filters.SimpleTabulation.tabulator.formatters.text',
! 'gnue.reports.adapters.filters.SimpleTabulation.tabulator.formatters.html',
! 'gnue.reports.adapters.filters.SimpleTabulation.tabulator.formatters.pdf',
! 'gnue.reports.adapters.filters.MailMerge.merge_rtf',
! 'gnue.reports.adapters.filters.MailMerge.merge_ps',
! 'gnue.reports.adapters.filters.MailMerge.merge_psfax',
! 'gnue.reports.adapters.filters.MailMerge.merge_latex',
! 'gnue.reports.adapters.filters.Labels.labels',
! 'gnue.reports.adapters.filters.Labels.labels.formatters.postscript']
! # 'gnue.reports.adapters.filters.general.4xslt',
Index: gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/Adapter.py
diff -c
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/Adapter.py:1.1
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/Adapter.py:1.2
*** gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/Adapter.py:1.1
Fri Dec 13 04:24:05 2002
--- gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/Adapter.py
Fri Dec 20 03:44:11 2002
***************
*** 22,28 ****
# Adapter.py
#
# DESCRIPTION:
! # Transforms adapter for sablotron
#
# NOTES:
#
--- 22,28 ----
# Adapter.py
#
# DESCRIPTION:
! # Transforms adapter for SimpleTabulation
#
# NOTES:
#
***************
*** 52,58 ****
def close(self):
! stylesheet = os.path.join(self.parameters['_filterbase'],
'SimpleTabulation','direct.css')
# We are finished with the intermediate file, so
# close in order for sablotron to be able to open it.
--- 52,58 ----
def close(self):
! stylesheet = os.path.join(self.parameters['_filterbase'],
'SimpleTabulation','tabulator.css')
# We are finished with the intermediate file, so
# close in order for sablotron to be able to open it.
Index:
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/html.py
diff -c
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/html.py:1.1
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/html.py:1.2
***
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/html.py:1.1
Fri Dec 13 04:24:05 2002
---
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/html.py
Fri Dec 20 03:44:11 2002
***************
*** 1,180 ****
! #
! # 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 2002 Free Software Foundation
! #
! # FILE:
! # direct/formatters/html.py
! #
! # DESCRIPTION:
! # Transforms adapter for direct
! #
! # NOTES:
! #
!
! class DirectFormatter:
!
! def __init__(self, destination, stylesheet, options={}):
! self.dest = destination
! self.options = options
!
! self._reporttitle = ''
! self._sectiontitle = ''
! self.stylesheet = stylesheet
!
! def BeginReport(self):
! try:
! css = open(self.stylesheet,'r')
! style = ''.join(css.readlines())
! except:
! print "Error processing css file: %s" % self._stylesheet
! style = STYLE
!
! css.close()
!
! self.dest.write('<html>\n')
! self.dest.write(' <head>\n')
! self.dest.write(' <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8"/>\n')
! self.dest.write(' <style>\n%s </style>\n' % style)
! self.dest.write( ' </head>\n')
! self.dest.write(' <body>\n')
!
! def EndReport(self):
! self.dest.write(' </body>\n')
! self.dest.write('</html>')
!
! def BeginReportTitle(self):
! pass
!
! def EndReportTitle(self, reporttitle):
! self._reporttitle = reporttitle
! self.dest.write(' <h1>%s</h1>\n<hr>\n' % self._reporttitle)
!
! def BeginSection(self):
! pass
!
! def EndSection(self):
! pass
!
! def BeginSectionTitle(self):
! pass
!
! def EndSectionTitle(self, sectiontitle):
! self._sectiontitle = sectiontitle
! self.dest.write(' <h2>%s</h2>\n' % self._sectiontitle)
!
! def BeginTable(self):
! self._odd = 1
! self.dest.write(' <table>\n')
!
! def EndTable(self):
! self.dest.write(' </table>\n')
!
! def BeginTableHead(self):
! self._colalign = []
! self.dest.write(' <tr>\n')
!
! def EndTableHead(self):
! self.dest.write(' </tr>\n')
!
! def BeginColHead(self):
! self.dest.write(' <th ')
!
! def EndColHead(self, colhead, width, alignment=None):
! self._colalign.append(alignment)
! self.dest.write('align="%s">%s</th>\n' % (alignment, colhead))
!
! def BeginRow(self, rowtype=None):
! self._rowtype = rowtype
! if self._rowtype == 'subtotal':
! self.dest.write(' <tr class="subtotal">\n')
! else:
! if self._odd:
! self.dest.write(' <tr class="odditem">\n')
! else:
! self.dest.write(' <tr class="item">\n')
!
! def EndRow(self, rowtype=None):
! self._odd = not self._odd
! self.dest.write(' </tr>\n')
!
! def BeginCol(self):
! if self._rowtype == 'subtotal':
! self.dest.write(' <td class="subtotal" ')
! else:
! self.dest.write(' <td class="item" ')
!
! def EndCol(self, col, index):
! self.dest.write('align="%s">%s</td>\n' % (self._colalign[index], col))
!
!
! STYLE = """body {
! font-face: sans-serif;
! }
! table {
! width: 80%;
! margin-left: 10%;
! margin-right: 10%;
! border-spacing: 0;
! border-collapse: collapse;
! }
! tr.odditem {
! padding: 0.5em;
! background : lightgrey;
! color : black;
! }
! tr.subtotal {
! font-weight : bold;
! }
! td {
! padding: 0.5em;
! }
! td.item {
! padding: 0.5em;
! }
! td.subtotal {
! padding: 0.5em;
! border-style: solid;
! border-width: medium;
! border-color: black;
! border-left: 0;
! border-right: 0;
! }
! th {
! padding: 0.5em;
! border-style: solid;
! border-width: thin;
! border-color: black;
! background : black;
! color : white;
! }
! h1 {
! text-align: center;
! }
! h2 {
! margin-left: 5%;
! margin-right: 5%;
! text-align: left;
! }
! hr {
! margin-left: 5%;
! margin-right: 5%;
! }
! """
!
!
--- 1,182 ----
! #
! # 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 2002 Free Software Foundation
! #
! # FILE:
! # direct/formatters/html.py
! #
! # DESCRIPTION:
! # Transforms adapter for direct
! #
! # NOTES:
! #
!
! class DirectFormatter:
!
! def __init__(self, destination, stylesheet, options={}):
! self.dest = destination
! self.options = options
!
! self._reporttitle = ''
! self._sectiontitle = ''
! self.stylesheet = stylesheet
!
! def BeginReport(self):
! try:
! css = open(self.stylesheet,'r')
! style = ''.join(css.readlines())
! except:
! print "Error processing css file: %s" % self.stylesheet
! css = None
! style = STYLE
!
! if css:
! css.close()
!
! self.dest.write('<html>\n')
! self.dest.write(' <head>\n')
! self.dest.write(' <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8"/>\n')
! self.dest.write(' <style>\n%s </style>\n' % style)
! self.dest.write( ' </head>\n')
! self.dest.write(' <body>\n')
!
! def EndReport(self):
! self.dest.write(' </body>\n')
! self.dest.write('</html>')
!
! def BeginReportTitle(self):
! pass
!
! def EndReportTitle(self, reporttitle):
! self._reporttitle = reporttitle
! self.dest.write(' <h1>%s</h1>\n<hr>\n' % self._reporttitle)
!
! def BeginSection(self):
! pass
!
! def EndSection(self):
! pass
!
! def BeginSectionTitle(self):
! pass
!
! def EndSectionTitle(self, sectiontitle):
! self._sectiontitle = sectiontitle
! self.dest.write(' <h2>%s</h2>\n' % self._sectiontitle)
!
! def BeginTable(self):
! self._odd = 1
! self.dest.write(' <table>\n')
!
! def EndTable(self):
! self.dest.write(' </table>\n')
!
! def BeginTableHead(self):
! self._colalign = []
! self.dest.write(' <tr>\n')
!
! def EndTableHead(self):
! self.dest.write(' </tr>\n')
!
! def BeginColHead(self):
! self.dest.write(' <th ')
!
! def EndColHead(self, colhead, width, alignment=None):
! self._colalign.append(alignment)
! self.dest.write('align="%s">%s</th>\n' % (alignment, colhead))
!
! def BeginRow(self, rowtype=None):
! self._rowtype = rowtype
! if self._rowtype == 'subtotal':
! self.dest.write(' <tr class="subtotal">\n')
! else:
! if self._odd:
! self.dest.write(' <tr class="odditem">\n')
! else:
! self.dest.write(' <tr class="item">\n')
!
! def EndRow(self, rowtype=None):
! self._odd = not self._odd
! self.dest.write(' </tr>\n')
!
! def BeginCol(self):
! if self._rowtype == 'subtotal':
! self.dest.write(' <td class="subtotal" ')
! else:
! self.dest.write(' <td class="item" ')
!
! def EndCol(self, col, index):
! self.dest.write('align="%s">%s</td>\n' % (self._colalign[index], col))
!
!
! STYLE = """body {
! font-face: sans-serif;
! }
! table {
! width: 80%;
! margin-left: 10%;
! margin-right: 10%;
! border-spacing: 0;
! border-collapse: collapse;
! }
! tr.odditem {
! padding: 0.5em;
! background : lightgrey;
! color : black;
! }
! tr.subtotal {
! font-weight : bold;
! }
! td {
! padding: 0.5em;
! }
! td.item {
! padding: 0.5em;
! }
! td.subtotal {
! padding: 0.5em;
! border-style: solid;
! border-width: medium;
! border-color: black;
! border-left: 0;
! border-right: 0;
! }
! th {
! padding: 0.5em;
! border-style: solid;
! border-width: thin;
! border-color: black;
! background : black;
! color : white;
! }
! h1 {
! text-align: center;
! }
! h2 {
! margin-left: 5%;
! margin-right: 5%;
! text-align: left;
! }
! hr {
! margin-left: 5%;
! margin-right: 5%;
! }
! """
!
!
Index:
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/pdf.py
diff -c
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/pdf.py:1.1
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/pdf.py:1.2
***
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/pdf.py:1.1
Fri Dec 13 04:24:05 2002
---
gnue/reports/src/adapters/filters/SimpleTabulation/tabulator/formatters/pdf.py
Fri Dec 20 03:44:11 2002
***************
*** 1,205 ****
! #
! # 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 2002 Free Software Foundation
! #
! # FILE:
! # direct/formatters/pdf.py
! #
! # DESCRIPTION:
! # Transforms adapter for direct
! #
! # NOTES:
! # DocTemplates: contain one or more PageTemplates
! # PageTemplates: contain one or more Frames
! # Frames: contain flowables, like Paragraph or Table
! #
!
! try:
! from reportlab.pdfgen import canvas
! except ImportError:
! print "Unable to load reportlab"
! sys.exit()
!
! from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
! from reportlab.platypus import Table, Paragraph
! from reportlab.platypus.frames import Frame
! from reportlab.lib.styles import getSampleStyleSheet
! from reportlab.rl_config import defaultPageSize
! from reportlab.lib import colors
! from reportlab.lib.units import cm
!
! PAGE_WIDTH = defaultPageSize[0]
! PAGE_HEIGHT = defaultPageSize[1]
!
! class DirectFormatter:
!
! def __init__(self, destination, stylesheet, options={}):
! self.dest = destination
! self.options = options
!
! self._reporttitle = ''
! self._sectiontitle = ''
! # TODO
! # self.stylesheet = stylesheet
!
!
! # Used to paint non-flowing (i.e standard) parts of pages
! def myPages(self, canvas, doc):
! canvas.saveState()
!
! # first frame for title and sectiontitle
! f1 = Frame(self._doc.leftMargin-cm,
self._doc.bottomMargin+self._doc.height-0.4*cm,
! self._doc.width+2*cm, 2.5*cm,
! leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0,
! id='title', showBoundary=0)
! p1 = Paragraph(self._reporttitle, getSampleStyleSheet()["Title"])
!
! canvas.setStrokeColor(colors.grey)
! canvas.line(self._doc.leftMargin-cm,
self._doc.bottomMargin+self._doc.height+1.0*cm,
! self._doc.leftMargin+self._doc.width+cm,
self._doc.bottomMargin+self._doc.height+1.0*cm)
! p2 = Paragraph(self._sectiontitle, getSampleStyleSheet()["Heading2"])
! f1.addFromList([p1, p2], canvas)
!
! # second frame for table heading
! f2 = Frame(self._doc.leftMargin,
self._doc.bottomMargin+self._doc.height-cm,
! self._doc.width, 0.65*cm,
! leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0,
! id='head', showBoundary=0)
!
! # white on black for table heading
! Style = [elem for elem in self._tableStyle]
! Style.append(('BACKGROUND', (0,0), (-1,-1), colors.black))
! Style.append(('TEXTCOLOR', (0,0), (-1,-1), colors.white))
!
! t = Table([self._tableHead], colWidths=self._colwidth, style=Style)
! f2.addFromList([t], canvas)
!
! # page numbering
! canvas.drawCentredString(PAGE_WIDTH/2, 0.5*cm, "-%d-" % doc.page)
! canvas.restoreState()
!
!
! def BeginReport(self):
! self._doc = BaseDocTemplate(self.dest)
! self._body = []
!
!
! def EndReport(self):
! # third frame for table body
! frame = Frame(self._doc.leftMargin, self._doc.bottomMargin,
! self._doc.width, self._doc.height-cm,
! leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0,
! id='body', showBoundary=0)
! pt = PageTemplate(id='All', frames=frame, onPage=self.myPages,
pagesize=self._doc.pagesize)
! self._doc.addPageTemplates(pt)
! self._doc.build(self._body)
!
!
! def BeginReportTitle(self):
! pass
!
!
! def EndReportTitle(self, reporttitle):
! self._reporttitle = reporttitle
!
!
! def BeginSection(self):
! pass
!
!
! def EndSection(self):
! pass
!
!
! def BeginSectionTitle(self):
! pass
!
!
! def EndSectionTitle(self, sectiontitle):
! self._sectiontitle = sectiontitle
!
!
! def BeginTable(self):
! self._odd = 1
!
!
! def EndTable(self):
! pass
!
!
! def BeginTableHead(self):
! self._tableAlign = []
! self._tableHead = []
! self._colwidth = []
! self._headwidth = 0
! self._numCols = 0
!
! def EndTableHead(self):
! self._tableStyle = []
! for i in range(self._numCols):
! self._tableStyle.append(('ALIGN', (i, 0), (i, 0),
self._tableAlign[i].upper()))
! self._colwidth[i] = (self._doc.width/self._headwidth)*self._colwidth[i]
!
! self._oddStyle = [elem for elem in self._tableStyle]
! self._oddStyle.append(('BACKGROUND', (0,0), (-1,-1), colors.lightgrey))
! self._oddStyle.append(('TEXTCOLOR', (0,0), (-1,-1), colors.black))
!
! self._subtotalStyle = [elem for elem in self._tableStyle]
! self._subtotalStyle.append(('LINEABOVE', (0,0), (-1,-1), 0.25,
colors.black))
! self._subtotalStyle.append(('FONTNAME', (0,0), (-1,-1), 'Helvetica-Bold'))
!
! def BeginColHead(self):
! pass
!
!
! def EndColHead(self, colhead, width, alignment=None):
! self._tableHead.append(colhead)
! self._tableAlign.append(alignment)
! self._colwidth.append(width)
! self._headwidth += width
! self._numCols += 1
!
!
! def BeginRow(self, rowtype=None):
! self._row = []
! if rowtype == 'subtotal':
! self._rowStyle = self._subtotalStyle
! else:
! if self._odd:
! self._rowStyle = self._oddStyle
! else:
! self._rowStyle = self._tableStyle
!
!
! def EndRow(self):
! t = Table([self._row], colWidths=self._colwidth, style=self._rowStyle)
! self._body.append(t)
! self._odd = not self._odd
!
!
! def BeginCol(self):
! pass
!
!
! def EndCol(self, col, index):
! self._row.append(col)
!
!
!
!
--- 1,207 ----
! #
! # 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 2002 Free Software Foundation
! #
! # FILE:
! # direct/formatters/pdf.py
! #
! # DESCRIPTION:
! # Transforms adapter for direct
! #
! # NOTES:
! # DocTemplates: contain one or more PageTemplates
! # PageTemplates: contain one or more Frames
! # Frames: contain flowables, like Paragraph or Table
! #
!
! import sys
!
! try:
! from reportlab.pdfgen import canvas
! except ImportError:
! print "Unable to load reportlab"
! sys.exit()
!
! from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
! from reportlab.platypus import Table, Paragraph
! from reportlab.platypus.frames import Frame
! from reportlab.lib.styles import getSampleStyleSheet
! from reportlab.rl_config import defaultPageSize
! from reportlab.lib import colors
! from reportlab.lib.units import cm
!
! PAGE_WIDTH = defaultPageSize[0]
! PAGE_HEIGHT = defaultPageSize[1]
!
! class DirectFormatter:
!
! def __init__(self, destination, stylesheet, options={}):
! self.dest = destination
! self.options = options
!
! self._reporttitle = ''
! self._sectiontitle = ''
! # TODO
! # self.stylesheet = stylesheet
!
!
! # Used to paint non-flowing (i.e standard) parts of pages
! def myPages(self, canvas, doc):
! canvas.saveState()
!
! # first frame for title and sectiontitle
! f1 = Frame(self._doc.leftMargin-cm,
self._doc.bottomMargin+self._doc.height-0.4*cm,
! self._doc.width+2*cm, 2.5*cm,
! leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0,
! id='title', showBoundary=0)
! p1 = Paragraph(self._reporttitle, getSampleStyleSheet()["Title"])
!
! canvas.setStrokeColor(colors.grey)
! canvas.line(self._doc.leftMargin-cm,
self._doc.bottomMargin+self._doc.height+1.0*cm,
! self._doc.leftMargin+self._doc.width+cm,
self._doc.bottomMargin+self._doc.height+1.0*cm)
! p2 = Paragraph(self._sectiontitle, getSampleStyleSheet()["Heading2"])
! f1.addFromList([p1, p2], canvas)
!
! # second frame for table heading
! f2 = Frame(self._doc.leftMargin,
self._doc.bottomMargin+self._doc.height-cm,
! self._doc.width, 0.65*cm,
! leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0,
! id='head', showBoundary=0)
!
! # white on black for table heading
! Style = [elem for elem in self._tableStyle]
! Style.append(('BACKGROUND', (0,0), (-1,-1), colors.black))
! Style.append(('TEXTCOLOR', (0,0), (-1,-1), colors.white))
!
! t = Table([self._tableHead], colWidths=self._colwidth, style=Style)
! f2.addFromList([t], canvas)
!
! # page numbering
! canvas.drawCentredString(PAGE_WIDTH/2, 0.5*cm, "-%d-" % doc.page)
! canvas.restoreState()
!
!
! def BeginReport(self):
! self._doc = BaseDocTemplate(self.dest)
! self._body = []
!
!
! def EndReport(self):
! # third frame for table body
! frame = Frame(self._doc.leftMargin, self._doc.bottomMargin,
! self._doc.width, self._doc.height-cm,
! leftPadding=0, bottomPadding=0, rightPadding=0,
topPadding=0,
! id='body', showBoundary=0)
! pt = PageTemplate(id='All', frames=frame, onPage=self.myPages,
pagesize=self._doc.pagesize)
! self._doc.addPageTemplates(pt)
! self._doc.build(self._body)
!
!
! def BeginReportTitle(self):
! pass
!
!
! def EndReportTitle(self, reporttitle):
! self._reporttitle = reporttitle
!
!
! def BeginSection(self):
! pass
!
!
! def EndSection(self):
! pass
!
!
! def BeginSectionTitle(self):
! pass
!
!
! def EndSectionTitle(self, sectiontitle):
! self._sectiontitle = sectiontitle
!
!
! def BeginTable(self):
! self._odd = 1
!
!
! def EndTable(self):
! pass
!
!
! def BeginTableHead(self):
! self._tableAlign = []
! self._tableHead = []
! self._colwidth = []
! self._headwidth = 0
! self._numCols = 0
!
! def EndTableHead(self):
! self._tableStyle = []
! for i in range(self._numCols):
! self._tableStyle.append(('ALIGN', (i, 0), (i, 0),
self._tableAlign[i].upper()))
! self._colwidth[i] = (self._doc.width/self._headwidth)*self._colwidth[i]
!
! self._oddStyle = [elem for elem in self._tableStyle]
! self._oddStyle.append(('BACKGROUND', (0,0), (-1,-1), colors.lightgrey))
! self._oddStyle.append(('TEXTCOLOR', (0,0), (-1,-1), colors.black))
!
! self._subtotalStyle = [elem for elem in self._tableStyle]
! self._subtotalStyle.append(('LINEABOVE', (0,0), (-1,-1), 0.25,
colors.black))
! self._subtotalStyle.append(('FONTNAME', (0,0), (-1,-1), 'Helvetica-Bold'))
!
! def BeginColHead(self):
! pass
!
!
! def EndColHead(self, colhead, width, alignment=None):
! self._tableHead.append(colhead)
! self._tableAlign.append(alignment)
! self._colwidth.append(width)
! self._headwidth += width
! self._numCols += 1
!
!
! def BeginRow(self, rowtype=None):
! self._row = []
! if rowtype == 'subtotal':
! self._rowStyle = self._subtotalStyle
! else:
! if self._odd:
! self._rowStyle = self._oddStyle
! else:
! self._rowStyle = self._tableStyle
!
!
! def EndRow(self):
! t = Table([self._row], colWidths=self._colwidth, style=self._rowStyle)
! self._body.append(t)
! self._odd = not self._odd
!
!
! def BeginCol(self):
! pass
!
!
! def EndCol(self, col, index):
! self._row.append(col)
!
!
!
!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/reports filters/SimpleTabulation/text.xsl ...,
Bajusz Tamás <=