%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/__pycache__/wxreactor.cpython-312.pyc

�

Ϫ�f����dZddlmZmZ	ddlmZmZm	Z
ddl
mZddlmZmZGd�de
�ZGd	�d
ej&�Zd�ZdgZy
#e$r
ddlmZmZm
Z
Y�FwxYw)aa
This module provides wxPython event loop support for Twisted.

In order to use this support, simply do the following::

    |  from twisted.internet import wxreactor
    |  wxreactor.install()

Then, when your root wxApp has been created::

    | from twisted.internet import reactor
    | reactor.registerWxApp(yourApp)
    | reactor.run()

Then use twisted.internet APIs as usual. Stop the event loop using
reactor.stop(), not yourApp.ExitMainLoop().

IMPORTANT: tests will fail when run under this reactor. This is
expected and probably does not reflect on the reactor's ability to run
real applications.
�)�Empty�Queue)�	CallAfter�PySimpleApp�Timer)�
wxPySimpleApp�wxCallAfter�wxTimer)�_threadedselect)�log�runtimec��eZdZdZd�Zd�Zy)�ProcessEventsTimerz�
    Timer that tells wx to process pending events.

    This is necessary on macOS, probably due to a bug in wx, if we want
    wxCallAfters to be handled when modal dialogs, menus, etc.  are open.
    c�<�tj|�||_y�N)r
�__init__�wxapp��selfrs  �</usr/lib/python3/dist-packages/twisted/internet/wxreactor.pyrzProcessEventsTimer.__init__2s���������
�c�8�|jj�y)z5
        Called repeatedly by wx event loop.
        N)r�ProcessPendingEvents�rs r�NotifyzProcessEventsTimer.Notify6s��	
�
�
�'�'�)rN)�__name__�
__module__�__qualname__�__doc__rr�rrrr*s����*rrc�:�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d
d�Z
y	)�	WxReactorz[
    wxPython reactor.

    wxPython drives the event loop, select() runs in a thread.
    Fc��||_y)z;
        Register wxApp instance with the reactor.
        N)rrs  r�
registerWxAppzWxReactor.registerWxAppFs����
rc��	ddl}|j|j|j�|jj�y#t$rYywxYw)zO
        wx sometimes removes our own signal handlers, so re-add them.
        rN)�signal�SIGINT�default_int_handler�ImportError�_signals�install)rr&s  r�_installSignalHandlersAgainz%WxReactor._installSignalHandlersAgainLsH��	���M�M�&�-�-��)C�)C�D�	
�
�
������	��	�s�*A�	A�Ac�j�|jryd|_tjj|�y)z#
        Stop the reactor.
        NT)�	_stoppingr�ThreadedSelectReactor�stoprs rr0zWxReactor.stopYs)���>�>������-�-�2�2�4�8rc�j�t|d�rt|�y|jj|�y)zm
        Schedule function to run in main wx/Twisted thread.

        Called by the select() thread.
        rN)�hasattrr	�
_postQueue�put)r�fs  r�_runInMainThreadzWxReactor._runInMainThreadbs)���4��!���N�
�O�O����"rc�R�t|d�r|jj�yy)z
        Stop the wx event loop if it hasn't already been stopped.

        Called during Twisted event loop shutdown.
        rN)r2r�ExitMainLooprs r�_stopWxzWxReactor._stopWxns#���4��!��J�J�#�#�%�"rc�\��t��_t�d�s.tjd��jt
���j�j|��|r�jd�j��jdd�j��jdd�fd��tjj�r&t!�j"�}|j%d��j"j'��j"}�`�j(sJ�j+�|j-�		�jj/d	�
�}|�y	|��)y#t0$rtj2�Y�!wxYw#t4$rY�YwxYw)z$
        Start the reactor.
        rzMregisterWxApp() was not called on reactor, registering my own wxApp instance.)�installSignalHandlersr�after�shutdownc�:���jjd�Sr)r3r4rs�r�<lambda>zWxReactor.run.<locals>.<lambda>�s������)<�)<�T�)B�r�g{�G�z�?)�timeoutN)rr3r2r�msgr$r�
interleaver6�	callLaterr,�addSystemEventTriggerr9r
�platform�isMacOSXrr�Start�MainLoopr.r0r�get�
BaseException�errr)rr;�trr5s`    r�runz
WxReactor.runwst��� �'����t�W�%��G�G�5�
�
���}��/�	
����!�!�9N�	�	
�!��N�N�1�d�>�>�?�	
�"�"�7�J����E��"�"��Z�!B�	
����$�$�&�"�4�:�:�.�A�
�G�G�A�J��
�
�����
�
���J��~�~�
�I�I�K��&�&�(��
"����+�+�D�+�9�A��y��"������$)�"����	�"������s$�F�3E<�<F�F�	F+�*F+N)T)rrrrr.r$r,r0r6r9rNr rrr"r"=s,����I�� �9�
#�&�7"rr"c�6�t�}ddlm}||�|S)zP
    Configure the twisted mainloop to be run inside the wxPython mainloop.
    r)�installReactor)r"�twisted.internet.mainrP)�reactorrPs  rr+r+�s���k�G�4��7���Nrr+N)r�queuerr�wxrr	rrrr
r)�wxPython.wx�twisted.internetr�twisted.pythonrr
rr/r"r+�__all__r rr�<module>rYsp���,�@���-�'�*��*�&q"��5�5�q"�h��+���u�@�?�?�@�s�
A�A�A

Zerion Mini Shell 1.0