Changeset 453
- Timestamp:
- 09/01/08 16:35:37 (3 months ago)
- Files:
-
- doc/poster/trunk/poster.py (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/poster/trunk/poster.py
r452 r453 1 1 # encoding: utf-8 2 2 """ 3 Script to generate the poster for the CNS*2007 meeting.3 Script to generate a poster about PyNN 4 4 """ 5 5 … … 18 18 import sys 19 19 import StringIO 20 21 20 22 21 class Author(object): … … 152 151 frame.addFromList(paragraph_list, poster) 153 152 153 def checkout_pyNN(): 154 svn_client = pysvn.Client() 155 svn_client.checkout(svnpath, "pyNN_%s" % VERSION) 156 os.system("ln -s pyNN_%s/src pyNN" % VERSION) 154 157 155 158 def make_users_guide(styles,x,y,width,height,_debug=False): 156 159 global poster 157 svn_client = pysvn.Client() 158 svn_client.checkout(svnpath, "pyNN") 160 checkout_pyNN() 159 161 import pyNN 160 162 import docutils.core … … 167 169 168 170 for section in "High-level API", : #"Introduction", "Installation", "Low-level API": #, "High-level API": 169 filename = "pyNN /doc/"+ section.lower().replace("-","").replace(" ","") + ".txt"171 filename = "pyNN_%s/doc/" % VERSION + section.lower().replace("-","").replace(" ","") + ".txt" 170 172 filename, xmltext = restxsl.transform.restxsl(filename, 171 173 smartPunctuation=False, … … 192 194 def make_apidocs(styles,x,y,width,height,_debug=False): 193 195 global poster 194 svn_client = pysvn.Client() 195 svn_client.checkout(svnpath, "pyNN") 196 wikidoc = imp.load_source('wikidoc', os.path.join('pyNN','doc','wikidoc.py')) 196 checkout_pyNN() 197 wikidoc = imp.load_source('wikidoc', os.path.join('pyNN_%s' % VERSION,'doc','wikidoc.py')) 197 198 import re 198 199 from pyNN import __version__ … … 231 232 else: 232 233 style = groups['style'] 233 paragraph_list += [Paragraph(content, styles[style])] 234 try: 235 paragraph_list += [Paragraph(content, styles[style])] 236 except: 237 print "Error in >%s<" % content 238 content = content.replace("<","<") ### 239 234 240 #apidoc_frame.add(Paragraph(content, styles[style]), poster) 235 241 pad = 0.5*cm … … 277 283 styles['Title'].alignment = TA_LEFT 278 284 styles['Code'].leftIndent = 0 279 svn_client = pysvn.Client() 280 svn_client.checkout(svnpath, "pyNN") 281 f = open(os.path.join('pyNN','test','VAbenchmarks.py'),'r') 285 checkout_pyNN() 286 f = open(os.path.join('pyNN_%s' % VERSION,'test','VAbenchmarks.py'),'r') 282 287 example_script = f.read() 283 288 f.close() … … 362 367 f_height += p.wrap(width-2*pad,pageheight)[1] + p.getSpaceAfter() + p.getSpaceBefore() 363 368 return f_height 369 i = 0 364 370 while calc_height() > height: 371 if i > 100: 372 print "Warning: height failed to converge after 100 iterations (final value %s)" % calc_height() 373 break 365 374 #print styles['BodyText'].fontSize 366 375 scale_style(styles['BodyText'], 0.99) 376 i += 1 367 377 scale_style(styles['BodyText'], 1/0.99) 368 378 styles['BodyText'].alignment = TA_JUSTIFY # otherwise we get a 'bad align' error … … 428 438 429 439 if __name__ == "__main__": 430 svnpath = "https://neuralensemble.kip.uni-heidelberg.de/svn/PyNN/branches/0.3" 440 VERSION = "0.4" 441 FILENAME = "poster_incf2008.pdf" 442 svnpath = "https://neuralensemble.kip.uni-heidelberg.de/svn/PyNN/branches/%s" % VERSION 431 443 DEBUG = False 432 444 … … 507 519 ##styles = getStyleSheet(36, 8) 508 520 509 poster = Canvas( "poster_cns2007.pdf",521 poster = Canvas(FILENAME, 510 522 pagesize=landscape(A0), 511 523 pageCompression=False, … … 539 551 #huge_url(poster._pagesize[0]/2.0, title_bottom/2.0, pagewidth) 540 552 553 print "--- Making API docs ---" 541 554 apiwidth = 0.25*pagewidth 542 555 x_api,y_api,w_api,h_api = make_apidocs(getStyleSheet(9,36),margins['left']+pagewidth-apiwidth, title_bottom, apiwidth, 543 556 colheight, DEBUG) 544 545 557 546 558 #make_users_guide(getStyleSheet(15),margins['left']+colwidth+colsep, title_bottom, colwidth, colheight, DEBUG) 559 560 print "--- Making example figure ---" 547 561 x_ex,y_ex,w_ex,h_ex = make_example(getStyleSheet(10.5,36), x_api-colsep, title_bottom, colwidth, colheight, DEBUG) 562 548 563 make_fancy_box(x_ex, margins['bottom'],w_ex+colsep+w_api,w_ex,y_ex-colsep-margins['bottom'],y_api-colsep-margins['bottom']) 549 564 make_example_figure("VAbenchmark_CUBA_exc.png", x_ex, y_ex-colsep, w_ex, y_ex-colsep-margins['bottom'], DEBUG) 565 print "--- Making caption ---" 550 566 make_example_figure_caption(CAPTIONS["VAbenchmark_CUBA_exc.png"], x_api-colsep, y_api-colsep, w_api+colsep, y_api-colsep-margins['bottom'], DEBUG) 551 567 552 568 print "--- Adding QA ---" 553 569 make_deflist_frame(getStyleSheet(36, 72),QA, margins['left'], title_bottom, x_ex-margins['left']-colsep, colheight, DEBUG) 554 570 … … 557 573 poster.drawCentredString(margins['left']+pagewidth/2.0, 0.2*margins['bottom'], ACKNOWLEDGEMENTS) 558 574 575 print "--- Saving poster ---" 559 576 poster.save()

