
    he                     f    d dl Z d dlZd Zd Zd Zd Zedk(  r ej                   e              yy)    Nc            
         ddl } ddlm} ddlm}m}m} d}| j                  |d      }|j                  d	d
d|       |j                  dddddd       |j                  dddddd       |j                  dddddd       |j                  dd d!ddd"       |j                  d#d$d%d&t        d'd(d)*       |j                  d+d,d-d&t        dd(d.*       |j                  d/d01       |j                         }|j                  r
t                d}	 |j                  rSt        j                  j!                  |j"                        rt        |j"                        }|S  ||j"                  d2      t%        |j"                  |j&                  |j(                  |j*                  |j,                         d}	 |S # t.        $ rJ}	t1        d3j3                  |	j4                  |	j6                        t8        j:                  4       Y d}	~	|S d}	~	wt<        $ r5}	t1        d5j3                  |	      t8        j:                  4       Y d}	~	|S d}	~	w|||f$ r&}	t1        |	t8        j:                  4       Y d}	~	|S d}	~	wt>        $ ri}	|j                  r&ddl }
 |
jB                  t9        jD                           n,t1        d6j3                  ||7      t8        j:                  4       Y d}	~	|S d}	~	ww xY w)8z# Convert a .ui file to a .py file. r   N)PYQT_VERSION_STR   )NoSuchClassErrorNoSuchWidgetErrorUIFileExceptionpyuic6zPython User Interface Compiler)progdescriptionz-Vz	--versionversion)actionr   z-pz	--previewpreview
store_trueFz3show a preview of the UI instead of generating code)destr   defaulthelpz-oz--outputoutput-FILEz.write generated code to FILE instead of stdout)r   r   metavarr   z-xz	--executeexecutez1generate extra code to test and display the classz-dz--debugdebugzshow debug outputz-iz--indentindentstore   Nz8set indent width to N spaces, tab if N is 0 [default: 4])r   r   typer   r   r   z-wz--max-workersmax_workerszLuse a maximum of N worker processes when converting a directory [default: 0]uizGthe .ui file created by Qt Designer or a directory containing .ui files)r   zmust be a filezError: {0}: '{1}')filezError in input file: {0}a@  An unexpected error occurred.
Check that you are using the latest version of {name} and send an error report
to the PyQt mailing list and include the following information:

- your version of {name} ({version})
- the .ui file that caused this error
- the debug output of {name} (use the --debug flag when calling {name}))namer   )#argparsePyQt6.QtCorer   
exceptionsr   r   r   ArgumentParseradd_argumentint
parse_argsr   configure_loggingr   ospathisfiler   generater   r   r   r   IOErrorprintformatstrerrorfilenamesysstderrSyntaxError	Exception	tracebackprint_exceptionexc_info)r"   r   r   r   r   PROGRAM_NAMEparserargsexit_statuser7   s              1/usr/lib/python3/dist-packages/PyQt6/uic/pyuic.pymainr@      s    -  L $$,8 % :F k)$  &
k	,F  H jxA  C k	,D  F igl 3  5
jxaK  M oMa_  a Z  \ D zzK!Q<<ww~~dgg&%dgg.@ = &dgg/?@@TWWdkk4;;$$&K4 1  !!((QZZ@ZZ	! 	!. )  E(//2DD& # /A "acjj!!    Q::%I%%s||~6 K LR6Wcm}6K~  FI  FP  FPQ QsE   A
F6 AF6 6	K!??HK!*I  K!I,,K!8AKK!c                      ddl } | j                         }|j                  | j                  d             | j	                  d      }|j                  |       |j                  | j                         y)z* Configure logging when debug is enabled. r   Nz%(name)s: %(message)sz	PyQt6.uic)loggingStreamHandlersetFormatter	Formatter	getLogger
addHandlersetLevelDEBUG)rB   handlerloggers      r?   r)   r)   l   s]     ##%G**+BCD{+F
g
OOGMM"    c                 Z   ddl m} t        j                  j	                  |       rndk(  rd}nQt        j                  j	                        st        j                  j                        sfd}n |d|  d      ddlm}  || d	||||
       yt        j                  j	                        r |d|  d      ddlm} dk(  r2ddl	}	|	j                  t        j                  j                  d      }
d	}nt        dd      }
d} || |
||       |r|
j                          yy)z Generate the Python code. r   )r   r   Nc                     |fS )N )dfr   s     r?   <lambda>zgenerate.<locals>.<lambda>   s    { rL   zmust be a directory as z is a directory)compileUiDirF)recursemapr   r   r   zcannot be a directory unless )	compileUir   utf8)encodingwtT)r$   r   r*   r+   isdirexists
compile_uirS   rV   ioTextIOWrapperr3   stdoutbufferopenclose)ui_filer   r   r   r   r   rU   rS   rV   r]   pyfileneeds_closes    `          r?   r-   r-   y   s    ,	ww}}WS=CWW]]6""''..*@*C!&-gYoFH H 	-We+w	0 
v	f/yHJ 	J 	*S=%%cjj&7&7&%IFK&$8FK'67F3LLN rL   c                 |    ddl m} ddlm}  || g      } ||       }|j	                          |j                         S )z` Preview the .ui file.  Return the exit status to be passed back to the
    parent process.
    r   )QApplicationr   )loadUi)PyQt6.QtWidgetsrg   load_uirh   showexec)rc   rg   rh   appr   s        r?   r   r      s4    
 -
y
!C	BGGI88:rL   __main__)r*   r3   r@   r)   r-   r   __name__exitrO   rL   r?   <module>rq      sC   & 
 
Rj
#%P" zCHHTV rL   