U
    [e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   e/var/www/html/services/stratfitenv/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 |  qd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|  qdLS )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 DistanceCPanel 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