a
    §ˆc—  ã                   @   s�   d Z ddlZddlmZmZmZmZ ddlmZm	Z	m
Z
 ddlmZmZ ddlmZmZ ddlmZ e ¡ ZG dd	„ d	eƒZG d
d„ deƒZdS )zÄ
Module defining a simple Python shell task.

This task provides a view with a simple Python shell.  This shouldn't be
confused with a more full-featured shell, such as those provided by IPython.
é    N)ÚStrÚListÚDictÚInstance)ÚPythonShellÚ
FileDialogÚOK)ÚSMenuÚSMenuBar)ÚTaskÚTaskPane)Ú
TaskActionc                   @   s@   e Zd ZdZdZdZeeƒZe	e
ƒZe	eƒZdd„ Zdd„ ZdS )	ÚPythonShellPanez2 A Tasks Pane containing a Pyface PythonShell
    z&pyface.tasks.contrib.python_shell.paneúPython Shellc                 C   s„   t  d¡ t|ƒ| _| jj| _t  d¡ | jD ]$}| ¡ D ]\}}| j ||¡ q:q.t  d¡ | jD ]}| j 	|¡ qdt  d¡ dS )z_ Create the python shell task pane

        This wraps the standard pyface PythonShell
        z+PythonShellPane: creating python shell panez"PythonShellPane: binding variablesz+PythonShellPane: executing startup commandszPythonShellPane: createdN)
ÚloggerÚdebugr   ÚeditorÚcontrolÚbindingsÚitemsÚbindÚcommandsZexecute_command)ÚselfÚparentZbindingÚnameÚvalueÚcommand© r   úd/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/tasks/contrib/python_shell.pyÚcreate+   s    






zPythonShellPane.createc                 C   s.   t  d¡ | j ¡  d | _| _t  d¡ dS )z, Destroy the python shell task pane
        z-PythonShellPane: destroying python shell paneNzPythonShellPane: destroyed)r   r   r   Údestroyr   ©r   r   r   r   r    A   s    

zPythonShellPane.destroyN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úidr   r   r   r   r   r   r   r   r   r   r    r   r   r   r   r      s   r   c                   @   sn   e Zd ZdZdZdZeeƒZee	ƒZ
eeƒZeeedddd�dd	d
�eddd
�ƒZdd„ Zdd„ Zdd„ ZdS )ÚPythonShellTaskzB
    A task which provides a simple Python Shell to the user.
    z!pyface.tasks.contrib.python_shellr   zOpen...ÚopenzCtrl+O)r   ÚmethodZacceleratorÚFilez&File)r&   r   ZViewz&Viewc                 C   s"   t  d¡ t| j| jd�| _| jS )z0 Create a view pane with a Python shell
        z*Creating Python shell pane in central pane)r   r   )r   r   r   r   r   Úpaner!   r   r   r   Úcreate_central_paneh   s
    
ÿz#PythonShellTask.create_central_panec                 C   s6   t  d¡ t| jjdd�}| ¡ tkr2|  |j¡ dS )z( Shows a dialog to open a file.
        zPythonShellTask: opening filez*.py)r   ZwildcardN)	r   r   r   Zwindowr   r(   r   Ú
_open_fileÚpath)r   Údialogr   r   r   r(   s   s    
zPythonShellTask.openc                 C   s    t  d| ¡ | jj |¡ dS )z? Execute the selected file in the editor's interpreter
        z$PythonShellTask: executing file "%s"N)r   r   r+   r   Zexecute_file)r   r.   r   r   r   r-   }   s    zPythonShellTask._open_fileN)r"   r#   r$   r%   r&   r   r   r   r   r   r   r   r   r+   r
   r	   r   Zmenu_barr,   r(   r-   r   r   r   r   r'   J   s"   ý
ú	
r'   )r%   ÚloggingZ
traits.apir   r   r   r   Z
pyface.apir   r   r   Zpyface.action.schema.apir	   r
   Zpyface.tasks.apir   r   Zpyface.tasks.action.apir   Ú	getLoggerr   r   r'   r   r   r   r   Ú<module>
   s   +