
    hpU                     f    S SK Jr  S SKJr  SSKJr   " S S5      r " S S\R                  5      rg	)
    )CommentType)Image   )	xmlwriterc                   J    \ rS rSrSr SS\S\S\S\S\S	\4S
 jjrSS jrSr	g)
ButtonType   z7
A class to represent a button in an Excel worksheet.

Nrowcolheightwidthbutton_numberoptionsc                     Xl         X l        X@l        X0l        SU S3U l        SU 3U l        SU l        SU l        SU l        SU l	        SU l
        / U l        U R                  U5        g)a@  
Initialize a ButtonType instance.

Args:
    row (int): The row number of the button.
    col (int): The column number of the button.
    height (int): The height of the button.
    width (int): The width of the button.
    button_number (int): The button number.
    options (dict): Additional options for the button.
z
[0]!Button_ClickzButton Nr   r   )r
   r   r   r   macrocaptiondescriptionx_scaley_scalex_offsety_offsetvertices_set_user_options)selfr
   r   r   r   r   r   s          aC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\xlsxwriter/vml.py__init__ButtonType.__init__   sq    ( 
!-7
 0 	w'    c                    Uc  gUR                  SU R                  5      U l        UR                  SU R                  5      U l        UR                  SU R                  5      U l        UR                  SU R                  5      U l        UR                  SU R
                  5      U l        UR                  SU R                  5      U l        UR                  S5      (       a  S	US   -   U l        UR                  S
5      (       a  U R                  US
   -  U l        UR                  S5      (       a  U R                  US   -  U l        [        SU R                  -   5      U l        [        SU R                  -   5      U l        g)zP
This method handles the additional optional parameters to
``insert_button()``.
Nr   r   r   r   r   r   r   z[0]!r   r   g      ?)	getr   r   r   r   r   r   r   int)r   r   s     r   r   ButtonType._set_user_optionsC   s-   
 ? [[$**5
kk(DKK8{{9dll;J>J>";;}d6F6FG ;;w''"22DJ ;;y!!gi&88DJ;;y!!++	(::DK tzz)*
#+,r   )r   r   r   r   r   r
   r   r   r   r   r   r   N)
__name__
__module____qualname____firstlineno____doc__r"   dictr   r   __static_attributes__ r   r   r   r      sQ     %(%( %( 	%(
 %( %( %(N-r   r   c                   X   \ rS rSrSr   S3S jrS rS rS rS r	S	 r
S
 rS rS rS rS rS rS rS rS rS\4S jrS\4S jrS\4S jrS rS rS rS rS\4S jrS4S\S\4S  jjr S\4S! jr!S\4S" jr"S# r#S$ r$S% r%S& r&S' r'S( r(S) r)S* r*S+ r+S, r,S- r-S. r.S/ r/S0 r0S1 r1S2r2g)5Vmlk   z0
A class for writing the Excel XLSX Vml file.


Nc                    SnU R                  5         U R                  U5        U(       a5  U R                  5         U H  nUS-  nU R                  X&U5        US-  nM!     U(       a5  U R	                  5         U H  nUS-  nU R                  X&U5        US-  nM!     U(       a7  U R                  5         Sn	U H  n
US-  nU R                  X)U
5        U	S-  n	M!     U R                  S5        U R                  5         g )Nr   xml)
_write_xml_namespace_write_shapelayout_write_button_shapetype_write_button_shape_write_comment_shapetype_write_comment_shape_write_image_shapetype_write_image_shape_xml_end_tag
_xml_close)r   data_idvml_shape_idcomments_databuttons_dataheader_imagesz_indexbuttoncommentindeximages              r   _assemble_xml_fileVml._assemble_xml_filew   s     !!# 	(((*&!((G1	 ' ))+(!)),I1	 ) '')E&!''UC
	 ' 	%  	r   c                 B    USS u  p#pEUS-  nUS-  nUS-  nUS-  nX#XE4$ )N            ?r,   )r   r   lefttopr   r   s         r   _pixels_to_pointsVml._pixels_to_points   sE     $,Ab> 5 	t$%''r   c                 `    SnUS-   nUS-   nUS-   nSU4SU4SU4/nU R                  SU5        g )	Nzurn:schemas-microsoft-com:vmlzoffice:officezoffice:excelzxmlns:vzxmlns:ozxmlns:xr1   )_xml_start_tag)r   schemaxmlnsxmlns_oxmlns_x
attributess         r   r2   Vml._write_xml_namespace   sW    -?*>)   

 	E:.r   c                 r    S/nU R                  SU5        U R                  U5        U R                  S5        g )Nv:exteditzo:shapelayout)rR   _write_idmapr:   r   r<   rW   s      r   r3   Vml._write_shapelayout   s8    '(
OZ8 	'"/*r   c                 4    SSU4/nU R                  SU5        g )NrZ   datazo:idmap_xml_empty_tagr^   s      r   r]   Vml._write_idmap   s(     W


 	Iz2r   c                     SnSnSnSnSU4SU4SU4SU4/nU R                  S	U5        U R                  5         U R                  S
S5        U R                  S	5        g )N_x0000_t20221600,21600   m,l,21600r21600,l21600,xeid	coordsizeo:sptpathv:shapetypetrect)rR   _write_stroke_write_comment_pathr:   r   shape_idrk   sptrm   rW   s         r   r6   Vml._write_comment_shapetype   s}     !	* 8)$cNTN	

 	M:6 	 	  f--(r   c                     SnSnSnSnSU4SU4SU4SU4/nU R                  S	U5        U R                  5         U R                  5         U R                  5         U R	                  S	5        g )
N_x0000_t201rg      ri   rj   rk   rl   rm   rn   )rR   rq   _write_button_path_write_shapetype_lockr:   rs   s         r   r4   Vml._write_button_shapetype   s     !	* 8)$cNTN	

 	M:6 	 	! 	""$-(r   c                    SnSnSnSnSnSnSnSU4SU4S	U4S
U4SU4SU4SU4/nU R                  SU5        U R                  5         U R                  5         U R                  5         U R	                  5         U R                  S5        g )N
_x0000_t75rg   K   ro   zm@4@5l@4@11@9@11@9@5xefrj   rk   rl   zo:preferrelativerm   filledstrokedrn   )rR   rq   _write_formulas_write_image_path_write_aspect_ratio_lockr:   )	r   rt   rk   ru   o_preferrelativerm   r   r   rW   s	            r   r8   Vml._write_image_shapetype  s    !	' 8)$cN!12TNv 

 	M:6 	 	 	  	%%'-(r   c                 6    SnSU4/nU R                  SU5        g )Nmiter	joinstylezv:strokerb   )r   r   rW   s      r   rq   Vml._write_stroke7  s$    	"I./
J
3r   c                     / nU(       a  UR                  S5        UR                  SU45        U R                  SU5        g )N)gradientshapeokro   o:connecttypev:path)appendrc   )r   r   connecttyperW   s       r   rr   Vml._write_comment_path?  s<    
67?K89Hj1r   c                 ^    SnSnSnSnSnSU4SU4SU4SU4SU4/nU R                  SU5        g )	Nr   rp   shadowoko:extrusionokstrokeokfillokr   r   rb   )r   r   extrusionokr   r   r   rW   s          r   rz   Vml._write_button_pathJ  s^     "k*"vk*

 	Hj1r   c                 J    SnSnSnSU4SU4SU4/nU R                  SU5        g )Nr   ro   rp   r   r   r   r   rb   )r   r   r   r   rW   s        r   r   Vml._write_image_path\  sD     k*0k*

 	Hj1r   c                 @    SnSnSU4SU4/nU R                  SU5        g )Nr\   ro   r[   	shapetypeo:lockrb   )r   extr   rW   s       r   r{   Vml._write_shapetype_lockj  s6    	 cN)$


 	Hj1r   c                 @    SnSnSU4SU4/nU R                  SU5        g )Nr\   ro   r[   rotationr   rb   )r   r   r   rW   s       r   _write_rotation_lockVml._write_rotation_lockv  s6     cN"


 	Hj1r   c                 @    SnSnSU4SU4/nU R                  SU5        g )Nr\   ro   r[   aspectratior   rb   )r   r   r   rW   s       r   r   Vml._write_aspect_ratio_lock  s6     cNK(


 	Hj1r   rC   c                    SnSnSnS[        U5      -   nU R                  UR                  5      u  pxpUR                  (       a  SnSUS SUS S	U	S S
U
S SU SU 3nSU4SU4SU4SUR                  R                  5       4SU4/nU R                  SU5        U R                  5         U R                  5         U R                  S S5        U R                  5         U R                  U5        U R                  S5        g )Nz#_x0000_t202autohidden_x0000_svisibleposition:absolute;margin-left:.15gpt;margin-top:	pt;width:
pt;height:pt;z-index:z;visibility:rj   typestyle	fillcoloro:insetmodev:shapenone)strrN   r   
is_visiblecolor_vml_rgb_hex_valuerR   _write_comment_fill_write_shadowrr   _write_comment_textbox_write_comment_client_datar:   )r   rt   rA   rC   
shape_type	insetmode
visibilityrL   rM   r   r   r   rW   s                r   r7   Vml._write_comment_shape  sD   #
	
 H-%)%;%;G<L<L%M"E "J+ &d $4L !T] #i  $' 	 8Z e'--::<=I&

 	Iz2 	  " 	 	  v. 	##% 	''0)$r   rB   c                 h   SnS[        U5      -   nU R                  UR                  5      u  pVpxSUS SUS SUS SUS SU S	3n	S
U4SU4/n
UR                  b  U
R	                  SUR                  45        U
R	                  SU	45        U
R	                  S5        U
R	                  S5        U
R	                  S5        U
R	                  S5        U R                  SU
5        U R                  5         U R                  5         U R                  U5        U R                  U5        U R                  S5        g )Nz#_x0000_t201r   r   r   r   r   r   r   z;mso-wrap-style:tightrj   r   altr   )zo:buttonro   )r   buttonFace [67])strokecolorzwindowText [64])r   r   r   )r   rN   r   r   r   rR   _write_button_fillr   _write_button_textbox_write_button_client_datar:   )r   rt   rA   rB   r   rL   rM   r   r   r   rW   s              r   r5   Vml._write_button_shape  sb   #
 H-%)%;%;FOO%L"E+ &d $4L !T] #i  #$ 	 8Z 


 )uf&8&89:7E*++,:;<=12Iz2 	! 	!!# 	""6* 	&&v.)$r   rE   c                    SnS[        U5      -   nUR                  nUR                  nUR                  nUR                  nUR
                  n	UR                  n
UR                  nUS-  U-  nU	S-  U-  n	S[        US-  S-  S-   5      -  nS[        U	S-  S-  S-   5      -  n	SUS	 S
U	S	 SU 3nSU4SU4SU4SU4/nU R                  SU5        U R                  X5        U R                  5         U R                  S5        g )Nz#_x0000_t75r   g      R@rK   g      X@H   g      ?z3position:absolute;margin-left:0;margin-top:0;width:r   r   r   rj   zo:spidr   r   r   )r   
image_name_width_x_dpi_y_dpi_height_ref_id_header_positionr"   rR   _write_imagedatar   r:   )r   rt   rA   rE   r   namer   x_dpiy_dpir   ref_idpositionr   rW   s                 r   r9   Vml._write_image_shape  sK   "
 H- )) u$$& Cr 1D 899S$!3d!:;; 4L !T] #i! 	 8x Z e	

 	Iz2 	f+ 	!!#)$r   c                 6    SnSU4/nU R                  SU5        g )Nz#ffffe1color2v:fillrb   )r   color_2rW   s      r   r   Vml._write_comment_fill%  s$    )*
Hj1r   c                 @    SnSnSU4SU4/nU R                  SU5        g )Nr   ro   r   zo:detectmouseclickr   rb   )r   r   detectmouseclickrW   s       r   r   Vml._write_button_fill-  s9    # w!#34


 	Hj1r   c                 J    SnSnSnSU4SU4SU4/nU R                  SU5        g )Nro   blackonr   obscuredzv:shadowrb   )r   r   r   r   rW   s        r   r   Vml._write_shadow9  sC     2Je"

 	J
3r   c                 z    SnSU4/nU R                  SU5        U R                  S5        U R                  S5        g )Nmso-direction-alt:autor   	v:textboxrL   )rR   
_write_divr:   )r   r   rW   s      r   r   Vml._write_comment_textboxG  s@    (&'
K4 	+&r   c                     SnSU4S/nU R                  SU5        U R                  SUR                  5        U R                  S5        g )Nr   r   )zo:singleclickr   r   center)rR   r   r   r:   )r   rB   r   rW   s       r   r   Vml._write_button_textboxT  sI    (&(>?
K4 	&..1+&r   alignr   c                     SU-   nSU4/nU R                  SU5        U(       a  U R                  U5        U R                  S5        g )Nztext-align:r   div)rR   _write_button_fontr:   )r   r   r   r   rW   s        r   r   Vml._write_diva  sJ     %&'
E:.##G,% r   c                 J    SnSnSnSU4SU4SU4/nU R                  SX5        g )NCalibri   z#000000facesizer   font_xml_data_element)r   r   r   r   r   rW   s         r   r   Vml._write_button_fonto  sB     TNTNe

 	vw;r   c                    SnSU4/nU R                  SU5        U R                  5         U R                  5         U R                  UR                  5        U R                  5         U R                  UR                  5        U R                  UR                  5        UR                  (       a  U R                  5         U R                  S5        g )NNote
ObjectTypex:ClientData)rR   _write_move_with_cells_write_size_with_cells_write_anchorr   _write_auto_fill
_write_rowr
   _write_columnr   r   _write_visibler:   )r   rC   object_typerW   s       r   r   Vml._write_comment_client_data}  s    #[12
NJ7 	##% 	##% 	7++, 	 	$ 	7;;' !.)r   c                 D   SnSU4/nU R                  SU5        U R                  UR                  5        U R                  5         U R	                  5         U R                  UR                  5        U R                  5         U R                  5         U R                  S5        g )NButtonr  r  )
rR   r  r   _write_print_objectr  _write_fmla_macror   _write_text_halign_write_text_valignr:   )r   rB   r  rW   s       r   r   Vml._write_button_client_data  s    #[12
NJ7 	6??+ 	  " 	 	v||, 	! 	!.)r   c                 &    U R                  S5        g )Nzx:MoveWithCellsrb   r   s    r   r  Vml._write_move_with_cells      -.r   c                 &    U R                  S5        g )Nzx:SizeWithCellsrb   r  s    r   r  Vml._write_size_with_cells  r  r   c                 &    U R                  S5        g )Nz	x:Visiblerb   r  s    r   r
  Vml._write_visible  s    K(r   c                     US S u  p#pEpgpX$X5XhXy/n
U
 Vs/ s H  n[        U5      PM     n
nSR                  U
5      nU R                  SU5        g s  snf )NrI   z, zx:Anchor)r   joinr   )r   r   	col_start	row_startx1y1col_endrow_endx2y2stringsira   s                r   r  Vml._write_anchor  s_    CKBQ<@rw)gJ#*+7a3q67+yy!z40	 ,s   Ac                 ,    SnU R                  SU5        g )NFalsez
x:AutoFillr   r   ra   s     r   r  Vml._write_auto_fill  s    |T2r   c                 (    U R                  SU5        g )Nzx:Rowr   r+  s     r   r  Vml._write_row  s    w-r   c                 (    U R                  SU5        g )Nzx:Columnr   r+  s     r   r	  Vml._write_column  s    z40r   c                 (    U R                  SS5        g )Nzx:PrintObjectr*  r   r  s    r   r  Vml._write_print_object  s    8r   c                 (    U R                  SS5        g )Nzx:TextHAlignCenterr   r  s    r   r  Vml._write_text_halign      ~x8r   c                 (    U R                  SS5        g )Nzx:TextVAlignr4  r   r  s    r   r  Vml._write_text_valign  r6  r   c                 (    U R                  SU5        g )Nzx:FmlaMacror   r+  s     r   r  Vml._write_fmla_macro  s    }d3r   c                 P    SS[        U5      -   4SU4/nU R                  SU5        g )Nzo:relidrIdzo:titlezv:imagedata)r   rc   )r   r   o_titlerW   s       r   r   Vml._write_imagedata  s6     F+, 


 	M:6r   c                    U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nz
v:formulaszif lineDrawn pixelLineWidth 0z
sum @0 1 0z
sum 0 0 @1zprod @2 1 2zprod @3 21600 pixelWidthzprod @3 21600 pixelHeightz
sum @0 0 1zprod @6 1 2zprod @7 21600 pixelWidthzsum @8 21600 0zprod @7 21600 pixelHeightzsum @10 21600 0)rR   _write_formular:   r  s    r   r   Vml._write_formulas  s    L) 	;<L)L)M*6778L)M*67,-78-.,'r   c                 2    SU4/nU R                  SU5        g )Neqnzv:frb   )r   rC  rW   s      r   r@  Vml._write_formula  s    cl^
E:.r   r,   )NNNr$   )3r%   r&   r'   r(   r)   rF   rN   r2   r3   r]   r6   r4   r8   rq   rr   rz   r   r{   r   r   r   r7   r   r5   r   r9   r   r   r   r   r   r   r   r   r   r   r  r  r
  r  r  r  r	  r  r  r  r  r   r   r@  r+   r,   r   r   r.   r.   k   s    2h($/	+3)0)6")H4	22$2
2
2
22%{ 2%h/%Z /%b0%5 0%d2
24''J '! !c !<# <*+ *@*8//)	13.199947((/r   r.   N)	xlsxwriter.commentsr   xlsxwriter.imager    r   r   	XMLwriterr.   r,   r   r   <module>rI     s1    , " K- K-jd
/)

 d
/r   