a
    ¦ˆc"  ã                   @   sP   d Z ddlmZmZ ddlmZ ddlmZ G dd„ deƒZG dd„ deƒZ	d	S )
ú0 The interface for an interactive Python shell. é    )ÚEventÚ	HasTraits)ÚKeyPressedEvent)ÚILayoutWidgetc                   @   sR   e Zd ZdZeƒ ZeeƒZdd„ Zdd„ Z	ddd„Z
dd	d
„Zdd„ Zdd„ ZdS )ÚIPythonShellr   c                 C   s   dS )zµ Get the shell's interpreter

        Returns
        -------
        interpreter : InteractiveInterpreter instance
            Returns the InteractiveInterpreter instance.
        N© ©Úselfr   r   úX/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/i_python_shell.pyÚinterpreter$   s    zIPythonShell.interpreterc                 C   s   dS ©a   Binds a name to a value in the interpreter's namespace.

        Parameters
        ----------
        name : str
            The python idetifier to bind the value to.
        value : any
            The python object to be bound into the interpreter's namespace.
        Nr   ©r
   ÚnameÚvaluer   r   r   Úbind-   s    zIPythonShell.bindTc                 C   s   dS )a   Execute a command in the interpreter.

        Parameters
        ----------
        command : str
            A Python command to execute.
        hidden : bool
            If 'hidden' is True then nothing is shown in the shell - not even
            a blank line.
        Nr   )r
   ÚcommandÚhiddenr   r   r   Úexecute_command8   s    zIPythonShell.execute_commandc                 C   s   dS )a   Execute a file in the interpeter.

        Parameters
        ----------
        path : str
            The path to the Python file to execute.
        hidden : bool
            If 'hidden' is True then nothing is shown in the shell - not even
            a blank line.
        Nr   )r
   Úpathr   r   r   r   Úexecute_fileD   s    zIPythonShell.execute_filec                 C   s   dS )a   Return the current command history and index.

        Returns
        -------
        history : list of str
            The list of commands in the new history.
        history_index : int from 0 to len(history)
            The current item in the command history navigation.
        Nr   r	   r   r   r   Úget_historyP   s    zIPythonShell.get_historyc                 C   s   dS )a   Replace the current command history and index with new ones.

        Parameters
        ----------
        history : list of str
            The list of commands in the new history.
        history_index : int
            The current item in the command history navigation.
        Nr   )r
   ÚhistoryZhistory_indexr   r   r   Úset_history[   s    zIPythonShell.set_historyN)T)T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úcommand_executedr   Zkey_pressedr   r   r   r   r   r   r   r   r   r   r      s   	

r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚMPythonShellz§ The mixin class that contains common code for toolkit specific
    implementations of the IPythonShell interface.

    Implements: bind(), _on_command_executed()
    c                 C   s   ||   ¡ j|< dS r   )r   Úlocalsr   r   r   r   r   r   s    
zMPythonShell.bindc                 C   s
   | | _ dS )z7 Called when a command has been executed in the shell. N)r   r	   r   r   r   Ú_on_command_executed‚   s    z!MPythonShell._on_command_executedN)r   r   r   r   r   r!   r   r   r   r   r   g   s   
r   N)
r   Z
traits.apir   r   Zpyface.key_pressed_eventr   Zpyface.i_layout_widgetr   r   r   r   r   r   r   Ú<module>   s
   R