³ò ™üàHc@sâdZdZdZdZdZdZdZd„Zd„Zd fd „ƒYZ d fd „ƒYZ d fd„ƒYZ dfd„ƒYZ dfd„ƒYZ dfd„ƒYZdfd„ƒYZedjoddkZddkZddkZddkZddkZd„ZeiddƒZeidddd d!d"d#d$ƒeid%d&dd'd(d)d!d*d#eƒeid+d,dd-d(d.d d/d!d0d#d1ƒeid2d3dd4d(d.d d/d!d5d#d1ƒeid6d7dd8d(d.d d/d!d9d#dƒeid:d;dd<d(d.d!d=d#d>ƒeid?d@ddAd(d.d!d=d#d>ƒeidBdCddDd(d.d!dEd#dFƒeiƒ\ZZeeƒd1joeidGƒnx0eD](Z ee!e ƒi"ƒƒZ#e#GHe#i$ƒe dHei%Z&ei%i'ƒd$jolei(e!e&dIƒd-ei)dJdKei*d<eei+ƒdDeei,ƒdLeei-ƒƒZ.e.i/e#ƒniei0e!e&dMƒd-ei)dJdKei*d'ei1dNei%d<ei+dDei,dLei-ƒZ.e.i/e#ƒq®WndS(OsÌ ASCII art to image converter. This is the main modlue that contains the parser. See svg.py and aa.py for output modules, that can render the parsed structure. (C) 2006 Chris Liechti itlinetstrtrecttjointfixedcCs‘t|tƒo|Snt|ƒtjot|i|iƒSnt|ƒtjo,t|ƒdjot|d|dƒSntdƒ‚dS(sºreturn a Point instance. - if object is already a Point instance it's returned as is - complex numbers are converted to Points - a tuple with two elements (x,y) iiiscan not convert %r to a PointN( t isinstancetPointttypetcomplextrealtimagttupletlent ValueError(tobject((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pytpoints&cCs,t|ƒdjot|ƒgSn|SdS(s:return a group if the number of shapes is greater than oneiN(R tGroup(tlist_of_shapes((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pytgroup"sRcBs eZdZd„Zd„ZRS(sdA single point. This class primary use is to represent coordinates for the other shapes. cCs||_||_dS(N(txty(tselfRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt__init__-s cCsd|i|ifS(Ns Point(%r, %r)(RR(R((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt__repr__1s(t__name__t __module__t__doc__RR(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR)s tLinecBs#eZdZed„Zd„ZRS(s>Line with starting and ending point. Both ends can have arrowscCs+||_t|ƒ|_t|ƒ|_dS(N(tthickRtstarttend(RRRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR6s cCsd|i|ifS(Ns Line(%r, %r)(RR(R((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR;s(RRRtFalseRR(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR4s t RectanglecBs eZdZd„Zd„ZRS(s#Rectangle with to edge coordiantes.cCs"t|ƒ|_t|ƒ|_dS(N(Rtp1tp2(RR!R"((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR@scCsd|i|ifS(NsRectangle(%r, %r)(R!R"(R((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRCs(RRRRR(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR >s tCirclecBs eZdZd„Zd„ZRS(s#Rectangle with to edge coordiantes.cCst|ƒ|_||_dS(N(Rtcentertradius(RR$R%((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRHscCsd|i|ifS(NsCircle(%r, %r)(R$R%(R((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRLs(RRRRR(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR#Fs tLabelcBs eZdZd„Zd„ZRS(sA label at a positioncCs||_||_dS(N(tpositionttext(RR'R(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRQs cCsd|i|ifS(Ns Label(%r, %r)(R'R((R((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRTs(RRRRR(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR&Os RcBs#eZdZdd„Zd„ZRS(sA group of shapescCs$|djo g}n||_dS(N(tNonetshapes(RR*((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRYs cCsd|ifS(Ns Group(%r)(R*(R((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR\sN(RRRR)RR(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRWs t AsciiArtImagecBsreZdZedƒZded„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „Zd „Zd„Zd„Zd„Zdd„Zd„Zd„Zdˆd‰dŠd‹dŒddŽddd‘d’d“d”d•d–d—d˜d™dšd›dœdgZed$ƒZd%„Zd&„Zd'„Zd(„Zd)„Zd*„Zd+„Zd,„Z d-„Z!d.„Z"ed/„Z#d0„Z$d1„Z%d2„Z&d3„Z'd4„Z(d5„Z)d6„Z*d7„Z+d8„Z,ed9„Z-d:„Z.d;„Z/d<„Z0d=„Z1d>„Z2d?„Z3d@„Z4dA„Z5dždŸd d¡d¢d£d¤d¥d¦d§d¨d©dªd«d¬d­d®d¯d°d±d²d³d´dµd¶d·gZ6dti7gZ8e6D]\Z9Z:e8e9e9i;ƒq~[8ƒZ<du„Z=dv„Z>dw„Z?dx„Z@d¸d¹dºgZAdti7gZBeAD]\Z9Z:eBe9që[BƒZCd„ZDd€„ZEed„ZFd‚„ZGddd»eIdƒ„ZJd„„ZKd…„ZLeed†„ZMd‡„ZNRS(¼s~This class hold a ASCII art figure and has methods to parse it. The resaulting list of shapes is also stored here. s"'`ic Cs(t|ƒ|_||_g|_d}xEt|iƒƒD]1\}}t|t|ƒƒ}|ii|ƒq:W||_ |d|_ xSt|iƒD]B\}}t|ƒ|jo#|d|t|ƒ|i|t _follow_fillt_follow_rounded_edge(RRRt character((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt recognize sT .       &  " ':+ ( cCs\||}|t|ƒ:}|t|||d|dƒt|||d|dƒgfS(sV--> return a possibly modified starting point and a list of shapes gø?yà?yà¿(tabsR(RR!R"tdirection_vector((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_standard_arrowßs  cCsd||}|t|ƒ:}||dt||d||dƒt||d||dƒgfS(s--iRctVv^oO#cCs\xU|iD]J\}}}}||jo+||jo||jot||ƒSq q WdS(s%return arrow drawing function or NoneN(t ARROW_TYPEStgetattr(RR_tdxtdytheadtddxtddyt function_name((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt get_arrow.s 'cCs|i||dtƒS(Ni(t_n_hatch_diagonalRT(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt _hatch_left6scCs|i||dtƒS(Ni(RyR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt _hatch_right7scCs,|i||dtƒ|i||dtƒS(Ni(RyRTR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt _cross_hatch8scCs|i||dtƒS(Ni(RyRT(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_double_hatch_left9scCs|i||dtƒS(Ni(RyR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_double_hatch_right:scCs,|i||dtƒ|i||dtƒS(Ni(RyRTR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_double_cross_hatch;scCs|i||dtƒS(Ni(RyRT(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_triple_hatch_left<scCs|i||dtƒS(Ni(RyR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_triple_hatch_right=scCs,|i||dtƒ|i||dtƒS(Ni(RyRTR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_triple_cross_hatch>sc CsÙdt|ƒ}g}|oÞxµt|ƒD]É}|itt|i|ƒ|i|||ƒƒt|i|||ƒ|i|ƒƒƒƒ|o`|itt|i|||ƒ|i|ƒƒt|i|ƒ|i|||ƒƒƒƒq*q*WnÛx×t|ƒD]É}|itt|i|ƒ|i|||ƒƒt|i|||ƒ|i|ƒƒƒƒ|o`|itt|i|||ƒ|i|ƒƒt|i|ƒ|i|||ƒƒƒƒqqW|S(shatch generator functioni( R-R7R4RRRDRGRFRI(RRRtnRDtdtresultti((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRy@s \h \dcCs|i||dtƒS(Ni(t_n_hatch_straightRT(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_hatch_vPscCs|i||dtƒS(Ni(R‡R(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_hatch_hQscCs,|i||dtƒ|i||dtƒS(Ni(R‡RTR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt _hv_hatchRscCs|i||dtƒS(Ni(R‡RT(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_double_hatch_vSscCs|i||dtƒS(Ni(R‡R(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_double_hatch_hTscCs,|i||dtƒ|i||dtƒS(Ni(R‡RTR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_double_hv_hatchUscCs|i||dtƒS(Ni(R‡RT(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_triple_hatch_vVscCs|i||dtƒS(Ni(R‡R(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_triple_hatch_hWscCs,|i||dtƒ|i||dtƒS(Ni(R‡RTR(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_triple_hv_hatchXsc Cs-dt|ƒ}d|d}g}|oxût|ƒD]l}||}|itt|i|||ƒ|i|ƒƒt|i|||ƒ|i|ƒƒƒƒq8Wn~xzt|ƒD]l}||}|itt|i|ƒ|i|||ƒƒt|i|ƒ|i|||ƒƒƒƒq¹W|S(shatch generator functionigð?( R-R7R4RRRDRGRIRF( RRRRƒtverticalR„toffsetR…R†((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR‡Zs  d  `cCs˜tt|i|dƒ|i|ƒƒt|i|ƒ|i|dƒƒƒtt|i|ƒ|i|dƒƒt|i|dƒ|i|ƒƒƒgS(Ng9´Èv¾Ÿæ?(RRRDRGRFRI(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt _fill_trailmsJcCsFtt|i|ƒ|i|ƒƒt|i|ƒ|i|ƒƒƒgS(N(R RRDRGRFRI(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_fill_foregroundsscCsgS(N((RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_fill_backgroundxscCs3tt|i|dƒ|i|dƒƒdƒgS(Ngà?gš™™™™™É?(R#RRDRG(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_fill_small_circlezscCs3tt|i|dƒ|i|dƒƒdƒgS(Ngà?gš™™™™™Ù?(R#RRDRG(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_fill_medium_circle~scCs3tt|i|dƒ|i|dƒƒdƒgS(Ngà?gÍÌÌÌÌÌì?(R#RRDRG(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_fill_large_circleƒscCs+tt|i|ƒ|i|ƒƒdƒgS(Nt?(R&RRDRI(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt _fill_qmarkˆsc Csútt|i|dƒ|i|dƒƒt|i|dƒ|i|dƒƒƒtt|i|dƒ|i|dƒƒt|i|dƒ|i|dƒƒƒtt|i|dƒ|i|dƒƒt|i|dƒ|i|dƒƒƒgS(Ngà?gš™™™™™É?gè?gmçû©ñÒé?gffffffæ?gÐ?(RRRDRG(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_fill_trianglessRRtARztBR{tCR|tDR}tER~tFRtGR€tHRtIR‚tJRˆtKR‰tLRŠtMR‹tNRŒRtPRŽtQRtRRtSRštTR“tUR–R—tWR˜tXR”tYR›tZR•tcCsHx5|iD]*\}}||jot||ƒSq q Wtdƒ‚dS(sreturn fill functionsno such fill typeN(t FILL_TYPESRqR (RR_RtRw((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pytget_fill²s   cCsˆtt|i|ƒ|i|ƒƒt|i|ƒ|i|ƒƒƒtt|i|ƒ|i|ƒƒt|i|ƒ|i|ƒƒƒgS(N(RRRDRHRFRGRI(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_open_triangle_left»sBcCsˆtt|i|ƒ|i|ƒƒt|i|ƒ|i|ƒƒƒtt|i|ƒ|i|ƒƒt|i|ƒ|i|ƒƒƒgS(N(RRRFRHRDRGRI(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_open_triangle_rightÀsBcCs/tt|i|ƒ|i|ƒƒtdƒgS(Ng@(R#RRERHR9(RRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt_circleÆst{R·t}R¸t*R¹cCsHx5|iD]*\}}||jot||ƒSq q Wtdƒ‚dS(sreturn fill functionsno such characterN(t FIXED_TYPESRqR (RR_RtRw((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRZÓs   cCs®|i||ddddƒ\}}}|i||ddddƒ\}}}d}} |i||dƒdjo d}n|i||dƒdjo d } n|ig} t||dƒD]}| ||fqÄ~ tƒt|i|ƒ|i||ƒƒ} t|i|ƒ|i|| ƒƒ} g} |o&|| | ƒ\} }| i |ƒn|o&|| | ƒ\} }| i |ƒn| i t | | ƒƒt | ƒS( s.find a vertical line with optional arrow headsRsitline_characterRLiÿÿÿÿiROgà¿gà?( t _follow_lineR>R@R7t CLASS_LINERRERGRIRRR4RR(RRRRMtend_ytline_end_styletstart_ytline_start_stylet start_y_fixt end_y_fixR<R!R"R*t arrow_shapes((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRVÜs&''   >%%cCsË|o d}nd}|i||ddd|ƒ\}}}|i||ddd|ƒ\}}} d} } |i|d|ƒdjo d } n|i|d|ƒdjo d } n|ig} t||dƒD]}| ||fqÛ~ tƒt|i|| ƒ|i|ƒƒ} t|i|| ƒ|i|ƒƒ}g}| o&| | |ƒ\} }|i |ƒn|o&||| ƒ\}}|i |ƒn|i t | |d |ƒƒt |ƒS( s0find a horizontal line with optional arrow headsRNRKRriR¾iÿÿÿÿiROgà¿gà?R( R¿R>R@R7RÀRRDRHRFRRR4RR(RRRRR¾tend_xRMRÂtstart_xRÄt start_x_fixt end_x_fixR<R!R"R*RÇ((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRU÷s, ''   >%%c Csò|i||dddddtƒ\}}}|i||dddddtƒ\}}}|ig}t||dƒD]}|||fqx~tƒt|i|dƒ|i|ƒƒ} t|i|dƒ|i|ƒƒ} t| | ƒgS(s³find a horizontal line, the line is aligned to the bottom and a bit wider, so that it can be used for shapes like this: ___ __| |___ RriR¾RMtarrowsiÿÿÿÿ( R¿RR@R7RÀRRERIR( RRRRÈRMRÂRÉRÄR<R!R"((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRWs -->%%c Csx|d|jo |ijnoZd|jo |ijno9|i||||ƒ|jo||7}||7}qW|ol|i||||ƒ}||ijo8|i|||ƒ}|o||7}||7}qîqød}nd}|||fS(s*helper function for all the line functionsiN(R5R6R>t ARROW_HEADSRxR)( RRRRrRsR¾RÌtfollowing_characterRÂ((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR¿$sc   c Cs¹g}x“ddfD]…\}}|i||||ƒdjoX|itt|i|ƒ|i|ƒƒt|i||ƒ|i||ƒƒƒƒqqW|i||fgtƒ|S(sadjacent '+' signs are connected with a line from center to center required for images like these: +---+ The box should be closed on all sides | +---> and the arrow start should touch the box +---+ iiRO(ii(ii(R>R4RRRERHR@t CLASS_JOIN(RRRR…RrRs((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRX8s ! 5c Cs|i|iƒƒ}|iƒ}g}g}||fg}xG|o?|iƒ\} } |i| | ƒdjo|i| | ƒ|jo3|i|| | ƒƒ|i| | fgt ƒn|i| d| ƒ|jo<|i| d| ƒdjo|i | d| fƒqmnX|oP|i t t |i | ƒ|i| ƒƒt |i | ƒ|i| ƒƒƒƒn|i| d| ƒ|jo<|i| d| ƒdjo|i | d| fƒqnX|oP|i t t |i| ƒ|i| ƒƒt |i| ƒ|i| ƒƒƒƒn|i| | dƒ|jo<|i| | dƒdjo|i | | dfƒqÍnX|oP|i t t |i| ƒ|i| ƒƒt |i | ƒ|i| ƒƒƒƒn|i| | dƒ|jo<|i| | dƒdjo|i | | dfƒq}q|oP|i t t |i| ƒ|i| ƒƒt |i | ƒ|i| ƒƒƒƒqq?q?Wt|ƒS(s±fill shapes like the ones below with a pattern. when the character is upper case, draw a border too. XXX aaa BB XXX a iN(R¶tuppertisuppertpopRCR)R>RRR@tCLASS_RECTANGLER4RRRFRGRIRDR( RR_RÉRÃtfilltborderR…R?tto_scanRR((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR]NsB PPPYc Cs0|o |i||ƒ}|d}n d}|}g}|i||ƒdjoÖ|i|i||ƒƒ|i||fgtƒt}xÿd|djo |ijnoÙ|i|d|ƒdjo¼|pY|i|d|ƒdjo | oPn| o#|i|d|ƒiƒ oPq/n|d7}|i||ƒ} | |joPn|i| ƒ| djo t }qt}qW|ddjo|d=|d8}n|ig} t ||dƒD]}| ||fqÐ~ tƒt t |i |ƒ|i|ƒƒdi|ƒƒgSngSdS(sfind a string. may contain single spaces, but the detection is aborted after more than one space. Text one "Text two" accept_anything means that all non space characters are interpreted as text. iR,iiÿÿÿÿR´N(R>R)R4R@t CLASS_STRINGRTR5RCtisalnumRR7R&RRDRIR( RRÉRRPRJtquotation_characterRR(tis_first_spaceR_R<((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyRS~sD %%&       >cCs{ g}|i||ƒdjo|i|d|ƒdjom|i||dƒdjoP|itt|i|ƒ|i|ƒƒt|i|ƒ|i|ƒƒƒƒn|i|d|ƒdjom|i||dƒdjoP|itt|i|ƒ|i|ƒƒt|i |ƒ|i|ƒƒƒƒn|púd}}|i|d|dƒdjo)t|i|dƒ|i|ƒƒ}nk|i|d|dƒdjo-t|i|dƒ|i|dƒƒ}n|i|d|dƒdjo)t|i|ƒ|i|dƒƒ}nÓ|i|d|dƒdjo%t|i|ƒ|i|ƒƒ}n|i|d|ƒdjo)t|i|dƒ|i|ƒƒ}nG|i||dƒdjo)t|i|ƒ|i|dƒƒ}n|i|d|dƒdjo-t|i|dƒ|i|dƒƒ}nk|i|d|dƒdjo-t|i|dƒ|i|dƒƒ}n|i|d|dƒdjo)t|i |ƒ|i|dƒƒ}nÓ|i|d|dƒdjo%t|i |ƒ|i|ƒƒ}n|i|d|ƒdjo)t|i|dƒ|i|ƒƒ}nG|i||dƒdjo)t|i |ƒ|i|dƒƒ}n|p|or|p%t|i|ƒ|i|ƒƒ}n|p%t|i |ƒ|i|ƒƒ}n|it||ƒƒq4qM n|i|d|ƒdjom|i||dƒdjoP|itt|i|ƒ|i|ƒƒt|i |ƒ|i|ƒƒƒƒn|i|d|ƒdjom|i||dƒdjoP|itt|i|ƒ|i|ƒƒt|i|ƒ|i|ƒƒƒƒn|púd}}|i|d|dƒdjo)t|i|dƒ|i|ƒƒ}nk|i|d|dƒdjo-t|i|dƒ|i|dƒƒ}n|i|d|dƒdjo)t|i |ƒ|i|dƒƒ}nÓ|i|d|dƒdjo%t|i |ƒ|i|ƒƒ}n|i|d|ƒdjo)t|i|dƒ|i|ƒƒ}nG|i||dƒdjo)t|i |ƒ|i|dƒƒ}n|i|d|dƒdjo-t|i|dƒ|i|dƒƒ}nk|i|d|dƒdjo-t|i|dƒ|i|dƒƒ}n|i|d|dƒdjo)t|i|ƒ|i|dƒƒ}nÓ|i|d|dƒdjo%t|i|ƒ|i|ƒƒ}n|i|d|ƒdjo)t|i|dƒ|i|ƒƒ}nG|i||dƒdjo)t|i|ƒ|i|dƒƒ}n|p|or|p%t|i |ƒ|i|ƒƒ}n|p%t|i|ƒ|i|ƒƒ}n|it||ƒƒqM n|o|i ||fgt ƒnt |ƒS(s‹check for rounded edges: /- | -\- | and also \ / etc | -/ | \- - | t/iRKRLROs\N(R>R4RRRERIRFRHRGRDR)R@RÏR(RRRR…R!R"((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR^®sª: ): ) !)!-!)!%))!-!-!)!%))%%": ): ) !)!-!)!%))!-!-!)!%))%%(Rhiis_standard_arrow(Riiÿÿÿÿis_standard_arrow(Rjiiÿÿÿÿs_standard_arrow(Rkiis_standard_arrow(Rliis_standard_arrow(Rhiÿÿÿÿis_reversed_arrow(Riiis_reversed_arrow(Rjiis_reversed_arrow(Rkiiÿÿÿÿs_reversed_arrow(Rliiÿÿÿÿs_reversed_arrow(Rmiis _circle_head(Rmiÿÿÿÿis _circle_head(Rmiiÿÿÿÿs _circle_head(Rmiis _circle_head(Rniis_large_circle_head(Rniÿÿÿÿis_large_circle_head(Rniiÿÿÿÿs_large_circle_head(Rniis_large_circle_head(Roiis_rectangular_head(Roiÿÿÿÿis_rectangular_head(Roiiÿÿÿÿs_rectangular_head(Roiis_rectangular_head(Rœs _hatch_left(Rs _hatch_right(Ržs _cross_hatch(RŸs_double_hatch_left(R s_double_hatch_right(R¡s_double_cross_hatch(R¢s_triple_hatch_left(R£s_triple_hatch_right(R¤s_triple_cross_hatch(R¥s_hatch_v(R¦s_hatch_h(R§s _hv_hatch(R¨s_double_hatch_v(R©s_double_hatch_h(Rns_double_hv_hatch(Rªs_triple_hatch_v(R«s_triple_hatch_h(R¬s_triple_hv_hatch(R­s _fill_qmark(R®s _fill_trail(R¯s_fill_small_circle(Rks_fill_medium_circle(R°s_fill_large_circle(R±s_fill_foreground(R²s_fill_triangles(R³s_fill_background(Rºs_open_triangle_left(R»s_open_triangle_right(R¼s_circleN(ORRRtlistRQRRR=R>R@RCRDRERFRGRHRIR`RcRdReRfRgRpRÍRxRzR{R|R}R~RR€RR‚RyRˆR‰RŠR‹RŒRRŽRRR‡R“R”R•R–R—R˜RšR›RµRR<tttftlowerR\R¶R·R¸R¹R½t_[2]RYRZRVRURWR)RTR¿RXR]RSR^(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyR+bsæ           ?                                   :    0     00t__main__iÿÿÿÿNcCsë|ddjoÍt|ƒdjo?g}|dD]}|t||dƒq3~\}}}qÞt|ƒdjoTg}tdt|ƒdƒD]!}|t|||d!dƒq“~\}}}qÞtd|ƒ‚n|||fS( NiRoiiiiisnot a valid color: %r(R tintR7R (t color_stringR<tctrtgtbRàRƒ((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyt decode_colors?Ttusages!%prog [options] file1 [file2 ...]s-ts--typetdestRthelpsfiletype: png, jpg, svgtdefaulttsvgs-Ds--debugtdebugtactiont store_truesenable debug outputss-ss--scaletscaletstoreR-s set scaleis-as--aspecttaspectsset aspect ratios-ls --linewidtht linewidthsset width, svg onlys-fs --foregroundt foregrounds foreground color default=#000000s#000000s-xs--fillRÔs-bs --backgroundt backgrounds foreground color default=#ffffffs#ffffffsfilename requiredt.twit line_widtht fillcolortwbt file_type(2RR9RÀR×RÓRÏR[RRRRR R#R&RR+RtpprintRítpiltaatoptparseRèt OptionParsertparsert add_optionRt parse_argstoptionstargsR terrortfilenametfiletreadtaaimgR`Rt output_nameRßtSVGOutputVisitorRñRôRõRöRÔtpiloutt visit_imagetPILOutputVisitorRî(((su/home/bert/projects/docutils/trunk/sandbox/infrastructure/update-dir/aux/htdocs/sandbox/cliechti/aafigure/aafigure.pyssŒ      ÿÿ¸          ! ! !    "