Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 ›tîa¯%ã @sÌdZdZdjƒZddddddd d d d g Zd Zdd„Zdd„Zdd„Zdd„Z dd„Z eeee e dœZ Gdd„dƒZ Gdd„dƒZ dadd„Zd d!„Zd"d#„Zdd$lmZeeƒ[d%d&„Zed'krÈeƒdS)(z3.3.0zHA Sequencer class counts things. It aids numbering and formatting lists.z#Sequencer getSequencer setSequencerééé éIé ééé‰iIé ZIVXLCDMcCst|dks|dkrtdƒ‚d}d }xN|rnt|dƒ\}}t|}x&|rbt|dƒ\}}t|||}q>W|d7}q"W|S) NriŸz illegal valueÚrréréÿÿÿÿ)Ú ValueErrorÚdivmodÚ _RN_TEMPLATESÚ _RN_LETTERS)ÚvalueÚstrÚbaseÚindexÚtmp©rú8/tmp/tmp4i9tl1d3/lib64/python/reportlab/lib/sequencer.pyÚ _format_Is rcCs t|ƒjƒS)N)rÚlower)ÚnumrrrÚ _format_isrcCst|ƒS)zThe simplest formatter)r)rrrrÚ _format_123"srcCs|dd}t|dƒS)zUppercase. Wraps around at 26.rééA)Úchr)rÚnrrrÚ _format_ABC&s r!cCs|dd}t|dƒS)zLowercase. Wraps around at 26.rréa)r)rr rrrÚ _format_abc+s r#)ÚIÚiÚ1ÚAÚac@sVeZdZdZdd„Zdd„Zddd„Zd d „ZeZd d „Z d d„Z dd„Z dd„Z dS)Ú_CounteraPrivate class used by Sequencer. Each counter knows its format, and the IDs of anything it resets, as well as its value. Starts at zero and increments just before you get the new value, so that it is still 'Chapter 5' and not 'Chapter 6' when you print 'Figure 5.1'cCsd|_|j|_t|_g|_dS)Nr)Ú_baseÚ_valuerÚ _formatterÚ_resets)ÚselfrrrÚ__init__@sz_Counter.__init__cCs ||_dS)N)r,)r.Z formatFuncrrrÚ setFormatterFsz_Counter.setFormatterNcCs|r ||_n|j|_dS)N)r+r*)r.rrrrÚresetIsz_Counter.resetcCs0|jd7_|j}x|jD] }|jƒqW|S)Nr)r+r-r1)r.ÚvÚcounterrrrÚnextOs   z _Counter.nextcCs|jS)N)r+)r.rrrÚ_thisWsz_Counter._thiscCs|jt|ƒƒS)zReturns next value formatted)r,r4)r.rrrÚnextfZsz_Counter.nextfcCs|j|jƒƒS)N)r,r5)r.rrrÚthisf^sz_Counter.thisfcCs||jkr|jj|ƒdS)N)r-Úappend)r.Z otherCounterrrrÚchainas z_Counter.chain)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__r/r0r1r4Ú__next__r5r6r7r9rrrrr)8s r)c@sžeZdZdZdd„Zdd„Zd$dd„Zd%d d „Zd d „Zd&d d„Z d'dd„Z d(dd„Z d)dd„Z dd„Z dd„Zd*dd„Zdd„Zdd„Zd d!„Zd"d#„ZdS)+Ú SequenceranSomething to make it easy to number paragraphs, sections, images and anything else. The features include registering new string formats for sequences, and 'chains' whereby some counters are reset when their parents. It keeps track of a number of 'counters', which are created on request: Usage:: >>> seq = layout.Sequencer() >>> seq.next('Bullets') 1 >>> seq.next('Bullets') 2 >>> seq.next('Bullets') 3 >>> seq.reset('Bullets') >>> seq.next('Bullets') 1 >>> seq.next('Figures') 1 >>> cCsi|_i|_|jƒdS)N)Ú _countersÚ _formattersÚ_reset)r.rrrr/}szSequencer.__init__cCs\|jjƒ|jjƒ|jjtttttdœƒt |j|jd�}|j jƒ|j j|ƒd|_ dS)N)r&r'r(r$r%)r@rA) r@ÚclearrAÚupdaterr!r#rrÚdictÚ__dict__Ú_defaultCounter)r.ÚdrrrrB‚s     zSequencer._resetNc Cs4y |j|Stk r.tƒ}||j|<|SXdS)zCreates one if not presentN)r@ÚKeyErrorr))r.r3ZcntrrrÚ _getCounter’s   zSequencer._getCountercCs|s |j}|j|ƒjƒS)z_Retrieves counter value but does not increment. For new counters, sets base value to 1.)rGrJr5)r.r3rrrr5›szSequencer._thiscCst|j|jƒƒS)zqRetrieves the numeric value for the given counter, then increments it by one. New counters start at one.)r4rJrG)r.rrrr>¢szSequencer.__next__c Cs.|s t|ƒS|j}z||_t|ƒS||_XdS)N)r4rG)r.r3Zdcrrrr4§szSequencer.nextcCs|s |j}|j|ƒjƒS)N)rGrJr7)r.r3rrrr7²szSequencer.thisfcCs|s |j}|j|ƒjƒS)zqRetrieves the numeric value for the given counter, then increments it by one. New counters start at one.)rGrJr6)r.r3rrrr6·szSequencer.nextfcCs ||_dS)z$Changes the key used for the defaultN)rG)r.ÚdefaultrrrÚsetDefaultCounter¾szSequencer.setDefaultCountercCs||j|<dS)z§Registers a new formatting function. The funtion must take a number as argument and return a string; fmt is a short menmonic string used to access it.N)rA)r.ÚformatÚfuncrrrÚregisterFormatÂszSequencer.registerFormatcCs|j|}|j|ƒj|ƒdS)zPSpecifies that the given counter should use the given format henceforth.N)rArJr0)r.r3rMrNrrrÚ setFormatÈs zSequencer.setFormatrcCs|s |j}||j|ƒ_dS)N)rGrJr+)r.r3rrrrr1ÎszSequencer.resetcCs"|j|ƒ}|j|ƒ}|j|ƒdS)N)rJr9)r.ÚparentÚchildÚpÚcrrrr9Ós  zSequencer.chaincCs4|dd…dkr&|dd…}|j|ƒS|j|ƒSdS)zrAllows compact notation to support the format function. s['key'] gets current value, s['key+'] increments.rNú+r r )r6r7)r.Úkeyr3rrrÚ __getitem__Øs  zSequencer.__getitem__cCs||S)z0The crowning jewels - formats multi-level lists.r)r.ÚtemplaterrrrMászSequencer.formatcCsRt|jjƒƒ}|jƒtdƒx.|D]&\}}td||jƒ|j|jƒfƒq$WdS)z-Write current state to stdout for diagnosticszSequencer dump:z2 %s: value = %d, base = %d, format example = %sN)Úlistr@ÚitemsÚsortÚprintr5r*r7)r.ZcountersrVr3rrrÚdumpås zSequencer.dump)N)N)N)N)N)N)Nr)r:r;r<r=r/rBrJr5r>r4r7r6rLrOrPr1r9rWrMr]rrrrr?es"      r?NcCstdkrtƒatS)N)Ú _sequencerr?rrrrÚ getSequencerñsr_cCs t}|a|S)N)r^)ÚseqÚsrrrÚ setSequencer÷srbcCstr tjƒdS)N)r^rBrrrrrBýsrB)Úregister_resetcsntƒ‰tdtˆƒtˆƒtˆƒfƒtdˆjdƒˆjdƒˆjdƒfƒtdtˆƒƒˆjdƒtdtˆƒtˆƒtˆƒfƒˆjƒtdtˆƒtˆƒtˆƒfƒtƒtdƒˆjd d ƒtd ˆjd ƒˆjd ƒˆjd ƒfƒd d „}tƒtdƒˆjd|ƒˆjddƒtddj‡fdd„tddƒDƒƒƒtƒtdƒˆj ddƒtdˆjdƒƒtdˆjdƒƒtdˆjdƒƒtdˆjdƒƒtdˆjdƒƒtdˆjdƒƒtdˆjdƒƒtdˆjdƒƒtƒtdƒtdˆd ƒtdˆdƒtdˆdƒtdˆd ƒtƒtd ƒtd!ƒtd"ˆƒtd"ˆƒtd"ˆƒdS)#Nz)Counting using default sequence: %d %d %dz1Counting Figures: Figure %d, Figure %d, Figure %dZfigurezBack to default again: %dZlist1zSet default to list1: %d %d %dz#Set default to None again: %d %d %dz0Creating Appendix counter with format A, B, C...ZAppendixr'z) Appendix %s, Appendix %s, Appendix %scSsd|ddS) NÚunÚdeuxÚtroisÚquatreÚcinqré)rdrerfrgrhr)rrrrÚ format_frenchsztest..format_frenchz+Defining a custom format with french words:ÚfrenchÚ FrenchListz ú c3s|]}tˆjdƒƒVqdS)rlN)rr6)Ú.0r%)rarrú sztest..réz:Chaining H1 and H2 - H2 goes back to one when H1 increasesZH1ZH2z H1 = %dz H2 = %dz-GetItem notation - append a plus to incrementz seq["Appendix"] = %sz seq["Appendix+"] = %sz Appendix+z8Finally, string format notation for nested lists. Cool!z>The expression ("Figure %(Chapter)s.%(Figure+)s" % seq) gives:z" Figure %(Chapter)s.%(Figure+)s) r?r\r4rLrPr6rOÚjoinÚranger9)rjr)rarÚtestsV      &   rsÚ__main__)Ú __version__r=ÚsplitÚ__all__rrrrrr!r#Z_type2formatterr)r?r^r_rbrBZreportlab.rl_configrcrsr:rrrrÚs6 -  0