
    \g`{                        d Z ddlmZm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 ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZmZ ddlmZ  G d de          Zd Zedk    r ej         e                       dS dS )al  Script to process QRC files (convert .qrc to _rc.py and .rcc).

The script will attempt to compile the qrc file using the following tools:

    - pyrcc4 for PyQt4 and PyQtGraph (Python)
    - pyrcc5 for PyQt5 and QtPy (Python)
    - pyside-rcc for PySide (Python)
    - pyside2-rcc for PySide2 (Python)
    - rcc for Qt4 and Qt5 (C++)

Delete the compiled files that you don't want to use manually after
running this script.

Links to understand those tools:

    - pyrcc4: http://pyqt.sourceforge.net/Docs/PyQt4/resources.html#pyrcc4
    - pyrcc5: http://pyqt.sourceforge.net/Docs/PyQt5/resources.html#pyrcc5
    - pyside-rcc: https://www.mankier.com/1/pyside-rcc
    - pyside2-rcc: https://doc.qt.io/qtforpython/overviews/resources.html (Documentation Incomplete)
    - rcc on Qt4: http://doc.qt.io/archives/qt-4.8/rcc.html
    - rcc on Qt5: http://doc.qt.io/qt-5/rcc.html

    )absolute_importprint_functionN)call)FileSystemEventHandler)Observer)PACKAGE_PATH)DarkPalette)LightPalette)run_process)create_imagescreate_palette_imagegenerate_qrc_file)
create_qssc                   (     e Zd ZdZ fdZd Z xZS )QSSFileHandlerQSS File observer.c                 d    t          t          |                                            || _        dS )r   N)superr   __init__args)selfparser_args	__class__s     9lib/python3.11/site-packages/qdarkstyle/utils/__main__.pyr   zQSSFileHandler.__init__4   s*    nd##,,...			    c                     |j                             d          r%t          | j                   t	          d           dS dS )zHandle file system events.z.qss
N)src_pathendswithr   r   print)r   events     r   on_modifiedzQSSFileHandler.on_modified9   sC    >""6** 		"""$KKKKK	 	r   )__name__
__module____qualname____doc__r   r"   __classcell__)r   s   @r   r   r   1   sM                 
      r   r   c                     t          j        t          t           j                  } |                     ddt
          d           |                     ddg dt
          d	
           |                     dddd           |                                 }|j        rt          }t                      }t          |          }|                    ||d           	 t          d           |                                 n$# t          $ r |                                 Y nw xY w|                                 dS t"          t$          fD ]}t'          ||           dS )zProcess QRC files.)descriptionformatter_classz	--qrc_dirNz2QRC file directory, relative to current directory.)defaulttypehelpz--createqtpy)	pyqtpyqt5pysidepyside2r.   	pyqtgraphqtqt5allz$Choose which one would be generated.)r+   choicesr,   r-   z--watchz-w
store_truezWatch for file changes.)actionr-   )r   T)	recursivez7
Watching QSS file for changes...
Press Ctrl+C to exit
)argparseArgumentParserr&   RawDescriptionHelpFormatteradd_argumentstr
parse_argswatchr   r   r   scheduler    startKeyboardInterruptstopjoinr	   r
   r   )parserr   pathobserverhandlerpalettes         r   mainrL   @   s   $5=5Y[ [ [F
 $ Q  T T T 
 & o o o C	  E E E
 	4+6  8 8 8 Dz ':: T222'44888	NOOONN  	 	 	MMOOOOO	#\2 	' 	'Gg&&&&	' 	's   #C; ;DD__main__) r&   
__future__r   r   r;   globossys
subprocessr   watchdog.eventsr   watchdog.observersr   
qdarkstyler   qdarkstyle.dark.paletter	   qdarkstyle.light.paletter
   qdarkstyle.utilsr   qdarkstyle.utils.imagesr   r   r   qdarkstyle.utils.scssr   r   rL   r#   exit r   r   <module>r]      s   2 7 6 6 6 6 6 6 6   				 



       3 2 2 2 2 2 ' ' ' ' ' ' $ # # # # # / / / / / / 1 1 1 1 1 1 ( ( ( ( ( (8 8 8 8 8 8 8 8 8 8 , , , , , ,    +    '  '  'F zCHTTVV r   