
    Kwg                         d Z ddlmZ ddlmZ ddlmZ ddl ddl ddl	m
Z
  G d de      Zed	k(  r> e       j                         Zdd
lZej!                  dg ej"                         d
       y
y
)z3.3.0    )Widget)shapes)colors)*)Drawingc                      e Zd ZdZ ed3i 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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)      Zd4d/Zd0 Zd1 Zd2 Zy)5TableWidgetz%A two dimensions table of labels
    xz x position of left edge of table)descyz"y position of bottom edge of tablewidthztable widthheightztable heightborderStrokeColorztable border color	fillColorztable fill colorborderStrokeWidthzborder line widthhorizontalDividerStrokeColorz"table inner horizontal lines colorverticalDividerStrokeColorz table inner vertical lines colorhorizontalDividerStrokeWidthz"table inner horizontal lines widthverticalDividerStrokeWidthz table inner vertical lines widthdividerDashArrayzDash array for dividerLines.dataNz6a list of list of strings to be displayed in the cells	boxAnchorz%location of the table anchoring pointfontNameztext font in the tablefontSizezfont size of the table	fontColorz
font color	alignmentleftrightzAlignment of text within cells
textAnchorstartmiddleendnumericc                 Z   || _         || _        d| _        d| _        t        j
                  | _        d | _        d| _        t        j
                  | _	        t        j
                  | _
        d| _        d| _        d | _        g dg dg dg| _        d| _        d	| _        t        j
                  | _        d
| _        d| _        |j)                         D ]Y  \  }}|t+        | j,                  j.                  j1                               v rt3        | ||       Ct5        d| j,                  z         y )N   d         ?g      ?)NorthSouthEastWest)r&   n   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vs         W/var/www/horilla/myenv/lib/python3.12/site-packages/reportlab/graphics/widgets/table.py__init__zTableWidget.__init__)   s    
!'!$,2LL)*0,,',/)*.' $45FGXY	 ! HHJ 	ZDAqD0055788a# !I$..!XYY		Z    c                     t        dd      }t               }|j                  |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	   addrE   r   r   r   r   redr   )r=   dts      rA   demozTableWidget.demoF   s`     CM	ag#, -1*$%!$*JJ!rC   c           	         t        j                         }| j                  s| j                  rt        j                  | j
                  | j                  | j                  | j                        }| j                  |_        | j                  |_	        | j                  |_        |j                  |       | j                  | j                        }t        | j                        }t        | j                  d         }| j                  t!        |      z  }| j                  t!        |      z  }| j"                  rt%        |      D ]  }| j
                  }	| j
                  | j                  z   }
| j                  ||z  z   }t        j&                  |	||
|      }| j(                  |_        | j,                  |_        | j"                  |_	        |j                  |        | j.                  rt%        |      D ]  }| j
                  ||z  z   }| j                  }| j                  | j                  z   }t        j&                  ||||      }| j(                  |_        | j0                  |_        | j.                  |_	        |j                  |        | j                  j3                          t5        | j                        D ]  \  }}| j                  ||z  z   d|z  z   d| j6                  z  z
  }t5        |      D ]  \  }}|s	| j
                  ||z  z   d|z  z   }t        j8                  ||t;        |      | j<                        }| j>                  |_        | j6                  |_        | j@                  |_        |j                  |         |S )z# returns a group of shapes
        r   r'   )r   )!r   Groupr   r   Rectr
   r   r   r   strokeColorr   strokeWidthrJ   preProcessDatar   lenfloatr   rangeLiner   strokeDashArrayr   r   r   reverse	enumerater   Stringstrr   r   r   )r=   grectr   rowscolsrow_stepcol_stepix1x2r   liner
   y1y2jrowdatumss                       rA   drawzTableWidget.drawR   s    LLN !!T^^;;tvvtvvtzz4;;GD!^^DN#55D#55DEE$K ""499-499~499Q< ;;t,::d+ ,,4[ 	VVVVdjj(FFXaZ'{{2q"a0'+'<'<$#'#D#D #'#D#D d	 **4[ 	FF8A:%VVVVdkk){{1b!R0'+'<'<$#'#B#B #'#B#B d	 			!$)), 		HQ8#c(l2S4==5HHA'n 
E8+c(l:AaCJ4??SA!%AJ!%AJ"&..AKEE!H		 rC   c                     |sdggS t        |D cg c]  }t        |       c}      }t        |      D ]5  \  }}t        |      |k  s|j                  dg|t        |      z
  z         7 |S c c}w )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)

        N)maxrU   r[   extend)r=   r   r
   max_rowrowNork   s         rA   rT   zTableWidget.preProcessData   st     F8O-1A-/#D/ 	6JE33x'!

D673s8#345	6 	 .s   A. )
   ru   )__name__
__module____qualname____doc__AttrMapAttrMapValueisNumberisColorOrNoneisListOfNumbersOrNoneisBoxAnchorisStringOneOfr9   rB   rN   rn   rT   rt   rC   rA   r	   r	      s     (JK(LM XM: h^<	
 )=QR !5GH )8KL (4MHl'm &2-Fh%i (4HCg'h &2(Ac%d ((=Dbc D'_` !3Z[  /GH   /GH!" !\B#$ !vw!7>^_%& "%y"IPpq'H,Z:
9vrC   r	   __main__Npdf)formatsoutDirfnRoot)__version__reportlab.graphics.widgetbaser   reportlab.graphicsr   reportlab.libr   reportlab.lib.validatorsreportlab.lib.attrmapreportlab.graphics.shapesr   r	   rv   rN   rL   ossavegetcwdrt   rC   rA   <module>r      sk   
  0 %   & # -K& K\ zAFFE7)"))+TF: rC   