Mini Shell

Direktori : /lib/python3.6/site-packages/simpleline/render/screen/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/simpleline/render/screen/__pycache__/signal_handler.cpython-36.pyc

3

<�Zc�
�@s0ddlmZddlmZmZGdd�de�ZdS)�)�App)�RenderScreenSignal�CloseScreenSignalc@sDeZdZdZddd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�
SignalHandlera"Provides methods for handling signals anc callbacks.

    Provides main methods:
        `connect()`       -- connect this widget on given signal
        `create_signal()` -- create signal class which can be used in the emit method
        `emit()`          -- emit signal given signal
    NcCstj�j|||�dS)a{Connect this class method with given signal.

        :param signal: signal class which you want to connect
        :type signal: class based on `simpleline.event_loop.AbstractSignal`

        :param callback: the callback function
        :type callback: func(event_message, data)

        :param data: Data you want to pass to the callback
        :type data: Anything
        N)r�get_event_loopZregister_signal_handler)�self�signal�callback�data�r�$/usr/lib/python3.6/signal_handler.py�connect#szSignalHandler.connectrcCs
|||�S)a|Create signal instance usable in the emit method.

        :param signal_class: signal you want to use
        :type signal_class: class based on `simpleline.event_loop.AbstractSignal`

        :param priority: priority of the signal; please look on the `simpleline.event_loop.AbstractSignal.priority` for
                         further info
        :type priority: int
        r)rZsignal_classZpriorityrrr�
create_signal1s
zSignalHandler.create_signalcCstj�j|�dS)z�Emit the signal.

        This will add `signal` to the event loop.

        :param signal: signal to emit
        :type signal: instance of class based on `simpleline.event_loop.AbstractSignal`
        N)rr�enqueue_signal)rrrrr�emit=szSignalHandler.emitcCs|j|�}|j|�dS)z}Create the signal and emit it.

        This is basically shortcut for calling `self.create_signal` and `self.emit`.
        N)rr)rrZcreated_signalrrr�create_and_emitGs
zSignalHandler.create_and_emitcCs|jt�}tj�j|�dS)zYEmit signal to initiate draw.

        Add RenderScreenSignal to the event loop.
        N)rrrrr)rrrrr�redrawOs
zSignalHandler.redrawcCs|jt�}tj�j|�dS)z\Emit signal to close this screen.

        Add CloseScreenSignal to the event loop.
        N)rrrrr)rrrrr�closeWs
zSignalHandler.close)N)r)
�__name__�
__module__�__qualname__�__doc__r
rrrrrrrrrrs


rN)Z
simplelinerZsimpleline.event_loop.signalsrr�objectrrrrr�<module>s