ó
k4Vdc           @   sÍ  d  Z  d d l m Z d d l m Z m Z m Z m Z m Z m	 Z	 m
 Z
 d d l m Z m Z d d l m Z m Z m Z m Z m Z m Z m Z d d l m Z d, d, d  Z d   Z d	 e f d
     YZ d e f d     YZ d e f d     YZ d   Z d   Z d   Z  d e e f d     YZ! e" d k rÉd d l# m$ Z$ d d l m Z d Z% e d d  Z& e& j' e! d d- d d, d d d  d! d" d# d$ d%   e& j( d& d' g d( d) d* d+  n  d, S(.   s   3.3.0i˙˙˙˙(   t   colors(   t   isNumbert   isColorOrNonet	   isBooleant   isListOfNumberst   OneOft   isListOfColorst   isNumberOrNone(   t   AttrMapt   AttrMapValue(   t   Drawingt   Groupt   Linet   Rectt	   LineShapet
   definePatht   EmptyClipPath(   t   Widgetc         C   sŹ   | d k r |  d } d }  n  | d k r4 d } n  g  } | | d } x] |  t |  | } | d k r{ | | k r{ Pn | d k  r | | k r Pn  | j |  qK W| S(   s6   A range function, that does accept float increments...g        g      đ?g-Cëâ6?i    N(   t   Nonet   lent   append(   t   startt   endt   inct   Lt   next(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   frange   s    
		c         C   sH   g  } x; t  t |  d    D]# } | j |  | d |  |  q W| S(   s}   Returns a list of distances between adjacent numbers in some input list.

    E.g. [1, 1, 2, 3, 5, 7] -> [0, 1, 1, 2, 2]
    i˙˙˙˙i   (   t   rangeR   R   (   t   listt   dt   i(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   makeDistancesList#   s    !t   Gridc        $   B   s  e  Z d  Z e d e e d d d e e d d d e e d d d e e d d	 d
 e e d-  d d d e e d.  d d d e e d/  d d d e e d d d e e d d d e e d d d e e d d d e e	 d d d e e	 d d d  e e d d! d" e e	 d d# d$ e e
 d d%  Z d&   Z d'   Z d(   Z d d)  Z d*   Z d+   Z d,   Z RS(0   s  This makes a rectangular grid of equidistant stripes.

    The grid contains an outer border rectangle, and stripes
    inside which can be drawn with lines and/or as solid tiles.
    The drawing order is: outer rectangle, then lines and tiles.

    The stripes' width is indicated as 'delta'. The sequence of
    stripes can have an offset named 'delta0'. Both values need
    to be positive!
    t   xt   descs!   The grid's lower-left x position.t   ys!   The grid's lower-left y position.t   widths   The grid's width.t   heights   The grid's height.t   orientationt   verticalt
   horizontals1   Determines if stripes are vertical or horizontal.t   useLinesi    i   s+   Determines if stripes are drawn with lines.t   useRectss6   Determines if stripes are drawn with solid rectangles.t   deltas+   Determines the width/height of the stripes.t   delta0s3   Determines the stripes initial width/height offset.t
   deltaStepss%   List of deltas to be used cyclically.t   stripeColorss:   Colors applied cyclically in the right or upper direction.t	   fillColors&   Background color for entire rectangle.t   strokeColors   Color used for lines.t   strokeWidths   Width used for lines.t   rectStrokeColors   Color for outer rect stroke.t   rectStrokeWidths   Width for outer rect stroke.c         C   s   d |  _  d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ g  |  _	 t
 j |  _ t
 j t
 j t
 j g |  _ t
 j |  _ d |  _ d  S(   Ni    id   R'   i   i   i   (   R!   R#   R$   R%   R&   R)   R*   R+   R,   R-   R    t   whiteR/   t   redt   greent   blueR.   t   blackR0   R1   (   t   self(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   __init__Y   s    										c         C   s)   t  d d  } t   } | j |  | S(   Nid   (   R
   R    t   add(   R9   t   Dt   g(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   demoj   s    	c         C   s   t  |  d |  j  } t  |  d |  j  } |  j s? | r | r t |  j |  j |  j |  j  } |  j | _ | | _ | | _ | Sd  Sd  S(   NR2   R3   (
   t   getattrR0   R1   R/   R   R!   R#   R$   R%   R   (   R9   R0   R1   t   rect(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   makeOuterRectr   s    !		c         C   sú   |  j  |  j } } | r" | } n | } |  j rŁ | |  j g } d } xy | d | | k ri | d =Pn  | j | d |  j | t |  j   | d } qJ Wn  t | |  j | | |  j  } | j | |  |  j d k rö | j d |  n  | S(   s1   Returns a list of positions where to place lines.i    i˙˙˙˙i   (	   R$   R%   R-   R,   R   R   R   R+   t   insert(   R9   R   t   isXt   wt   ht   lengtht   rR   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   makeLinePosList~   s$    		) c         C   s0  t    } |  j |  j } } |  j d k r,|  j d k rŞ |  j |  j d d } xÔ | D]J } t | |  j | |  j |  } |  j	 | _	 |  j
 | _
 | j |  qY Wq,|  j d k r,|  j |  j d d } xU | D]J } t |  j | |  j | |  } |  j	 | _	 |  j
 | _
 | j |  qŘ Wq,n  | S(   Ni   R'   RC   R(   i    (   R   R$   R%   R)   R&   RH   R!   R   R#   R0   R1   R;   (   R9   t   groupRD   RE   RG   R!   t   lineR#   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   makeInnerLines   s$    	c         C   se  t    } |  j |  j } } |  j d k ra|  j } |  j d k r^ |  j |  j d d } n* |  j d k r |  j |  j d d } n  t	 |  } d } xÄ t
 t |   D]­ } |  j d k rë | | }	 t |	 |  j | | |  }
 n8 |  j d k r#| | } t |  j | | | |  }
 n  | | t |  |
 _ d  |
 _ | j |
  | d } q­ Wn  | S(   Ni   R'   RC   R(   i    (   R   R$   R%   R*   R.   R&   RH   R!   R#   R   R   R   R   R/   R   R0   R;   (   R9   RI   RD   RE   t   colsRG   t   distR   t   jR!   t   stripeR#   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   makeInnerTiles˛   s,    		

	c         C   sL   t    } | j |  j    | j |  j    | j |  j   d d | S(   Nt   namet
   _gridLines(   R   R;   RA   RP   RK   (   R9   RI   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   drawÓ   s
    	(   R'   R(   (   i    i   (   i    i   (   t   __name__t
   __module__t   __doc__R   R	   R   R   R   R   R   R   t   _attrMapR:   R>   RA   RH   RK   RP   RS   (    (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyR    0   sF   
																						!t
   DoubleGridc           B   s   e  Z d  Z e d e e d d d e e d d d e e d d d e e d d	 d
 e d d d d e d d d  Z d   Z d   Z	 d   Z
 RS(   sF   This combines two ordinary Grid objects orthogonal to each other.
    R!   R"   s!   The grid's lower-left x position.R#   s!   The grid's lower-left y position.R$   s   The grid's width.R%   s   The grid's height.t   grid0s   The first grid component.t   grid1s   The second grid component.c         C   s  d |  _  d |  _ d |  _ d |  _ t   } |  j  | _  |  j | _ |  j | _ |  j | _ d | _ d | _ d | _ d | _ d | _	 g  | _
 t j | _ t j t j t j g | _ t j | _ d | _ t   } |  j  | _  |  j | _ |  j | _ |  j | _ d | _ d | _ d | _ d | _ d | _	 g  | _
 t j | _ t j t j t j g | _ t j | _ d | _ | |  _ | |  _ d  S(   Ni    id   R'   i   i   R(   (   R!   R#   R$   R%   R    R&   R)   R*   R+   R,   R-   R    R4   R/   R5   R6   R7   R.   R8   R0   R1   RY   RZ   (   R9   t   g0t   g1(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyR:   ë   sH    																					c         C   s)   t  d d  } t   } | j |  | S(   Nid   (   R
   RX   R;   (   R9   R<   R=   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyR>     s    	c         C   sˇ   t    } |  j |  j } } | j d k rF | j d k rF | | f pO | | f } x! | D] } | j | j    qY Wx: | D]2 } | j | j    | j | j   d d q} W| S(   Ni   i    RQ   RR   (   R   RY   RZ   R*   R;   RA   RP   RK   (   R9   RI   R[   R\   t   GR=   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyRS   $  s    	6N(   RT   RU   RV   R   R	   R   R   RW   R:   R>   RS   (    (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyRX   Ţ   s   	2	t
   ShadedRectc           B   s  e  Z d  Z e d e e d d d e e d d d e e d d d e e d d	 d
 e e d  d d d e e d d d e e d d d e e d d d e e d d d e e d d d e e d d  Z	 d   Z
 d   Z d   Z d   Z RS(   s  This makes a rectangle with shaded colors between two colors.

    Colors are interpolated linearly between 'fillColorStart'
    and 'fillColorEnd', both of which appear at the margins.
    If 'numShades' is set to one, though, only 'fillColorStart'
    is used.
    R!   R"   s!   The grid's lower-left x position.R#   s!   The grid's lower-left y position.R$   s   The grid's width.R%   s   The grid's height.R&   R'   R(   s1   Determines if stripes are vertical or horizontal.t	   numShadess#   The number of interpolating colors.t   fillColorStarts   Start value of the color shade.t   fillColorEnds   End value of the color shade.R0   s   Color used for border line.R1   s   Width used for lines.t   cylinderModes#   True if shading reverses in middle.c         K   s}   d |  _  d |  _ d |  _ d |  _ d |  _ d |  _ t j |  _ t j	 |  _
 t j	 |  _ d |  _ d |  _ |  j |  d  S(   Ni    id   R'   i   i   (   R!   R#   R$   R%   R&   R_   R    t   pinkR`   R8   Ra   R0   R1   Rb   t   setProperties(   R9   t   kw(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyR:   K  s    								c         C   s)   t  d d  } t   } | j |  | S(   Nid   (   R
   R^   R;   (   R9   R<   R=   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyR>   Y  s    	c         C   s%  |  j  |  j |  j |  j |  j |  j f \ } } } } } } | d k  r | d k r | | } | } |  j d k r| | } } qn | d k  rŇ | d k rŇ | | } | } |  j d k r| | } } qn= | d k  r| d k  r| | } | } | | } | } n  | | | | | | f S(   s8   Flip rectangle's corners if width or height is negative.i    R'   R(   (   R!   R#   R$   R%   R`   Ra   R&   (   R9   R!   R#   R$   R%   R`   Ra   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   _flipRectCorners`  s"    <
 
 


c         C   sS  t    } |  j   \ } } } } } } |  j } |  j rk | d sP | d } n  t | d d  d }	 n  t |  }
 |  j d k } | rÁ | d k r¤ | g } qó t | | | | |
  } n2 | d k rŮ | g } n t | | | | |
  } xű | D]ó } | rt | | | |
 |  p5t | | | | |
  } |  j r˘| j	 |  |	 k r|t
 j | | | |	 | d |  } qĹt
 j | | | d | |	 |  } n# t
 j | | | d | d |  } | | _ | | _ d | _ | j |  qú W|  j rO|  j d k rOt | | | |  } |  j | _ |  j | _ d  | _ | j |  n  | S(   Ni   i   R'   i˙˙˙˙i    (   R   Rf   R_   Rb   t   intt   floatR&   R   R   t   indexR    t   linearlyInterpolatedColorR/   R0   R1   R;   R   (   R9   RI   R!   R#   RD   RE   t   c0t   c1R_   t   halfNumShadest   numR'   t   Vt   vRO   t   colR@   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyRS   r  sD    			
 8	&&#				(   R'   R(   (   RT   RU   RV   R   R	   R   R   R   R   RW   R:   R>   Rf   RS   (    (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyR^   4  s"   			c         C   so   | d k r |  g Sg  } | d k rk | d } x9 t  |  D]( } | j t j |  | d | |   q< Wn  | S(   s7   Return a range of intermediate colors between c0 and c1i   i    (   R   R   R    Rj   (   Rk   Rl   t   nt   Ct   limR   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt
   colorRange  s     
)c         C   s[   d } d } x( |  D]  \ } } | | 7} | | 7} q Wt  t |    } | | | | f S(   s(   compute average point of a set of pointsi    (   Rh   R   (   t   Pt   cxt   cyR!   R#   Rr   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   centroidŠ  s    
c         C   sN  d d l  m } m } m } m } t |   \ } } | d | }	 | |	  | |	  }
 } |
 | | | d  } |
 | | | d  } t t | |    } | j   | d | d } } t t | |    } | j   | d | d } } | | | | _	 | _
 | | | | _ | _ t d | |
 |
 | | | f  } | j |  | S(   sU  
    given P a sequence P of x,y coordinate pairs and an angle in degrees
    find the centroid of P and the axis at angle theta through it
    find the extreme points of P wrt axis parallel distance and axis
    orthogonal distance. Then compute the least rectangle that will still
    enclose P when rotated by angle.

    The class R
    i˙˙˙˙(   t   pit   cost   sint   tang     f@c         S   s$   |  \ } } | | | | | | S(   N(    (   t   xyt   st   ct   x0t   y0R!   R#   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   parallelAxisDistÁ  s    c         S   s$   |  \ } } | | | | | | S(   N(    (   R~   R   R   R   R   R!   R#   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   orthogonalAxisDistÄ  s    i    t	   transform(   t   mathRz   R{   R|   R}   Ry   R   t   mapt   sortR!   R$   R#   R%   R   R;   (   Rv   t   angleR@   Rz   R{   R|   R}   R   R   t   thetaR   R   R   R   R   t   a0t   a1t   b0t   b1R=   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   rotatedEnclosingRectł  s"    
"

"t   ShadedPolygonc           B   s   e  Z e d  e d e e d d d e e  d e e  d e e d d d e e d d	 d
 e e   Z	 d   Z
 d   Z RS(   t   BASER   R"   s   Shading angleR`   Ra   R_   s#   The number of interpolating colors.Rb   s#   True if shading reverses in middle.t   pointsc         K   sb   d |  _  t j |  _ t j |  _ d |  _ d |  _ d d d d d d g |  _ t	 j
 |  |  d  S(   NiZ   i    i2   i˙˙˙˙i   i   (   R   R    R5   R`   R6   Ra   Rb   R_   R   R   R:   (   R9   Re   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyR:   Ý  s    			c   	      C   s  |  j  } t t | d  t d t |  d    } t d | d g g  | d D] } d | ^ qR d g d d  d	 d  } d | _ t   } | j	 |  |  j
 } d
 } | d k rÂ d } n | d k rÝ d } d } n  t d d d	 d  d |  } x' d D] } t | | t |  |   q˙ W| j	 t | | |   | j	 t  | j   } d | _ |  j | _ |  j | _ | j	 |  | S(   Nc         S   s   | |  | |  d f S(   Ni   (    (   R   Rv   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   <lambda>č  t    i    i   t   moveToi   t   lineTot	   closePathR/   R0   R'   i´   iZ   i  R(   R1   R&   R`   Ra   R_   Rb   (   R   (   R   (   iZ   i  (   R`   Ra   R_   Rb   (   R   R   R   R   R   R   R   t
   isClipPathR   R;   R   R^   t   setattrR?   R   R   t   copyR0   R1   (	   R9   Rv   R!   t   pathR=   R   R&   R@   t   k(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyRS   ć  s2    	-:						(   RT   RU   R   R   R	   R   R   R   R   RW   R:   RS   (    (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyR   Ó  s   		t   __main__(   R7   (   R
   i-   ix   R   i
   i<   in   R0   R1   i   R   iZ   R_   i2   Rb   i    t   formatst   gift   fnRoott   shobjt   outDirs   /tmpN(   i
   i
   i<   i<   in   i
   ()   t   __version__t   reportlab.libR    t   reportlab.lib.validatorsR   R   R   R   R   R   R   t   reportlab.lib.attrmapR   R	   t   reportlab.graphics.shapesR
   R   R   R   R   R   R   t   reportlab.graphics.widgetbaseR   R   R   R   R    RX   R^   Ru   Ry   R   R   RT   t   reportlab.lib.colorsR7   R   R<   R;   t   save(    (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/widgets/grids.pyt   <module>   s*   44	ŽVi		
	 .4