3
7ßL]  ã               @   sL   d Z ddl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 )
z0 The interface for an interactive Python shell. é    )ÚEvent)ÚKeyPressedEvent)ÚIWidgetc               @   sP   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 )ÚIPythonShellz0 The interface for an interactive Python shell. c             C   s   dS )zµ Get the shell's interpreter

        Returns
        -------
        interpreter : InteractiveInterpreter instance
            Returns the InteractiveInterpreter instance.
        N© )Úselfr   r   ú9/tmp/pip-install-5sebvq2j/pyface/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   Úbind0   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_command;   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_fileG   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_historyS   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 ƒ j|< 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.
        N)r	   Úlocals)r   r
   r   r   r   r   r   u   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   j   s   r   N)
r   Z
traits.apir   Zpyface.key_pressed_eventr   Zpyface.i_widgetr   r   Úobjectr   r   r   r   r   Ú<module>   s
   R