a
    ¦ˆcâ  ã                   @   sf   d Z ddlZddlZddlmZ ddlmZmZmZm	Z	 e 
e¡ZG dd„ deƒZG dd„ deƒZdS )	ú  The interface of a pyface GUI. é    N)Ú	ETSConfig)ÚBoolÚ	HasTraitsÚ	InterfaceÚStrc                   @   s˜   e Zd ZdZedƒZedƒZeƒ Zddd„Z	e
dd„ ƒZedd	„ ƒZed
d„ ƒZedd„ ƒZedd„ ƒZe
ddd„ƒZe
ddd„ƒZdd„ Zdd„ ZdS )ÚIGUIr   FNc                 C   s   dS )zç Initialise a new GUI.

        Parameters
        ----------
        splash_screen : ISplashScreen instance or None
            An optional splash screen that will be displayed until the event
            loop is started.
        N© )ÚselfZsplash_screenr	   r	   úO/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/i_gui.pyÚ__init__/   s    zIGUI.__init__c                   C   s   dS )áS   Override SIGINT to prevent swallowing KeyboardInterrupt

        Override the SIGINT handler to ensure the process can be
        interrupted. This prevents GUI toolkits from swallowing
        KeyboardInterrupt exceptions.

        Warning: do not call this method if you intend your application to be
        run interactively.
        Nr	   r	   r	   r	   r   Úallow_interrupt=   s    zIGUI.allow_interruptc                 O   s   dS )aU   Call a callable after a specific delay in the main GUI thread.

        Parameters
        ----------
        millisecs : float
            Delay in milliseconds
        callable : callable
            Callable to be called after the delay
        args, kwargs :
            Arguments and keyword arguments to be used when calling.
        Nr	   )ÚclsÚ	millisecsÚcallableÚargsÚkwr	   r	   r   Úinvoke_afterI   s    zIGUI.invoke_afterc                 O   s   dS )a   Call a callable in the main GUI thread.

        Parameters
        ----------
        callable : callable
            Callable to be called after the delay
        args, kwargs :
            Arguments and keyword arguments to be used when calling.
        Nr	   )r   r   r   r   r	   r	   r   Úinvoke_laterW   s    zIGUI.invoke_laterc                 C   s   dS )an   Sets a trait after a specific delay in the main GUI thread.

        Parameters
        ----------
        millisecs : float
            Delay in milliseconds
        obj : HasTraits instance
            Object on which the trait is to be set
        trait_name : str
            The name of the trait to set
        new : any
            The value to set.
        Nr	   )r   r   ÚobjÚ
trait_nameÚnewr	   r	   r   Úset_trait_afterc   s    zIGUI.set_trait_afterc                 C   s   dS )a   Sets a trait in the main GUI thread.

        Parameters
        ----------
        obj : HasTraits instance
            Object on which the trait is to be set
        trait_name : str
            The name of the trait to set
        new : any
            The value to set.
        Nr	   )r   r   r   r   r	   r	   r   Úset_trait_laters   s    zIGUI.set_trait_laterTc                 C   s   dS )zÙ Process any pending GUI events.

        Parameters
        ----------
        allow_user_events : bool
            If allow_user_events is ``False`` then user generated events are not
            processed.
        Nr	   )Zallow_user_eventsr	   r	   r   Úprocess_events�   s    zIGUI.process_eventsc                 C   s   dS )zìSpecify if the GUI is busy.

        Parameters
        ----------
        busy : bool
            If ``True`` is passed, the cursor is set to a 'busy' cursor.
            Passing ``False`` will reset the cursor to the default.
        Nr	   )Úbusyr	   r	   r   Úset_busyŒ   s    zIGUI.set_busyc                 C   s   dS )z Start the GUI event loop. Nr	   ©r
   r	   r	   r   Ústart_event_loop›   s    zIGUI.start_event_loopc                 C   s   dS )z Stop the GUI event loop. Nr	   r   r	   r	   r   Ústop_event_loopž   s    zIGUI.stop_event_loop)N)T)T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ústartedr   Ústate_locationr   Ústaticmethodr   Úclassmethodr   r   r   r   r   r   r   r    r	   r	   r	   r   r      s*   






r   c                   @   s$   e Zd ZdZedd„ ƒZdd„ ZdS )ÚMGUIzš The mixin class that contains common code for toolkit specific
    implementations of the IGUI interface.

    Implements: _default_state_location()
    c                  C   s   ddl } |   | j| j¡ dS )r   r   N)ÚsignalÚSIGINTÚSIG_DFL)r*   r	   r	   r   r   ©   s    zMGUI.allow_interruptc                 C   s:   t j tjdtj¡}t j |¡s*t  |¡ t 	d|¡ |S )z$ Return the default state location. ZpyfacezGUI state location is <%s>)
ÚosÚpathÚjoinr   Zapplication_homeZtoolkitÚexistsÚmakedirsÚloggerÚdebug)r
   r&   r	   r	   r   Ú_default_state_location¸   s    
ÿ
zMGUI._default_state_locationN)r!   r"   r#   r$   r'   r   r4   r	   r	   r	   r   r)   ¢   s   
r)   )r$   Úloggingr-   Ztraits.etsconfig.apir   Z
traits.apir   r   r   r   Ú	getLoggerr!   r2   r   r)   r	   r	   r	   r   Ú<module>   s   
 	