
    xZiV                     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                   R    \ rS rSrSr SS\S\S\S\S\S	\S
S4S jjrSSS jjrSr	g)
ButtonType   z7
A class to represent a button in an Excel worksheet.

Nrowcolheightwidthbutton_numberoptionsreturnc                     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          h/var/www/eduai.edurigo.com/question_generate/ques_gen_env/lib/python3.13/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r   N)
__name__
__module____qualname____firstlineno____doc__r#   dictr   r   __static_attributes__ r    r   r   r      s`     %(%( %( 	%(
 %( %( %( 
%(N- -r    r   c                      \ rS rSrSr   S4 S5S jjrS rS5S jrS5S jrS5S	 jr	S5S
 jr
S5S jrS5S jrS5S jrS5S jrS5S jrS5S jrS5S jrS5S jrS5S jrS\SS4S jrS\SS4S jrS\SS4S jrS5S jrS5S jrS5S jrS5S jrS\SS4S jrS6S\S \SS4S! jjr S \SS4S" jr!S\SS4S# jr"S5S$ jr#S5S% jr$S5S& jr%S5S' jr&S5S( jr'S5S) jr(S5S* jr)S5S+ jr*S5S, jr+S5S- jr,S5S. jr-S5S/ jr.S5S0 jr/S5S1 jr0S5S2 jr1S3r2g)7Vmlk   z0
A class for writing the Excel XLSX Vml file.


Nr   c                    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:xr3   )_xml_start_tag)r   schemaxmlnsxmlns_oxmlns_x
attributess         r   r4   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)rT   _write_idmapr<   r   r>   rY   s      r   r5   Vml._write_shapelayout   s8    '(
OZ8 	'"/*r    c                 4    SSU4/nU R                  SU5        g )Nr\   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)rT   _write_stroke_write_comment_pathr<   r   shape_idrm   sptro   rY   s         r   r8   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_t201ri      rk   rl   rm   rn   ro   rp   )rT   rs   _write_button_path_write_shapetype_lockr<   ru   s         r   r6   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_t75ri   K   rq   zm@4@5l@4@11@9@11@9@5xefrl   rm   rn   zo:preferrelativero   filledstrokedrp   )rT   rs   _write_formulas_write_image_path_write_aspect_ratio_lockr<   )	r   rv   rm   rw   o_preferrelativero   r   r   rY   s	            r   r:   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:strokerd   )r   r   rY   s      r   rs   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)gradientshapeokrq   o:connecttypev:path)appendre   )r   r   connecttyperY   s       r   rt   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   rr   shadowoko:extrusionokstrokeokfillokr   r   rd   )r   r   extrusionokr   r   r   rY   s          r   r|   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   rq   rr   r   r   r   r   rd   )r   r   r   r   rY   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^   rq   r]   	shapetypeo:lockrd   )r   extr   rY   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^   rq   r]   rotationr   rd   )r   r   r   rY   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^   rq   r]   aspectratior   rd   )r   r   r   rY   s       r   r   Vml._write_aspect_ratio_lock  s6     cNK(


 	Hj1r    rE   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:rl   typestyle	fillcoloro:insetmodev:shapenone)strrP   r   
is_visiblecolor_vml_rgb_hex_valuerT   _write_comment_fill_write_shadowrt   _write_comment_textbox_write_comment_client_datar<   )r   rv   rC   rE   
shape_type	insetmode
visibilityrN   rO   r   r   r   rY   s                r   r9   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    rD   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:tightrl   r   altr   )zo:buttonrq   )r   buttonFace [67])strokecolorzwindowText [64])r   r   r   )r   rP   r   r   r   rT   _write_button_fillr   _write_button_textbox_write_button_client_datar<   )r   rv   rC   rD   r   rN   rO   r   r   r   rY   s              r   r7   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    rG   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@rM   g      X@H   g      ?z3position:absolute;margin-left:0;margin-top:0;width:r   r   r   rl   zo:spidr   r   r   )r   
image_name_width_x_dpi_y_dpi_height_ref_id_header_positionr#   rT   _write_imagedatar   r<   )r   rv   rC   rG   r   namer   x_dpiy_dpir   ref_idpositionr   rY   s                 r   r;   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:fillrd   )r   color_2rY   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   rq   r   zo:detectmouseclickr   rd   )r   r   detectmouseclickrY   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 )Nrq   blackonr   obscuredzv:shadowrd   )r   r   r   r   rY   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:textboxrN   )rT   
_write_divr<   )r   r   rY   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)rT   r   r   r<   )r   rD   r   rY   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)rT   _write_button_fontr<   )r   r   r   r   rY   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   rY   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)rT   _write_move_with_cells_write_size_with_cells_write_anchorr   _write_auto_fill
_write_rowr
   _write_columnr   r   _write_visibler<   )r   rE   object_typerY   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  )
rT   r  r   _write_print_objectr	  _write_fmla_macror   _write_text_halign_write_text_valignr<   )r   rD   r  rY   s       r   r   Vml._write_button_client_data  s    #[12
NJ7 	6??+ 	  " 	 	v||, 	! 	!.)r    c                 &    U R                  S5        g )Nzx:MoveWithCellsrd   r   s    r   r  Vml._write_move_with_cells      -.r    c                 &    U R                  S5        g )Nzx:SizeWithCellsrd   r  s    r   r  Vml._write_size_with_cells  r  r    c                 &    U R                  S5        g )Nz	x:Visiblerd   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 )NrK   z, zx:Anchor)r   joinr   )r   r   	col_start	row_startx1y1col_endrow_endx2y2stringsirc   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   rc   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:TextVAlignr6  r   r  s    r   r  Vml._write_text_valign  r8  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   re   )r   r   o_titlerY   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)rT   _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:frd   )r   rE  rY   s      r   rB  Vml._write_formula  s    cl^
E:.r    r.   )NNNr&   r%   )3r'   r(   r)   r*   r+   rH   rP   r4   r5   r_   r8   r6   r:   rs   rt   r|   r   r}   r   r   r   r9   r   r7   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   rB  r-   r.   r    r   r0   r0   k   sX    2 
2h($/	+3)0)6")H4	22$2
2
2
22%{ 2%t 2%h/%Z /%D /%b0%5 0%T 0%d2
24''J '4 '! !c !T !<# <$ <*+ *$ *@*8//)	13.199947((/r    r0   N)	xlsxwriter.commentsr   xlsxwriter.imager    r   r   	XMLwriterr0   r.   r    r   <module>rK     s1    , " K- K-jd
/)

 d
/r    