U
    [e                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlT ddlT ddl	m
Z
 G dd deZed	kre  Zdd
lZejdge d
d d
S )z3.3.0    )Widget)shapes)colors)*)Drawingc                   @   s  e Zd ZdZeeeddeeddeeddeeddeeddeeddeed	deed
deeddeeddeeddeeddedddee	ddee
ddeeddeeddeeddddeedddddddZd&ddZd d! Zd"d# Zd$d% ZdS )'TableWidgetz%A two dimensions table of labels
    z x position of left edge of table)descz"y position of bottom edge of tableztable widthztable heightztable border colorztable fill colorzborder line widthz"table inner horizontal lines colorz table inner vertical lines colorz"table inner horizontal lines widthz table inner vertical lines widthzDash array for dividerLines.Nz6a list of list of strings to be displayed in the cellsz%location of the table anchoring pointztext font in the tablezfont size of the tablez
font colorleftrightzAlignment of text within cellsstartmiddleendnumeric)xywidthheightborderStrokeColor	fillColorborderStrokeWidthhorizontalDividerStrokeColorverticalDividerStrokeColorhorizontalDividerStrokeWidthverticalDividerStrokeWidthdividerDashArraydata	boxAnchorfontNamefontSize	fontColor	alignment
textAnchor
   c                 K   s   || _ || _d| _d| _tj| _d | _d| _tj| _	tj| _
d| _d| _d | _ddddgdd	d
dgddddgg| _d| _d| _tj| _d| _d| _| D ]8\}}|t| jj krt| || qtd| j qd S )N   d         ?g      ?ZNorthZSouthZEastZWestn   x      ABCDnw   r
   r   z&invalid argument supplied for class %s)r   r   r   r   r   blackr   r   r   r   r   r   r   r   r   r   r   r   r    r!   itemslist	__class___attrMapkeyssetattr
ValueError)selfr   r   kwkv r;   b/var/www/html/services/stratfitenv/lib/python3.8/site-packages/reportlab/graphics/widgets/table.py__init__)   s,    $zTableWidget.__init__c                 C   sD   t dd}t }|j|dd d|j_d|j_d|j_tj|j_	|S )z3 returns a sample of this widget with data
        i  r#   table)name)         Nr   )
r   r   addr>   r   r   r   r   redr   )r7   dtr;   r;   r<   demoF   s    

zTableWidget.democ                 C   s  t  }| js| jrNt | j| j| j| j}| j|_| j|_	| j
|_|| | | j}t| j}t| jd }| jt| }| jt| }| jrt|D ]V}| j}	| j| j }
| j||  }t |	||
|}| j|_| j|_| j|_	|| q| jr^t|D ]X}| j||  }| j}| j| j }t ||||}| j|_| j|_| j|_	|| q| j  t| jD ]\}}| j||  d|  d| j  }t|D ]`\}}|r| j||  d|  }t j||t|| jd}| j|_| j|_| j |_|| qqr|S )z# returns a group of shapes
        r   r%   )r!   )!r   Groupr   r   ZRectr   r   r   r   ZstrokeColorr   ZstrokeWidthrC   preProcessDatar   lenfloatr   rangeZLiner   ZstrokeDashArrayr   r   r   reverse	enumerater   Stringstrr!   r   r   )r7   grectr   rowscolsZrow_stepZcol_stepix1Zx2r   liner   y1y2jrowZdatumsr;   r;   r<   drawR   sX    


 zTableWidget.drawc                 C   sX   |sdggS t dd |D }t|D ],\}}t||k r&|dg|t|   q&|S )zpreprocess and return a new array with at least one row
        and column (use a None) if needed, and all rows the same
        length (adding Nones if needed)

        Nc                 S   s   g | ]}t |qS r;   )rJ   ).0r   r;   r;   r<   
<listcomp>   s     z.TableWidget.preProcessData.<locals>.<listcomp>)maxrN   rJ   extend)r7   r   Zmax_rowZrowNor[   r;   r;   r<   rI      s    zTableWidget.preProcessData)r"   r"   )__name__
__module____qualname____doc__ZAttrMapZAttrMapValueZisNumberZisColorOrNoneZisListOfNumbersOrNoneZisBoxAnchorZisStringZOneOfr3   r=   rG   r]   rI   r;   r;   r;   r<   r      s4   

















;r   __main__NZpdf)formatsZoutDirZfnRoot)__version__Zreportlab.graphics.widgetbaser   Zreportlab.graphicsr   Zreportlab.libr   Zreportlab.lib.validatorsZreportlab.lib.attrmapZreportlab.graphics.shapesr   r   rb   rG   rE   ossavegetcwdr;   r;   r;   r<   <module>   s    
