
    >wg                     R    d dl mZ d dlmZ d dlmZ  G d dej
                        Zy)   )	xmlwriter)preserve_whitespace)xl_rowcol_to_cellc                   z     e Zd ZdZ fdZg fdZd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Z xZS )Commentsz=
    A class for writing the Excel XLSX Comments file.


    c                 8    t         t        |           i | _        y)z
        Constructor.

        N)superr   __init__
author_ids)self	__class__s    J/var/www/horilla/myenv/lib/python3.12/site-packages/xlsxwriter/comments.pyr
   zComments.__init__   s     	h&(    c                     | j                          | j                          | j                  |       | j                  |       | j	                  d       | j                          y )Ncomments)_xml_declaration_write_comments_write_authors_write_comment_list_xml_end_tag
_xml_close)r   comments_datas     r   _assemble_xml_filezComments._assemble_xml_file*   sX     	 	 	M* 	  /*% 	r   c                 6    d}d|fg}| j                  d|       y )Nz9http://schemas.openxmlformats.org/spreadsheetml/2006/mainxmlnsr   )_xml_start_tag)r   r   
attributess      r   r   zComments._write_commentsD   s$    K&'
J
3r   c                     d}| j                  d       |D ]>  }|d   }||| j                  vs|| j                  |<   |dz  }| j                  |       @ | j                  d       y )N    authors   r   )r   r   _write_authorr   )r   comment_dataauthor_countcommentauthors        r   r   zComments._write_authorsL   sv    I&# 		+GQZF!fDOO&C*6'! ""6*		+ 	)$r   c                 (    | j                  d|       y )Nr&   )_xml_data_element)r   datas     r   r"   zComments._write_author_   s    x.r   c                     | j                  d       |D ]R  }|d   }|d   }|d   }|d   }|d   }|d   }|d   }	d }
|| j                  |   }
|||	f}| j                  ||||
|       T | j                  d       y )	NcommentListr   r      r!            )r   r   _write_commentr   )r   r#   r%   rowcoltextr&   	font_name	font_sizefont_family	author_idfonts               r   r   zComments._write_comment_listc   s    M*# 	AG!*C!*C1:DQZF
I
I!!*K I! OOF3	 y+6DS$	4@!	A$ 	-(r   c                     t        ||      }d|fg}||j                  d|f       | j                  d|       | j                  ||       | j	                  d       y )NrefauthorIdr%   )r   appendr   _write_textr   )r   r1   r2   r3   r7   r8   r:   r   s           r   r0   zComments._write_comment{   sb    S)cl^
 z956Iz2 	t$)$r   c                 l    | j                  d       | j                  ||       | j                  d       y )Nr3   )r   _write_text_rr   r   r3   r8   s      r   r=   zComments._write_text   s0    F# 	4&&!r   c                     | j                  d       | j                  |       | j                  |       | j                  d       y )Nr)r   _write_r_pr_write_text_tr   r@   s      r   r?   zComments._write_text_r   s>    C  	 	4 #r   c                 f    g }t        |      r|j                  d       | j                  d||       y )N)z	xml:spacepreservet)r   r<   r(   )r   r3   r   s      r   rD   zComments._write_text_t   s0    
t$78sD*5r   c                     | j                  d       | j                  |d          | j                          | j                  |d          | j	                  |d          | j                  d       y )NrPrr   r   r,   )r   	_write_sz_write_color_write_r_font_write_familyr   )r   r8   s     r   rC   zComments._write_r_pr   sf    E" 	tAw 	 	47# 	47#% r   c                 2    d|fg}| j                  d|       y )Nvalsz_xml_empty_tag)r   r5   r   s      r   rJ   zComments._write_sz   s    i()
D*-r   c                 .    dg}| j                  d|       y )N)indexedQ   colorrQ   )r   r   s     r   rK   zComments._write_color   s    %&
GZ0r   c                 2    d|fg}| j                  d|       y )NrO   rFontrQ   )r   r4   r   s      r   rL   zComments._write_r_font   s    i()
GZ0r   c                 2    d|fg}| j                  d|       y )NrO   familyrQ   )r   r6   r   s      r   rM   zComments._write_family   s    k*+
Hj1r   )__name__
__module____qualname____doc__r
   r   r   r   r"   r   r0   r=   r?   rD   rC   rJ   rK   rL   rM   __classcell__)r   s   @r   r   r      sX     02 44%&/)0% "
6!$.112r   r   N) r   utilityr   r   	XMLwriterr    r   r   <module>rd      s$     ( &C2y"" C2r   