
    Dfe                        d 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  ej                   e      Z G d	 d
e      Zd Zedk(  r5 ej*                  ej,                          ej.                   e              yy)a  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:

    - `pyside6-rcc` for PySide6 and QtPy (Python) (Official)
    - There is no specific rcc compiler for PyQt6, use `pyside6-rcc` (Python)
    - `pyrcc5` for PyQt5 (Python)
    - `pyside2-rcc` for PySide2 (Python)
    - `rcc` for Qt5/Qt6 (C++)

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

Links to understand those tools:

    - `pyside6-rcc`: https://doc.qt.io/qtforpython/tutorials/basictutorial/qrcfiles.html (Official)
    - `pyrcc5`: http://pyqt.sourceforge.net/Docs/PyQt5/resources.html#pyrcc5
    - `pyside2-rcc: https://doc.qt.io/qtforpython/overviews/resources.html (Documentation Incomplete)
    - `rcc` on Qt6: https://doc.qt.io/qt-6/resources.html
    - `rcc` on Qt5: http://doc.qt.io/qt-5/rcc.html

    N)FileSystemEventHandler)Observer)PACKAGE_PATH)DarkPalette)LightPalette)process_palettec                   (     e Zd ZdZ fdZd Z xZS )QSSFileHandlerQSS File observer.c                 8    t         t        |           || _        y)r   N)superr
   __init__args)selfparser_args	__class__s     ;/usr/lib/python3/dist-packages/qdarkstyle/utils/__main__.pyr   zQSSFileHandler.__init__.   s    nd,.	    c                     |j                   j                  d      r,t        | j                  j                         t        d       yy)zHandle file system events.z.qss)compile_for
N)src_pathendswithr   r   createprint)r   events     r   on_modifiedzQSSFileHandler.on_modified3   s2    >>""6*		(8(89$K +r   )__name__
__module____qualname____doc__r   r   __classcell__)r   s   @r   r
   r
   +   s     
r   r
   c                  j   t        j                  t        t         j                        } | j	                  ddt
        d       | j	                  ddg dt
        d	
       | j	                  dddd       | j                         }|j                  r]t        }t               }t        |      }|j                  ||d       	 t        d       |j                          |j!                          yt"        t$        fD ]  }t'        ||j(                          y# t        $ r |j                          Y Uw xY w)zProcess QRC files.)descriptionformatter_classz	--qrc_dirNz2QRC file directory, relative to current directory.)defaulttypehelpz--createqtpy)	pyqt5pyqt6pyside2pyside6r)   	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
)paletter   )argparseArgumentParserr!   RawDescriptionHelpFormatteradd_argumentstr
parse_argswatchr   r   r
   scheduler   startKeyboardInterruptstopjoinr   r   r   r   )parserr   pathobserverhandlerr6   s         r   mainrG   ;   s#   $$5=5Y5Y[F
 $ Q  T 
 & q C	  E
 	4+6  8 Dzz: T2'448	NONN 	#\2 	FGGE	F	 ! 	MMO	s   D D21D2__main__)level)r!   r7   loggingsyswatchdog.eventsr   watchdog.observersr   
qdarkstyler   qdarkstyle.dark.paletter   qdarkstyle.light.paletter   qdarkstyle.utilsr   	getLoggerr   _loggerr
   rG   basicConfigDEBUGexit r   r   <module>rX      s   0   
 3 ' $ / 1 ,
'

H
%+   FF zGgmm,CHHTV r   