reportlab/demos/odyssey/fodyssey.py
author rgbecker
Thu, 06 Apr 2000 08:58:09 +0000
changeset 73 52c1eea5b912
child 117 fd3682228853
permissions -rw-r--r--
Paragraph formatting version of odyssey.py
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
73
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     1
###############################################################################
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     2
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     3
#	ReportLab Public License Version 1.0
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     4
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     5
#	Except for the change of names the spirit and intention of this
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     6
#	license is the same as that of Python
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     7
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     8
#	(C) Copyright ReportLab Inc. 1998-2000.
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
     9
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    10
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    11
# All Rights Reserved
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    12
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    13
# Permission to use, copy, modify, and distribute this software and its
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    14
# documentation for any purpose and without fee is hereby granted, provided
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    15
# that the above copyright notice appear in all copies and that both that
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    16
# copyright notice and this permission notice appear in supporting
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    17
# documentation, and that the name of ReportLab not be used
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    18
# in advertising or publicity pertaining to distribution of the software
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    19
# without specific, written prior permission. 
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    20
# 
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    21
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    22
# Disclaimer
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    23
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    24
# ReportLab Inc. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    25
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    26
# IN NO EVENT SHALL ReportLab BE LIABLE FOR ANY SPECIAL, INDIRECT
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    27
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    28
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    29
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    30
# PERFORMANCE OF THIS SOFTWARE. 
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    31
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    32
###############################################################################
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    33
#	$Log: fodyssey.py,v $
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    34
#	Revision 1.1  2000/04/06 08:58:09  rgbecker
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    35
#	Paragraph formatting version of odyssey.py
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    36
#
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    37
__version__=''' $Id: fodyssey.py,v 1.1 2000/04/06 08:58:09 rgbecker Exp $ '''
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    38
__doc__=''
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    39
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    40
#REPORTLAB_TEST_SCRIPT
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    41
import sys, copy, string, os
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    42
from reportlab.platypus import layout
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    43
from reportlab.lib.units import inch
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    44
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    45
styles = layout.getSampleStyleSheet()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    46
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    47
Title = "Odyssey"
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    48
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    49
Author = "Homer"
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    50
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    51
def myFirstPage(canvas, doc):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    52
	canvas.saveState()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    53
	canvas.setFont('Times-Bold',16)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    54
	canvas.drawString(108, layout.PAGE_HEIGHT-108, Title)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    55
	canvas.setFont('Times-Roman',9)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    56
	canvas.restoreState()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    57
	
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    58
def myLaterPages(canvas, doc):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    59
	canvas.saveState()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    60
	canvas.setFont('Times-Roman',9)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    61
	canvas.drawString(inch, 0.75 * inch, "Page %d" % doc.page)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    62
	canvas.restoreState()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    63
	
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    64
def go():
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    65
	doc = layout.SimpleFlowDocument('fodyssey.pdf',layout.DEFAULT_PAGE_SIZE)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    66
	doc.onFirstPage = myFirstPage
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    67
	doc.onNewPage = myLaterPages
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    68
	doc.build(Elements)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    69
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    70
Elements = []
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    71
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    72
ChapterStyle = copy.copy(styles["Heading1"])
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    73
ChapterStyle.alignment = layout.TA_CENTER
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    74
ChapterStyle.fontsize = 14
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    75
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    76
def newPage():
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    77
	Elements.append(layout.PageBreak())
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    78
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    79
def chapter(txt, style=ChapterStyle):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    80
	newPage()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    81
	Elements.append(layout.Paragraph(txt, style))
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    82
	Elements.append(layout.Spacer(0.2*inch, 0.3*inch))
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    83
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    84
ParaStyle = styles["Normal"]
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    85
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    86
def p(txt, style=ParaStyle):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    87
	Elements.append(layout.Spacer(0.2*inch, 0.1*inch))
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    88
	Elements.append(layout.Paragraph(txt, style))
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    89
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    90
PreStyle = styles["Code"] 
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    91
InitialStyle = copy.copy(PreStyle)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    92
InitialStyle.alignment = layout.TA_CENTER
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    93
InitialStyle.fontsize = 14
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    94
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    95
def pre(txt, style=PreStyle):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    96
	s = layout.Spacer(0.1*inch, 0.1*inch)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    97
	Elements.append(s)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    98
	p = layout.Preformatted(txt, PreStyle)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
    99
	Elements.append(p)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   100
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   101
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   102
def parseOdyssey(fn):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   103
	from time import time
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   104
	E = []
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   105
	t0=time()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   106
	L = open(fn,'r').readlines()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   107
	t1 = time()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   108
	print "open(%s,'r').readlines() too %.4f seconds" %(fn,t1-t0)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   109
	for i in xrange(len(L)):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   110
		if L[i][-1]=='\012':
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   111
			L[i] = L[i][:-1]
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   112
	t2 = time()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   113
	print "Removing all linefeeds took %.4f seconds" %(t2-t1)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   114
	L.append('')
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   115
	L.append('-----')
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   116
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   117
	def findNext(L, i):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   118
		while 1:
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   119
			if string.strip(L[i])=='':
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   120
				del L[i]
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   121
				kind = 1
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   122
				if i<len(L):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   123
					while string.strip(L[i])=='':
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   124
						del L[i]
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   125
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   126
					if i<len(L):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   127
						kind = L[i][-1]=='-' and L[i][0]=='-'
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   128
						if kind:
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   129
							del L[i]
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   130
							if i<len(L):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   131
								while string.strip(L[i])=='':
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   132
									del L[i]
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   133
				break
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   134
			else:
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   135
				i = i + 1
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   136
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   137
		return i, kind
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   138
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   139
	f = s = 0
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   140
	while 1:
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   141
		f, k = findNext(L,0)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   142
		if k: break
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   143
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   144
	E.append([layout.Preformatted,'The Odyssey\n\nHomer\n', InitialStyle])
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   145
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   146
	while 1:
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   147
		if f>=len(L): break
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   148
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   149
		if string.upper(L[f][0:5])=='BOOK ':
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   150
			E.append([chapter,L[f]])
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   151
			f=f+1
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   152
			while string.strip(L[f])=='': del L[f]
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   153
			style = ParaStyle
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   154
			func = p
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   155
		else:
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   156
			style = PreStyle
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   157
			func = pre
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   158
	
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   159
		while 1:
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   160
			s=f
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   161
			f, k=findNext(L,s)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   162
			sep= (func is pre) and '\012' or ' '
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   163
			E.append([func,string.join(L[s:f],sep),style])
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   164
			if k: break
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   165
	t3 = time()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   166
	print "Parsing into memory took %.4f seconds" %(t3-t2)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   167
	del L
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   168
	t4 = time()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   169
	print "Deleting list of lines took %.4f seconds" %(t4-t3)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   170
	for i in xrange(len(E)):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   171
		apply(E[i][0],E[i][1:])
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   172
	t5 = time()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   173
	print "Moving into platypus took %.4f seconds" %(t5-t4)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   174
	del E
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   175
	t6 = time()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   176
	print "Deleting list of actions took %.4f seconds" %(t6-t5)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   177
	go()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   178
	t7 = time()
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   179
	print "saving to PDF took %.4f seconds" %(t7-t6)
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   180
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   181
for fn in ('Odyssey.full.txt','Odyssey.txt'):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   182
	if os.path.isfile(fn):
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   183
		break
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   184
52c1eea5b912 Paragraph formatting version of odyssey.py
rgbecker
parents:
diff changeset
   185
parseOdyssey(fn)