示例#1
0
bullet("""<b>Instant Python</b>.
A 6-page minimal crash course by Magnus Lie Hetland.
$http://www.hetland.org/python/instant-python.php$
""")


bullet("""<b>Dive Into Python</b>.
A free Python tutorial for experienced programmers.
$http://www.diveintopython.net/$
""")


from reportlab.lib.codecharts import SingleByteEncodingChart
from tools.docco.stylesheet import getStyleSheet
styles = getStyleSheet()
indent0_style = styles['Indent0']
indent1_style = styles['Indent1']

heading2("Goals for the 3.x release series")
disc("""ReportLab 3.0 has been produced to help in the migration to Python 3.x.  Python 3.x will
be standard in future Ubuntu releases and is gaining popularity, and a good proportion
of major Python packages now run on Python 3.  """)



bullet("""Python 3.x compatibility.  A single line of code should run on 2.7 and 3.3""")
bullet(""" __init__.py restricts to 2.7 or >=3.3""")
bullet("""__init__.py allow the import of on optional reportlab.local_rl_mods to allow monkey patching etc.""")
bullet("""rl_config now imports rl_settings & optionally local_rl_settings""")
bullet("""ReportLab C extensions now live inside reportlab; _rl_accel is no longer required. All _rl_accel imports now pass through reportlab.lib.rl_accel""")
示例#2
0
$http://www.freenetpages.co.uk/hp/alan.gauld/$
""")

bullet("""<b>Instant Python</b>.
A 6-page minimal crash course by Magnus Lie Hetland.
$http://www.hetland.org/python/instant-python.php$
""")

bullet("""<b>Dive Into Python</b>.
A free Python tutorial for experienced programmers.
$http://www.diveintopython.net/$
""")

from reportlab.lib.codecharts import SingleByteEncodingChart
from tools.docco.stylesheet import getStyleSheet
styles = getStyleSheet()
indent0_style = styles['Indent0']
indent1_style = styles['Indent1']

heading2("Goals for the 3.x release series")
disc(
    """ReportLab 3.0 has been produced to help in the migration to Python 3.x.  Python 3.x will
be standard in future Ubuntu releases and is gaining popularity, and a good proportion
of major Python packages now run on Python 3.  """)

bullet(
    """Python 3.x compatibility.  A single line of code should run on 2.7 and 3.3"""
)
bullet(""" __init__.py restricts to 2.7 or >=3.3""")
bullet(
    """__init__.py allow the import of on optional reportlab.local_rl_mods to allow monkey patching etc."""
示例#3
0
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/tools/docco/rl_doc_utils.py
__version__=''' $Id: rl_doc_utils.py 3959 2012-09-27 14:39:39Z robin $ '''


__doc__ = """
This module contains utilities for generating guides
"""

import os, sys, glob
import string

from tools.docco.rltemplate import RLDocTemplate
from tools.docco.stylesheet import getStyleSheet

styleSheet = getStyleSheet()

#from reportlab.platypus.doctemplate import SimpleDocTemplate
from reportlab.lib.units import inch
from reportlab.lib.pagesizes import letter, A4, A5, A3  # latter two for testing
from reportlab.rl_config import defaultPageSize
from reportlab.platypus import figures
from reportlab.platypus import Paragraph, Spacer, Preformatted,\
            PageBreak, CondPageBreak, Flowable, Table, TableStyle, \
            NextPageTemplate, KeepTogether, Image, XPreformatted
from reportlab.platypus.xpreformatted import PythonPreformatted
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib import colors
from reportlab.lib.sequencer import getSequencer

from tools.docco import examples
示例#4
0
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/tools/docco/rl_doc_utils.py
__version__ = ''' $Id: rl_doc_utils.py 3959 2012-09-27 14:39:39Z robin $ '''

__doc__ = """
This module contains utilities for generating guides
"""

import os, sys, glob
import string

from tools.docco.rltemplate import RLDocTemplate
from tools.docco.stylesheet import getStyleSheet

styleSheet = getStyleSheet()

#from reportlab.platypus.doctemplate import SimpleDocTemplate
from reportlab.lib.units import inch
from reportlab.lib.pagesizes import letter, A4, A5, A3  # latter two for testing
from reportlab.rl_config import defaultPageSize
from reportlab.platypus import figures
from reportlab.platypus import Paragraph, Spacer, Preformatted,\
            PageBreak, CondPageBreak, Flowable, Table, TableStyle, \
            NextPageTemplate, KeepTogether, Image, XPreformatted
from reportlab.platypus.xpreformatted import PythonPreformatted
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib import colors
from reportlab.lib.sequencer import getSequencer

from tools.docco import examples
示例#5
0
def run(infilename, outfilename):
    p = yaml.Parser()
    results = p.parseFile(infilename)

    ss = getStyleSheet()

    #now make flowables from the results
    story = []
    for thingy in results:
        typ = thingy[0]
        if typ == 'Paragraph':
            (typ2, stylename, text) = thingy
            if stylename == 'bu':
                bulletText='\267'
            else:
                bulletText=None
            try:
                style = ss[stylename]
            except KeyError:
                print('Paragraph style "%s" not found in stylesheet, using Normal instead' % stylename)
                style = ss['Normal']
            story.append(Paragraph(text, style, bulletText=bulletText))
        elif typ == 'Preformatted':
            (typ2, stylename, text) = thingy
            try:
                style = ss[stylename]
            except KeyError:
                print('Preformatted style "%s" not found in stylesheet, using Normal instead' % stylename)
                style = ss['Normal']
            story.append(Preformatted(text, style, bulletText=bulletText))
        elif typ == 'Image':
            filename = thingy[1]
            img = Image(filename)
            story.append(img)
        elif typ == 'PageBreak':
            story.append(PageBreak())
        elif typ == 'VSpace':
            height = thingy[1]
            story.append(Spacer(0, height))
        elif typ == 'NextPageTemplate':
            story.append(NextPageTemplate(thingy[1]))
        elif typ == 'Custom':
            # go find it
            searchPath = [os.getcwd()+'\\']
            (typ2, moduleName, funcName) = thingy
            found = imp.find_module(moduleName, searchPath)
            assert found, "Custom object module %s not found" % moduleName
            (file, pathname, description) = found
            mod = imp.load_module(moduleName, file, pathname, description)

            #now get the function
            func = getattr(mod, funcName)
            story.append(func())

        else:
            print('skipping',typ, 'for now')


    #print it
    doc = RLDocTemplate(outfilename, pagesize=A4)
    doc.build(story)