
    h              
          S SK Jr  S SKJrJrJrJr  S SKrS SKJ	r	J
r
  SSKJrJrJrJrJrJrJrJrJrJr  \(       a  S SKJr  S SKJrJr  S S	KJr  \R:                  " S
5      rSSSSSSSSSS.	r " S S5      r g)    )annotations)TYPE_CHECKINGIterableSequenceOptionalN)DXFStructureErrorDXF12   )
TableViewportTableTextstyleTable
LayerTableLinetypeTable
AppIDTable	ViewTableBlockRecordTableDimStyleTableUCSTable)Drawing)	DXFEntityDXFTagStorage)AbstractTagWriterezdxflayers	linetypesappids	dimstylesstylesucsviews	viewportsblock_records)	LAYERLTYPEAPPIDDIMSTYLESTYLEUCSVIEWVPORTBLOCK_RECORDc                  f    \ rS rSrSSS jjrSS jrSS jr      SS jrSS jrSS jr	S	 r
S
rg)TablesSection(   Nc                p   Uc   eXl         [        5       U l        [        5       U l        [        5       U l        [        5       U l        [        5       U l
        [        5       U l        [        5       U l        [        5       U l        [#        5       U l        Ub  U R'                  U5        U R)                  5         g N)docr   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r!   r   r"   _load_reset_not_loaded_tables)selfr1   entitiess      G/var/www/html/env/lib/python3.13/site-packages/ezdxf/sections/tables.py__init__TablesSection.__init__)   s     l& l&$&:[
&-/JJx %%'    c           	         U R                   U R                  U R                  U R                  U R                  U R
                  U R                  U R                  U R                  4	$ r0   )	r   r   r   r   r   r   r    r!   r"   )r4   s    r6   tablesTablesSection.tables;   sM    KKNNKKNNKKHHJJNN

 
	
r9   c                d   US   nUR                  5       S:w  d  UR                  S   S:w  a  [        S5      eUS	 / nS nU H  nUR                  5       S:X  aU  [        U5      (       a*  [        R                  SU S35        U R                  XC5        UR                  R                  nU/nMl  UR                  5       S	:X  a  U R                  XC5        / nM  UR                  U5        M     [        U5      (       a6  [        R                  S
R                  U5      5        U R                  XC5        g g )Nr   SECTIONr
   )   TABLESz+Critical structure error in TABLES section.TABLEz'Ignore missing ENDTAB entity in table "z".ENDTABz+Ignore missing ENDTAB entity in table "{}".)dxftype
base_classr   lenloggerdebug_load_tabledxfnameappendformat)r4   r5   section_headtable_records
table_nameentitys         r6   r2   TablesSection._loadH   s*   (0!Y.,2I2I3
3 $=  QK)+
F~~7*}%%LLA*RP $$Z?#ZZ__
!'!X-  ;  $$V,! $ }LL=DDZP Z7 r9   c                    [        U [        U   5      n[        U[        5      (       a&  UR	                  U R
                  [        U5      5        gg)zm
Load table from tags.

Args:
    name: table name e.g. VPORT
    table_entities: iterable of table records

N)getattr
TABLENAMES
isinstancer   loadr1   iter)r4   rJ   table_entitiestables       r6   rH   TablesSection._load_tablem   s>     j./eU##JJtxxn!56 $r9   c                
   U R                   R                  nU R                  5        HY  nUR                   b  M  UR                  5       nUR	                  U R                   U5        UR                  UR                  5        M[     g r0   )r1   entitydbr;   next_handleresetaddhead)r4   r\   rY   handles       r6   r3   &TablesSection._reset_not_loaded_tables|   s[    88$$[[]Eyy !--/DHHf-UZZ(	 #r9   c                \   UR                  S5        UR                  nU R                  R                  U5        U R                  R                  U5        U R
                  R                  U5        U R                  R                  U5        U R                  R                  U5        U R                  R                  U5        U R                  R                  U5        U R                  R                  U5        U[        :  a  U R                  R                  U5        UR                  SS5        g )Nz  0
SECTION
  2
TABLES
r   ENDSEC)	write_str
dxfversionr!   
export_dxfr   r   r   r    r   r   r   r	   r"   
write_tag2)r4   	tagwriterversions      r6   rg   TablesSection.export_dxf   s    9:&&!!),!!),y)y)

i(I&y)!!),U?)))4Q)r9   c                    U R                  5        H8  nU R                  R                  R                  5       nUR	                  U5        M:     g r0   )r;   r1   r\   r]   
set_handle)r4   rY   ra   s      r6   create_table_handles"TablesSection.create_table_handles   s:     [[]EXX&&224FV$ #r9   )
r   r"   r   r1   r   r   r   r   r!   r    r0   )r1   r   r5   zOptional[list[DXFEntity]])returnzSequence[Table])r5   zlist[DXFEntity]rp   None)rJ   strrX   zIterable[DXFEntity]rp   rq   )rp   rq   )ri   r   rp   rq   )__name__
__module____qualname____firstlineno__r7   r;   r2   rH   r3   rg   rn   __static_attributes__ r9   r6   r-   r-   (   s>    ($
#8J77)<7	7)*%r9   r-   )!
__future__r   typingr   r   r   r   loggingezdxf.lldxf.constr   r	   rY   r   r   r   r   r   r   r   r   r   r   ezdxf.documentr   ezdxf.entitiesr   r   ezdxf.lldxf.tagwriterr   	getLoggerrF   rT   r-   rx   r9   r6   <module>r      ss    # > >  6   &77			7	# #

p% p%r9   