o
    ¬+ Z¨3  ã                   @   sž   d Z dZddlmZ ddlT ddlT ddlmZmZm	Z	m
Z
mZmZmZmZ ddlmZ ddlmZ ddlmZ G d	d
„ d
eƒZdd„ ZedkrMeƒ  dS dS )z3.3.0zThis file is a
é    )Úcolors)Ú*)ÚLineÚRectÚPolygonÚDrawingÚGroupÚStringÚCircleÚWedge)ÚLabel)ÚWidget)Ú	renderPDFc                   @   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ÚdataÚ
trackNamesÚ	startTimeÚendTimeÚdayÚ_talksVisibleÚ
_startTimeÚ_endTimeÚ_trackCountÚ
_colWidthsÚ_colLeftEdges)Úself© r$   úU/var/www/html/env/lib/python3.10/site-packages/reportlab/graphics/widgets/eventcal.pyÚ__init__   s"   
zEventCalendar.__init__c                 C   sÖ   |   | j¡| _t|  ¡ ƒ| _|  ¡  | jg| _| j	du rB| j
d| j  }|gd| j  | _t| jƒD ]}| j | jd | ¡ q2dS | j	g| _| j
| j	 | j }t| jƒD ]}| j |¡ | j | jd | ¡ qUd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 ]\}}}}}}| jdu r|| _q|| jk r$|| _q| jr.| j| _dS | jD ]\}}}}}}| jdu rD|| | _q1|| | jkrP|| | _q1dS )z(Work out first and last times to displayN)r   r   r   r   r   )r#   ÚtitleÚspeakerÚtrackIdr   ÚstartÚdurationr$   r$   r%   r,   C   s"   


€

€ûz%EventCalendar.computeStartAndEndTimesc                 C   sB   g }| j D ]\}}}}}}|d ur||vr| |¡ q| ¡  |S )N)r   r.   Úsort)r#   Útracksr2   r3   r4   r   Úhoursr6   r$   r$   r%   r+   ]   s   
€zEventCalendar.getAllTracksc           
      C   sr   g }|D ]2}|\}}}}}}	|dksJ dƒ‚|| j kr6| jdu s'||	 | jkr6| jdu s1|| jkr6| |¡ q|S )zScans for tracks actually usedr   z2trackId must be None or 1,2,3... zero not allowed!N)r   r   r   r.   )
r#   ÚtalkListÚusedÚtalkr2   r3   r4   r   r9   r6   r$   r$   r%   r)   f   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#   ÚtheTimeÚ
axisHeightÚproportionUpr   r$   r$   r%   Ú	scaleTimer   s   zEventCalendar.scaleTimec                 C   sÎ   t ƒ }|  || ¡}|  |¡}|| }|du r%| 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é   ©Ú	fillColor)r   r@   r"   r   r!   r   ÚsetTextÚ	setOriginÚ	boxAnchorr   ÚfontSizer   r   ÚcyanÚadd)r#   r   r6   r4   ÚtextÚgÚy_bottomÚy_topÚy_heightr   r   ÚlabÚrr$   r$   r%   ÚgetTalkRect{   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 ]0}| j|d  }t|||| jt	jd�}t|d|  |d| dd�}| |¡ | |¡ || }q3| jD ]}|\}	}
}}}}|  ||||	d |
 ¡}| |¡ qg|S )	Nr   rD   r'   rA   zTrack %dÚmiddle)ÚalignÚ
)r1   r   rK   r   r   r   r!   r   r   r   Úcornsilkr-   r    Úyellowr	   r   rS   )r#   rM   r   r   ÚtrkÚwidrR   Úsr<   r2   r3   r4   r   r5   r6   r$   r$   r%   Údrawœ   s"   ,



zEventCalendar.drawN)Ú__name__Ú
__module__Ú__qualname__r&   r1   r,   r+   r)   r@   rS   r\   r$   r$   r$   r%   r      s    		!r   c                  C   sn   t ddƒ} tƒ }d|_d|_g d¢|_d|_|  |¡ dD ]}|  |¡}td| d	ƒ 	|¡ t
d
| ƒ qdS )z3Make a conference event for day 1 of UP Python 2003i�  éÈ   é2   é   )B)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'   re   rf   )zPattern Experiences in C++zMark Radfordé   r'   re   rf   )z"What is the Type of std::toupper()zGabriel Dos Reisé   r'   re   rf   )z6Linguistic Variables: Clear Thinking with Fuzzy Logic zWalter Banksé   r'   re   rf   )ú0lunch, short presentations, vendor presentationsÚ Nr'   ç      (@ç       @)zCORBA? Isn't that obsoletezDuncan Grisbyr'   r'   ç      ,@rf   )zPython Design PatternsúDuncan Boothrg   r'   ro   rf   )z*Inside Security Checks and Safe ExceptionsúBrandon Brayrh   r'   ro   rf   )zStudying at a DistanceúCPanel Discussion, Panel to include Alan Lenton & Francis Glassborowri   r'   ro   rf   )zRCoding Standards - Given the ANSI C Standard why do I still need a coding StandardúRandy Marquesrj   r'   ro   rf   )zRESTful PythonzHamish Lawsonr'   r'   ç      0@rf   )z(Parsing made easier - a radical old ideazAndrew Koenigrg   r'   rt   rf   )zC++ & MultimethodszJulian Smithrh   r'   rt   rf   )zC++ ThreadingzKevlin Henneyri   r'   rt   rf   )zThe Organisation Strikes BackzAlan Griffiths & Sarah Leesrj   r'   rt   rf   )úBirds of a Feather meetingrl   Nr'   ç     €1@rn   )zKeynote: In the Spirit of CzGreg ColvinNrg   rc   rd   )z6The Infinite Filing Cabinet - object storage in PythonzJacob Hallenr'   rg   re   rf   )z>Introduction to Python and Jython for C++ and Java ProgrammerszAlex Martellirg   rg   re   rf   )z#Template metaprogramming in HaskellzSimon Peyton Jonesrh   rg   re   rf   )zQPlenty People Programming: C++ Programming in a Group, Workshop with a differencezNico Josuttisri   rg   re   rf   )z4Design and Implementation of the Boost Graph LibraryzJeremy Siekrj   rg   re   rf   )rk   rl   Nrg   rm   rn   )z5Building GUI Applications with PythonCard and PyCrustz	Andy Toddr'   rg   ro   rf   )zIntegrating Python, C and C++rp   rg   rg   ro   rf   )z!Secrets and Pitfalls of Templatesz$Nicolai Josuttis & David Vandevoorderh   rg   ro   rf   )zBeing a Mentorrr   ri   rg   ro   rf   )zThe Embedded C Extensions to CzWillem Wakkerrj   rg   ro   rf   )zLightning Talksz
Paul Brianr'   rg   rt   rf   )z'Scripting Java Applications with JythonzAnthony Edenrg   rg   rt   rf   )z5Metaprogramming and the Boost Metaprogramming LibraryúDavid Abrahamsrh   rg   rt   rf   )z6A Common Vendor ABI for C++ -- GCC's why, what and notz!Nathan Sidwell & Gabriel Dos Reisri   rg   rt   rf   )zThe Timing and Cost of ChoiceszHubert Matthewsrj   rg   rt   rf   )ru   rl   Nrg   rv   rn   )z.Keynote: The Cost of C &amp; C++ CompatibilityzAndy KoenigNrh   rc   rd   )z4Prying Eyes: Generic Observer Implementations in C++úAndrei Alexandrescur'   rg   re   rf   )z.The Roadmap to Generative Programming With C++zUlrich Eiseneckerrg   rg   re   rf   )z=Design Patterns in C++ and C# for the Common Language Runtimerq   rh   rg   re   rf   )z@Extreme Hour (XH): (workshop) - Jutta Eckstein and Nico JosuttiszJutta Ecsteinri   rg   re   rf   )z.The Lambda Library : Unnamed Functions for C++zJaako Jarvirj   rg   re   rf   )rk   rl   Nrh   rm   rn   )zReflective MetaprogrammingzDaveed Vandevoorder'   rh   ro   rf   )z7Advanced Template Issues and Solutions (double session)zHerb Sutterrg   rh   ro   rh   )z/Concurrent Programming in Java (double session)zAngelika Langerrh   rh   ro   rh   )z)What can MISRA-C (2nd Edition) do for us?zChris Hillsri   rh   ro   rf   )z(C++ Metaprogramming Concepts and ResultszWalter E Brownrj   rh   ro   rf   )z3Binding C++ to Python with the Boost Python Libraryrw   r'   rh   rt   rf   )zHUsing Aspect Oriented Programming for Enterprise Application IntegrationzArno Schmidmeierri   rh   rt   rf   )zDefective C++zMarc Paternorj   rh   rt   rf   )z.Speakers' Banquet & Birds of a Feather meetingrl   Nrh   rv   rn   )z=Keynote: The Internet, Software and Computers - A Report CardzAlan LentonNri   rc   rd   )zEMulti-Platform Software Development; Lessons from the Boost librarieszBeman Dawesr'   rj   re   rf   )zThe Stability of the C++ ABIzSteve Clamagerg   rj   re   rf   )zJGeneric Build Support - A Pragmatic Approach to the Software Build Processrs   rh   rj   re   rf   )z0How to Handle Project Managers: a survival guidez	Barb Byrori   rj   re   rf   )zlunch, ACCU AGMrl   Nrj   rm   rn   )zESauce: An OO recursive descent parser; its design and implementation.z
Jon Jaggerr'   rj   ro   rf   )zKGNIRTS ESAC REWOL -  Bringing the UNIX filters to the C++ iostream library.zJC van Winkelrg   rj   ro   rf   )z Pattern Writing: Live and DirectzFrank Buschmann & Kevlin Henneyrh   rj   ro   g      @)z5The Future of Programming Languages - A Goldfish BowlzFrancis Glassborow and friendsrh   rj   ro   rf   )zSHoney, I Shrunk the Threads: Compile-time checked multithreaded transactions in C++rx   r'   rj   rt   rf   )z#Fun and Functionality with FunctorszLois Goldthwaiterg   rj   rt   rf   )zAgile Enough?zAlan Griffithsri   rj   rt   rf   )z+Conference Closure: A brief plenary sessionrl   Nrj   rv   rA   r'   )Úpdfzeventcal.%sÚwbzsaved eventcal.%sN)r   r   r   r   r   r   rK   ÚasStringÚopenÚwriteÚprint)ÚdÚcalÚformatÚoutr$   r$   r%   Útest¹   s   

c

ýrƒ   Ú__main__N)Ú__version__Ú__doc__Úreportlab.libr   Úreportlab.lib.validatorsÚreportlab.lib.attrmapÚreportlab.graphics.shapesr   r   r   r   r   r	   r
   r   Ú$reportlab.graphics.charts.textlabelsr   Úreportlab.graphics.widgetbaser   Úreportlab.graphicsr   r   rƒ   r]   r$   r$   r$   r%   Ú<module>   s   ( %v
ÿ