U
    -yag3  ã                   @   sn   d Z dZddlmZ ddlmZmZmZmZ ddl	m
Z
 ddlmZ G dd„ deƒZd	d
„ Zedkrjeƒ  dS )z3.3.0zThis file is a
é    )Úcolors)ÚRectÚDrawingÚGroupÚString)ÚLabel)ÚWidgetc                   @   sL   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dS )ÚEventCalendarc                 C   sj   d| _ d| _d| _d| _d | _d| _g | _d | _d | _d | _	d| _
g | _d | _d | _d| _g | _g | _d S )Nr   i,  é–   é   )ÚxÚyÚwidthÚheightÚtimeColWidthÚtrackRowHeightÚdataZ
trackNamesÚ	startTimeÚendTimeÚdayÚ_talksVisibleÚ
_startTimeÚ_endTimeÚ_trackCountÚ
_colWidthsÚ_colLeftEdges)Úself© r   úW/var/www/html/myvenv/lib/python3.8/site-packages/reportlab/graphics/widgets/eventcal.pyÚ__init__   s"    zEventCalendar.__init__c                 C   sÔ   |   | j¡| _t|  ¡ ƒ| _|  ¡  | jg| _| j	dkr‚| j
d| j  }|gd| j  | _t| jƒD ]}| j | jd | ¡ qdnN| j	g| _| j
| j	 | j }t| jƒD ]&}| j |¡ | j | jd | ¡ q¨dS )z4Called at start of draw.  Sets various column widthsNé   éÿÿÿÿ)ÚgetRelevantTalksr   r   ÚlenÚgetAllTracksr   ÚcomputeStartAndEndTimesr   r   r   r   r   ÚrangeÚappend)r   ÚwÚir   r   r   ÚcomputeSize*   s    


zEventCalendar.computeSizec                 C   s¤   | j r| j | _n:| jD ]2\}}}}}}| jdkr8|| _q|| jk r|| _q| jrZ| j| _nF| jD ]>\}}}}}}| jdkr†|| | _q`|| | jkr`|| | _q`dS )z(Work out first and last times to displayN)r   r   r   r   r   )r   ÚtitleÚspeakerÚtrackIdr   ÚstartÚdurationr   r   r   r%   >   s    




z%EventCalendar.computeStartAndEndTimesc                 C   sB   g }| j D ]*\}}}}}}|d k	r
||kr
| |¡ q
| ¡  |S )N)r   r'   Úsort)r   Ztracksr+   r,   r-   r   Úhoursr/   r   r   r   r$   X   s    zEventCalendar.getAllTracksc           
      C   sr   g }|D ]d}|\}}}}}}	|dks,t dƒ‚|| jkr| jdksN||	 | jkr| jdksb|| jkr| |¡ q|S )zScans for tracks actually usedr   z2trackId must be None or 1,2,3... zero not allowed!N)ÚAssertionErrorr   r   r   r'   )
r   ZtalkListÚusedÚtalkr+   r,   r-   r   r1   r/   r   r   r   r"   a   s    
ÿÿzEventCalendar.getRelevantTalksc                 C   s8   | j | j }|| j | j| j  }| j| ||  }|S )z+Return y-value corresponding to times given)r   r   r   r   r   )r   ZtheTimeZ
axisHeightZproportionUpr   r   r   r   Ú	scaleTimem   s    zEventCalendar.scaleTimec                 C   sÎ   t ƒ }|  || ¡}|  |¡}|| }|dkrJ| jd }	| j| jd  }
n| j| }	| j| }
tƒ }| |¡ | |	d|
  |d|  ¡ d|_|
|_||_	d|_
t|	||
|tjd�}| |¡ | |¡ |S )z!Return shapes for a specific talkNr    r   ç      à?Úcé   ©Z	fillColor)r   r5   r   r   r   r   ZsetTextZ	setOriginZ	boxAnchorr   ZfontSizer   r   ÚcyanÚadd)r   r   r/   r-   ÚtextÚgZy_bottomZy_topZy_heightr   r   ZlabÚrr   r   r   ÚgetTalkRectv   s(    






zEventCalendar.getTalkRectc              	   C   s
  |   ¡  tƒ }| t| j| j| jd | j| j t	j
d�¡ | j| jd  }| j| j | j }t| jƒD ]`}| j|d  }t|||| jt	jd�}t|d|  |d| dd�}| |¡ | |¡ || }qf| jD ]6}|\}	}
}}}}|  ||||	d |
 ¡}| |¡ qÎ|S )	Nr   r9   r    r6   zTrack %dÚmiddle)ÚalignÚ
)r*   r   r;   r   r   r   r   r   r   r   Zcornsilkr&   r   Úyellowr   r   r?   )r   r=   r   r   ZtrkZwidr>   Úsr4   r+   r,   r-   r   r.   r/   r   r   r   Údraw—   s"    ,



zEventCalendar.drawN)Ú__name__Ú
__module__Ú__qualname__r   r*   r%   r$   r"   r5   r?   rE   r   r   r   r   r	      s   		!r	   c               B   C   sî   t ddƒ} tƒ }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ddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFgB|_dG|_|  |¡ dHD ].}|  |¡}tdI| dJƒ 	|¡ t
dK| ƒ qºdLS )Mz3Make a conference event for day 1 of UP Python 2003i�  éÈ   é2   é   )z1Keynote: Why design another programming language?zGuido van RossumNr    ç      "@ç      ð?)zSiena Web Service ArchitecturezMarc-Andre Lemburgr    r    ç      %@ç      ø?)zExtreme Programming in PythonzChris Withersé   r    rN   rO   )zPattern Experiences in C++zMark Radfordé   r    rN   rO   )z"What is the Type of std::toupper()zGabriel Dos Reisé   r    rN   rO   )z6Linguistic Variables: Clear Thinking with Fuzzy Logic zWalter Banksé   r    rN   rO   )ú0lunch, short presentations, vendor presentationsÚ Nr    ç      (@ç       @)zCORBA? Isn't that obsoletezDuncan Grisbyr    r    ç      ,@rO   )zPython Design PatternsúDuncan BoothrP   r    rX   rO   )z*Inside Security Checks and Safe ExceptionsúBrandon BrayrQ   r    rX   rO   )zStudying at a DistanceúCPanel Discussion, Panel to include Alan Lenton & Francis GlassborowrR   r    rX   rO   )zRCoding Standards - Given the ANSI C Standard why do I still need a coding StandardúRandy MarquesrS   r    rX   rO   )zRESTful PythonzHamish Lawsonr    r    ç      0@rO   )z(Parsing made easier - a radical old ideazAndrew KoenigrP   r    r]   rO   )zC++ & MultimethodszJulian SmithrQ   r    r]   rO   )zC++ ThreadingzKevlin HenneyrR   r    r]   rO   )zThe Organisation Strikes BackzAlan Griffiths & Sarah LeesrS   r    r]   rO   )úBirds of a Feather meetingrU   Nr    ç     €1@rW   )zKeynote: In the Spirit of CzGreg ColvinNrP   rL   rM   )z6The Infinite Filing Cabinet - object storage in PythonzJacob Hallenr    rP   rN   rO   )z>Introduction to Python and Jython for C++ and Java ProgrammerszAlex MartellirP   rP   rN   rO   )z#Template metaprogramming in HaskellzSimon Peyton JonesrQ   rP   rN   rO   )zQPlenty People Programming: C++ Programming in a Group, Workshop with a differencezNico JosuttisrR   rP   rN   rO   )z4Design and Implementation of the Boost Graph LibraryzJeremy SiekrS   rP   rN   rO   )rT   rU   NrP   rV   rW   )z5Building GUI Applications with PythonCard and PyCrustz	Andy Toddr    rP   rX   rO   )zIntegrating Python, C and C++rY   rP   rP   rX   rO   )z!Secrets and Pitfalls of Templatesz$Nicolai Josuttis & David VandevoorderQ   rP   rX   rO   )zBeing a Mentorr[   rR   rP   rX   rO   )zThe Embedded C Extensions to CzWillem WakkerrS   rP   rX   rO   )zLightning Talksz
Paul Brianr    rP   r]   rO   )z'Scripting Java Applications with JythonzAnthony EdenrP   rP   r]   rO   )z5Metaprogramming and the Boost Metaprogramming LibraryúDavid AbrahamsrQ   rP   r]   rO   )z6A Common Vendor ABI for C++ -- GCC's why, what and notz!Nathan Sidwell & Gabriel Dos ReisrR   rP   r]   rO   )zThe Timing and Cost of ChoiceszHubert MatthewsrS   rP   r]   rO   )r^   rU   NrP   r_   rW   )z.Keynote: The Cost of C &amp; C++ CompatibilityzAndy KoenigNrQ   rL   rM   )z4Prying Eyes: Generic Observer Implementations in C++úAndrei Alexandrescur    rP   rN   rO   )z.The Roadmap to Generative Programming With C++zUlrich EiseneckerrP   rP   rN   rO   )z=Design Patterns in C++ and C# for the Common Language RuntimerZ   rQ   rP   rN   rO   )z@Extreme Hour (XH): (workshop) - Jutta Eckstein and Nico JosuttiszJutta EcsteinrR   rP   rN   rO   )z.The Lambda Library : Unnamed Functions for C++zJaako JarvirS   rP   rN   rO   )rT   rU   NrQ   rV   rW   )zReflective MetaprogrammingzDaveed Vandevoorder    rQ   rX   rO   )z7Advanced Template Issues and Solutions (double session)zHerb SutterrP   rQ   rX   rQ   )z/Concurrent Programming in Java (double session)zAngelika LangerrQ   rQ   rX   rQ   )z)What can MISRA-C (2nd Edition) do for us?zChris HillsrR   rQ   rX   rO   )z(C++ Metaprogramming Concepts and ResultszWalter E BrownrS   rQ   rX   rO   )z3Binding C++ to Python with the Boost Python Libraryr`   r    rQ   r]   rO   )zHUsing Aspect Oriented Programming for Enterprise Application IntegrationzArno SchmidmeierrR   rQ   r]   rO   )zDefective C++zMarc PaternorS   rQ   r]   rO   )z.Speakers' Banquet & Birds of a Feather meetingrU   NrQ   r_   rW   )z=Keynote: The Internet, Software and Computers - A Report CardzAlan LentonNrR   rL   rM   )zEMulti-Platform Software Development; Lessons from the Boost librarieszBeman Dawesr    rS   rN   rO   )zThe Stability of the C++ ABIzSteve ClamagerP   rS   rN   rO   )zJGeneric Build Support - A Pragmatic Approach to the Software Build Processr\   rQ   rS   rN   rO   )z0How to Handle Project Managers: a survival guidez	Barb ByrorR   rS   rN   rO   )zlunch, ACCU AGMrU   NrS   rV   rW   )zESauce: An OO recursive descent parser; its design and implementation.z
Jon Jaggerr    rS   rX   rO   )zKGNIRTS ESAC REWOL -  Bringing the UNIX filters to the C++ iostream library.zJC van WinkelrP   rS   rX   rO   )z Pattern Writing: Live and DirectzFrank Buschmann & Kevlin HenneyrQ   rS   rX   g      @)z5The Future of Programming Languages - A Goldfish BowlzFrancis Glassborow and friendsrQ   rS   rX   rO   )zSHoney, I Shrunk the Threads: Compile-time checked multithreaded transactions in C++ra   r    rS   r]   rO   )z#Fun and Functionality with FunctorszLois GoldthwaiterP   rS   r]   rO   )zAgile Enough?zAlan GriffithsrR   rS   r]   rO   )z+Conference Closure: A brief plenary sessionrU   NrS   r_   r6   r    )Zpdfzeventcal.%sÚwbzsaved eventcal.%sN)r   r	   r   r   r   r   r;   ÚasStringÚopenÚwriteÚprint)ÚdÚcalÚformatÚoutr   r   r   Útest´   sš    
¢c

rk   Ú__main__N)Ú__version__Ú__doc__Zreportlab.libr   Zreportlab.graphics.shapesr   r   r   r   Z$reportlab.graphics.charts.textlabelsr   Zreportlab.graphics.widgetbaser   r	   rk   rF   r   r   r   r   Ú<module>   s    %v