o
    vh3                     @   sr   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r7e  dS 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data
trackNames	startTimeendTimeday_talksVisible
_startTime_endTime_trackCount
_colWidths_colLeftEdges)self r   a/var/www/html/hyperkenya/venv/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&   >   s"   




z%EventCalendar.computeStartAndEndTimesc                 C   sB   g }| j D ]\}}}}}}|d ur||vr|| q|  |S )N)r   r(   sort)r   tracksr,   r-   r.   r   hoursr0   r   r   r   r%   X   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talkr,   r-   r.   r   r3   r0   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   theTime
axisHeightproportionUpr   r   r   r   	scaleTimem   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   r0   r.   textgy_bottomy_topy_heightr   r   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 ]0}| j|d  }t|||| jt	jd}t|d|  |d| dd}|| || || }q3| jD ]}|\}	}
}}}}| ||||	d |
 }|| qg|S )	Nr   r>   r!   r;   zTrack %dmiddle)align
)r+   r   rE   r   r   r   r   r   r   r   cornsilkr'   r   yellowr   r   rM   )r   rG   r   r   trkwidrL   sr6   r,   r-   r.   r   r/   r0   r   r   r   draw   s"   ,



zEventCalendar.drawN)__name__
__module____qualname__r    r+   r&   r%   r#   r:   rM   rV   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!   r_   r`   )zPattern Experiences in C++zMark Radford   r!   r_   r`   )z"What is the Type of std::toupper()zGabriel Dos Reis   r!   r_   r`   )z6Linguistic Variables: Clear Thinking with Fuzzy Logic zWalter Banks   r!   r_   r`   )0lunch, short presentations, vendor presentations Nr!         (@       @)zCORBA? Isn't that obsoletezDuncan Grisbyr!   r!         ,@r`   )zPython Design PatternsDuncan Boothra   r!   ri   r`   )z*Inside Security Checks and Safe ExceptionsBrandon Brayrb   r!   ri   r`   )zStudying at a DistanceCPanel Discussion, Panel to include Alan Lenton & Francis Glassborowrc   r!   ri   r`   )zRCoding Standards - Given the ANSI C Standard why do I still need a coding StandardRandy Marquesrd   r!   ri   r`   )zRESTful PythonzHamish Lawsonr!   r!         0@r`   )z(Parsing made easier - a radical old ideazAndrew Koenigra   r!   rn   r`   )zC++ & MultimethodszJulian Smithrb   r!   rn   r`   )zC++ ThreadingzKevlin Henneyrc   r!   rn   r`   )zThe Organisation Strikes BackzAlan Griffiths & Sarah Leesrd   r!   rn   r`   )Birds of a Feather meetingrf   Nr!        1@rh   )zKeynote: In the Spirit of CzGreg ColvinNra   r]   r^   )z6The Infinite Filing Cabinet - object storage in PythonzJacob Hallenr!   ra   r_   r`   )z>Introduction to Python and Jython for C++ and Java ProgrammerszAlex Martellira   ra   r_   r`   )z#Template metaprogramming in HaskellzSimon Peyton Jonesrb   ra   r_   r`   )zQPlenty People Programming: C++ Programming in a Group, Workshop with a differencezNico Josuttisrc   ra   r_   r`   )z4Design and Implementation of the Boost Graph LibraryzJeremy Siekrd   ra   r_   r`   )re   rf   Nra   rg   rh   )z5Building GUI Applications with PythonCard and PyCrustz	Andy Toddr!   ra   ri   r`   )zIntegrating Python, C and C++rj   ra   ra   ri   r`   )z!Secrets and Pitfalls of Templatesz$Nicolai Josuttis & David Vandevoorderb   ra   ri   r`   )zBeing a Mentorrl   rc   ra   ri   r`   )zThe Embedded C Extensions to CzWillem Wakkerrd   ra   ri   r`   )zLightning Talksz
Paul Brianr!   ra   rn   r`   )z'Scripting Java Applications with JythonzAnthony Edenra   ra   rn   r`   )z5Metaprogramming and the Boost Metaprogramming LibraryDavid Abrahamsrb   ra   rn   r`   )z6A Common Vendor ABI for C++ -- GCC's why, what and notz!Nathan Sidwell & Gabriel Dos Reisrc   ra   rn   r`   )zThe Timing and Cost of ChoiceszHubert Matthewsrd   ra   rn   r`   )ro   rf   Nra   rp   rh   )z.Keynote: The Cost of C &amp; C++ CompatibilityzAndy KoenigNrb   r]   r^   )z4Prying Eyes: Generic Observer Implementations in C++Andrei Alexandrescur!   ra   r_   r`   )z.The Roadmap to Generative Programming With C++zUlrich Eiseneckerra   ra   r_   r`   )z=Design Patterns in C++ and C# for the Common Language Runtimerk   rb   ra   r_   r`   )z@Extreme Hour (XH): (workshop) - Jutta Eckstein and Nico JosuttiszJutta Ecsteinrc   ra   r_   r`   )z.The Lambda Library : Unnamed Functions for C++zJaako Jarvird   ra   r_   r`   )re   rf   Nrb   rg   rh   )zReflective MetaprogrammingzDaveed Vandevoorder!   rb   ri   r`   )z7Advanced Template Issues and Solutions (double session)zHerb Sutterra   rb   ri   rb   )z/Concurrent Programming in Java (double session)zAngelika Langerrb   rb   ri   rb   )z)What can MISRA-C (2nd Edition) do for us?zChris Hillsrc   rb   ri   r`   )z(C++ Metaprogramming Concepts and ResultszWalter E Brownrd   rb   ri   r`   )z3Binding C++ to Python with the Boost Python Libraryrq   r!   rb   rn   r`   )zHUsing Aspect Oriented Programming for Enterprise Application IntegrationzArno Schmidmeierrc   rb   rn   r`   )zDefective C++zMarc Paternord   rb   rn   r`   )z.Speakers' Banquet & Birds of a Feather meetingrf   Nrb   rp   rh   )z=Keynote: The Internet, Software and Computers - A Report CardzAlan LentonNrc   r]   r^   )zEMulti-Platform Software Development; Lessons from the Boost librarieszBeman Dawesr!   rd   r_   r`   )zThe Stability of the C++ ABIzSteve Clamagera   rd   r_   r`   )zJGeneric Build Support - A Pragmatic Approach to the Software Build Processrm   rb   rd   r_   r`   )z0How to Handle Project Managers: a survival guidez	Barb Byrorc   rd   r_   r`   )zlunch, ACCU AGMrf   Nrd   rg   rh   )zESauce: An OO recursive descent parser; its design and implementation.z
Jon Jaggerr!   rd   ri   r`   )zKGNIRTS ESAC REWOL -  Bringing the UNIX filters to the C++ iostream library.zJC van Winkelra   rd   ri   r`   )z Pattern Writing: Live and DirectzFrank Buschmann & Kevlin Henneyrb   rd   ri   g      @)z5The Future of Programming Languages - A Goldfish BowlzFrancis Glassborow and friendsrb   rd   ri   r`   )zSHoney, I Shrunk the Threads: Compile-time checked multithreaded transactions in C++rr   r!   rd   rn   r`   )z#Fun and Functionality with FunctorszLois Goldthwaitera   rd   rn   r`   )zAgile Enough?zAlan Griffithsrc   rd   rn   r`   )z+Conference Closure: A brief plenary sessionrf   Nrd   rp   r;   r!   )pdfzeventcal.%swbzsaved eventcal.%sN)r   r	   r   r   r   r   rE   asStringopenwriteprint)dcalformatoutr   r   r   test   s   

c

r}   __main__N)__version____doc__reportlab.libr   reportlab.graphics.shapesr   r   r   r   $reportlab.graphics.charts.textlabelsr   reportlab.graphics.widgetbaser   r	   r}   rW   r   r   r   r   <module>   s    %v
