
    q'VeF                     t   d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZm	Z	m
Z
mZ d dlmZ d dlmZ er ej        dd           d d	lmZ d
Ze j        d             Zd Zej                            e	o* e            o  ee
           ed          k     oej        dv d          d             Zd Zd ZdS )    N)parse)PYSIDE2PYSIDE6PYSIDE_VERSION	QtWidgets)	QComboBox)using_conda
pyside2uiczpyside2uic not installed)reason)uiczT
from qtpy.QtWidgets import QComboBox
class _QComboBoxSubclass(QComboBox):
    pass
c              #   8  K   t          | dz  dd          5 }|                    t                     ddd           n# 1 swxY w Y   t          j                            dt          |                      dV  t          j                            d           dS )z}
    Context manager that sets up a temporary module with a QComboBox subclass
    and then removes it once we are done.
    zqcombobox_subclass.pywzutf-8)modeencodingNr   )openwriteQCOMBOBOX_SUBCLASSsyspathinsertstrpop)temp_dir_pathfs     3lib/python3.11/site-packages/qtpy/tests/test_uic.pyenabled_qcombobox_subclassr      s       
//
 
 
 $ 
	"###$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ HOOAs=))***	EEEHLLOOOOOs   ?AAc                    t          j                    5  t          j        dt          d           t	          j        t          j                            t          j        	                    t                    d                    }ddd           n# 1 swxY w Y   t          |j        t          j                  sJ t          |j        t                     sJ dS )zd
    Make sure that the patched loadUi function behaves as expected with a
    simple .ui file.
    ignore.*mode.*categorymessagetest.uiN)warningscatch_warningsfilterwarningsDeprecationWarningr   loadUiosr   joindirname__file__
isinstance
pushButtonr   QPushButtoncomboBoxr   )qtbotuis     r   test_load_uir3   .   s   
 
	 	"	" L L'	
 	
 	
 	

 ZRW__X%>%>	JJKKL L L L L L L L L L L L L L L bmY%:;;;;;bk9-------s   A1BBBz6.5)darwinlinuxz>pyside6-uic command not contained in all conda-forge packages.c                 @   t          j                    5  t          j        dt          d           t	          j        t          j                            t          j        	                    t                    d                    \  }}ddd           n# 1 swxY w Y   |j        dk    sJ  G d d||          } |            }t          |t          j                  sJ t          |j        t          j                  sJ t          |j        t$                    sJ dS )	zh
    Make sure that the patched loadUiType function behaves as expected with a
    simple .ui file.
    r   r   r    r#   NUi_Formc                        e Zd Z fdZ xZS )!test_load_ui_type.<locals>.Widgetc                 r    t                                                       |                     |            d S N)super__init__setupUi)self	__class__s    r   r=   z*test_load_ui_type.<locals>.Widget.__init__W   s1    GGLL    )__name__
__module____qualname__r=   __classcell__)r@   s   @r   Widgetr9   V   s8        	 	 	 	 	 	 	 	 	rA   rF   )r$   r%   r&   r'   r   
loadUiTyper)   r   r*   r+   r,   rB   r-   r   QWidgetr.   r/   r0   r   )r1   ui_typeui_base_typerF   r2   s        r   test_load_ui_typerK   ?   se    
	 	"	" 
 
'	
 	
 	
 	

 !$GLL22I>>!
 !

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 y((((    w   
 
Bb)+,,,,,bmY%:;;;;;bk9-------s   A4BBBc           	         t          |          5  ddlm} t          j                    5  t          j        dt          d           t          j        t          j
                            t          j
                            t                    d                    }ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   t          |j        t           j                  sJ t          |j        |          sJ dS )z
    Test that we can load a .ui file with custom widgets without having to
    explicitly specify a dictionary of custom widgets, even in the case of
    PySide.
    r   )_QComboBoxSubclassr   r   r    ztest_custom.uiN)r   qcombobox_subclassrM   r$   r%   r&   r'   r   r(   r)   r   r*   r+   r,   r-   r.   r   r/   r0   )r1   tmp_pathrM   r2   s       r   test_load_ui_custom_autorP   a   sq    
$H	-	-  999999$&& 	 	#+"   
 RW__X668HII B	 	 	 	 	 	 	 	 	 	 	 	 	 	 	               bmY%:;;;;;bk#56666666s5   B>A1B'B>'B+	+B>.B+	/B>>CCc                  2   t           j                            dd                                          } |                     d          r0t          t          d          sJ t          t          d          sJ dS g d}t          d |D                       sJ dS )	z'Test that we load the full uic objects.QT_API pysider(   rG   )	compileUicompileUiDirr(   rG   widgetPluginPathc              3   @   K   | ]}t          t          |          V  d S r;   )hasattrr   ).0os     r   	<genexpr>z%test_load_full_uic.<locals>.<genexpr>   s*      44q73??444444rA   N)r)   environgetlower
startswithrY   r   all)rR   objectss     r   test_load_full_uicrc   x   s    Z^^Hb))//11F"" 5sH%%%%%sL)))))))
 
 
 44G4444444444rA   )
contextlibr)   r   r$   pytestpackaging.versionr   qtpyr   r   r   r   qtpy.QtWidgetsr   qtpy.tests.utilsr	   importorskipr   r   contextmanagerr   r3   markskipifplatformrK   rP   rc    rA   r   <module>rp      s       				 



   # # # # # # < < < < < < < < < < < < $ $ $ $ $ $ ( ( ( ( ( (
 IF-GHHHH          (. . ."  ..ne,. 
,	,K   . . .67 7 7.5 5 5 5 5rA   