HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/lib/python3/dist-packages/twisted/internet/__pycache__/wxreactor.cpython-38.pyc
U

s�@g��@s�dZzddlmZmZWn$ek
r<ddlmZmZYnXzddlmZmZ	m
ZWn(ek
r~ddlmZm	Z	mZYnXddl
mZmZddlmZGdd�de�ZGd	d
�d
ej�Zdd�ZdgZd
S)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)�App�	CallAfter�Timer)�wxApp�wxCallAfter�wxTimer)�log�runtime)�_threadedselectc@s eZdZdZdd�Zdd�ZdS)�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.
    cCst�|�||_dS�N)r	�__init__�wxapp��selfr�r�</usr/lib/python3/dist-packages/twisted/internet/wxreactor.pyr1s
zProcessEventsTimer.__init__cCs|j��dS)z5
        Called repeatedly by wx event loop.
        N)r�ProcessPendingEvents�rrrr�Notify6szProcessEventsTimer.NotifyN)�__name__�
__module__�__qualname__�__doc__rrrrrrr
*sr
c@sFeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	ddd�Z
dS)�	WxReactorz[
    wxPython reactor.

    wxPython drives the event loop, select() runs in a thread.
    FcCs
||_dS)z;
        Register wxApp instance with the reactor.
        N)rrrrr�
registerWxAppGszWxReactor.registerWxAppcCs@zddl}|�|j|j�Wntk
r2YdSX|��dS)zO
        wx sometimes removes our own signal handlers, so re-add them.
        rN)�signal�SIGINT�default_int_handler�ImportErrorZ_handleSignals)rrrrr�_installSignalHandlersAgainNsz%WxReactor._installSignalHandlersAgaincCs |jr
dSd|_tj�|�dS)z#
        Stop the reactor.
        NT)�	_stoppingr�ThreadedSelectReactor�stoprrrrr%[szWxReactor.stopcCs$t|d�rt|�n|j�|�dS)zm
        Schedule function to run in main wx/Twisted thread.

        Called by the select() thread.
        rN)�hasattrr�
_postQueue�put)r�frrr�_runInMainThreades

zWxReactor._runInMainThreadcCst|d�r|j��dS)z
        Stop the wx event loop if it hasn't already been stopped.

        Called during Twisted event loop shutdown.
        rN)r&rZExitMainLooprrrr�_stopWxrs
zWxReactor._stopWxTcst��_t�d�s*t�d���td���j�j|d�|rL��	d�j
���dd�j���dd�fdd	��t
j��r�t�j�}|�d
��j���j}�`�j�s���|��z�jjdd�}Wntk
r�Yq�Yq�X|d
kr�qz
|�Wq�t��Yq�Xq�d
S)z$
        Start the reactor.
        rzMregisterWxApp() was not called on reactor, registering my own wxApp instance.F)�installSignalHandlersrZafterZshutdowncs�j�d�Sr)r'r(rrrr�<lambda>��zWxReactor.run.<locals>.<lambda>�g{�G�z�?)ZtimeoutN)rr'r&r
�msgrrZ
interleaver*Z	callLaterr"ZaddSystemEventTriggerr+r�platformZisMacOSXr
rZStartZMainLoopr#r%r�getr�err)rr,�trr)rrr�run|s@

�
�





z
WxReactor.runN)T)rrrrr#rr"r%r*r+r5rrrrr>s



rcCst�}ddlm}||�|S)zP
    Configure the twisted mainloop to be run inside the wxPython mainloop.
    r)�installReactor)rZtwisted.internet.mainr6)Zreactorr6rrr�install�sr7N)rZqueuerrr!Zwxrrrrrr	ZwxPython.wxZtwisted.pythonr
rZtwisted.internetrr
r$rr7�__all__rrrr�<module>st