
    q'Ve                         d Z ddlZddlmZmZmZmZ ddlmZ e	fZ
d ZddZdZdd	Zdd
Zdddej        fdZ	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZd ZdS )z
Compatibility functions
    N   )PYQT5PYQT6PYSIDE2PYSIDE6)QFileDialogc                 ,    t          | t                    S )zZReturn True if `obj` is a text string, False if it is anything else,
    like binary data.)
isinstancestrobjs    +lib/python3.11/site-packages/qtpy/compat.pyis_text_stringr      s     c3    c                 r    |t          |           S t          | t                     r| S t          | |          S )z&Convert `obj` to (unicode) text string)r   r
   )r   encodings     r   to_text_stringr      s:    3xx#s 
sHr   Fc                     | S )zConvert Python object to QVariant
    This is a transitional function from PyQt API#1 (QVariant exist)
    to PyQt API#2 and Pyside (QVariant does not exist) r   s    r   to_qvariantr   ,   s	     Jr   c                     | S )zConvert QVariant object to Python object
    This is a transitional function from PyQt API #1 (QVariant exist)
    to PyQt API #2 and Pyside (QVariant does not exist)r   )qobjpytypes     r   from_qvariantr   3   s	     Kr    c                    t           j        dk    r1t           j        t           j        }}d\  t           _        t           _        	 t	          j        | |||          }t           j        dk    r||ct           _        t           _        n.# t           j        dk    r||ct           _        t           _        w xY wt          |          st          |          }|S )zWrapper around QtGui.QFileDialog.getExistingDirectory static method
    Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0win32NN)sysplatformstdoutstderrr   getExistingDirectoryr   r   )parentcaptionbasediroptions_temp1_temp2results          r   getexistingdirectoryr+   =   s     |wSZ!+
CJ
41	
 
 <7""%+V"CJ
 <7""%+V"CJ
3333&!! (''Ms   B +B/c                 ^   |t          j        d          }t          t           |           }t          j        dk    r1t          j        t          j        }	}d\  t          _        t          _         |||||||          }
t          j        dk    r||	ct          _        t          _        |
\  }}||fS )Nr   r   r   )r   Optiongetattrr   r    r!   r"   )attrr$   r%   r&   filtersselectedfilterr'   funcr(   r)   r*   outputs               r   _qfiledialog_wrapperr4   [   s     $Q'';%%D |wSZ!+
CJT&'7G^WMMF
|w!'
CJ#FN >!!r   c           	      .    t          d| |||||          S )zWrapper around QtGui.QFileDialog.getOpenFileName static method
    Returns a tuple (filename, selectedfilter) -- when dialog box is canceled,
    returns a tuple of empty strings
    Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0getOpenFileNamer$   r%   r&   r0   r1   r'   r4   r7   s         r   getopenfilenamer9   y   0      %   r   c           	      .    t          d| |||||          S )a   Wrapper around QtGui.QFileDialog.getOpenFileNames static method
    Returns a tuple (filenames, selectedfilter) -- when dialog box is canceled,
    returns a tuple (empty list, empty string)
    Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0getOpenFileNamesr7   r8   r7   s         r   getopenfilenamesr=      s0      %   r   c           	      .    t          d| |||||          S )zWrapper around QtGui.QFileDialog.getSaveFileName static method
    Returns a tuple (filename, selectedfilter) -- when dialog box is canceled,
    returns a tuple of empty strings
    Compatible with PyQt >=v4.4 (API #1 and #2) and PySide >=v1.0getSaveFileNamer7   r8   r7   s         r   getsavefilenamer@      r:   r   c                     t           st          rddlm} |                    |            S t
          st          rddlm} |                    |           S dS )zgWrapper around sip.isdeleted and shiboken.isValid which tests whether
    an object is currently alive.r   )sip)shibokenN)	r   r   r   rB   	isdeletedr   r   rC   isValid)r   rB   rC   s      r   isaliverF      st      & &==%%%% %' %$$$4r   )Nr   )Nr   r   r   r   N)__doc__r   r   r   r   r   r   	QtWidgetsr   r   
TEXT_TYPESr   r   
PYQT_API_1r   r   ShowDirsOnlyr+   r4   r9   r=   r@   rF   r   r   r   <module>rL      s  
  


            # " " " " "V
         
       $	   @ " " " ">    0    0    0    r   