
    "d                     D   d Z ddlmZ ddlmZ dZes	 ddlmZ ddlm	Z	m
Z
 dZes	 ddlmZ ddlm	Z	 dd	lmZ
 d
Zes	 ddlmZ ddlm	Z	m
Z
 edk(   esddlmZ ddlm	Z	 dd	lmZ
 edk(    G d de	      Z G d de      Zy# e$ r Y dw xY w# e$ r Y Xw xY w# e$ r Y Mw xY w)z2Contains the Qt implementation of the Watcher api.    )absolute_import)PollingWatcherN)QApplication)QObjectSignalpyside2)r   )
pyqtSignalpyqt5pysidepyqt4c                       e Zd ZdZ e       Zy)QtDispatcherz>Used by QtWatcher to dispatch callbacks in the main ui thread.N)__name__
__module____qualname____doc__r   signal     4/usr/lib/python3/dist-packages/qtsass/watchers/qt.pyr   r   7   s    HXFr   r   c                   @     e Zd ZdZeZ fdZed        Z fdZ	 xZ
S )	QtWatchera8  The Qt implementation of the Watcher api.

    Subclasses PollingWatcher but dispatches :meth:`compile_and_dispatch`
    using a Qt Signal to ensure that these calls are executed in the main ui
    thread. We aren't using a QFileSystemWatcher because it fails to report
    changes in certain circumstances.
    c                 8    t         t        |           d| _        y)zSet up QtWatcher.N)superr   setup_qtdispatcherself	__class__s    r   r   zQtWatcher.setupH   s    i$&!r   c                     | j                   >t               | _         | j                   j                  j                  | j                         | j                   S )zGet the QtDispatcher.)r   r   r   connectcompile_and_dispatch)r   s    r   qtdispatcherzQtWatcher.qtdispatcherM   sF     %!-D%%--d.G.GH!!!r   c                     | j                   j                  d       t        j                         st        t
        |          S | j                  j                  j                          y)zCall when a change is detected.zChange detected...N)
_logdebugr   instancer   r   r"   r#   r   emitr   s    r   	on_changezQtWatcher.on_changeU   sL    		,- $$&CEE 	  %%'r   )r   r   r   r   
QT_BINDING_qt_bindingr   propertyr#   r)   __classcell__)r   s   @r   r   r   =   s2     K"
 " "( (r   r   )r   
__future__r   qtsass.watchers.pollingr   r*   PySide2.QtWidgetsr   PySide2.QtCorer   r   ImportErrorPyQt5.QtWidgetsPyQt5.QtCorer	   PySide.QtGuiPyQt4.QtGuiPyQt4.QtCorer   r   r   r   r   <module>r8      s    9 ' 3 
22
 0(5
 -2h ($1'7 #( #(C      s3   B B B B	B	BBBB