3
8Ad]•  ã               @   s^   d Z ddlmZ ddlZddlmZ ddlmZmZ e	ƒ Z
dd„ Zdd	„ ZG d
d„ deƒZdS )zŠ Creates a PyQt specific modal dialog user interface that runs as a
complete application, using information from the specified UI object.
é    )Úabsolute_importN)ÚQtGui)Úis_event_loop_running_qt4Ústart_event_loop_qt4c             C   s:   |dkst ‚|r6| tkst ‚tj| ƒ | jtddd� dS )z/ Remove the UI object from KEEP_ALIVE_UIS.
    Ú	destroyedT)ÚremoveN)ÚAssertionErrorÚKEEP_ALIVE_UISr   Úon_trait_changeÚon_ui_destroyed)ÚobjectÚnameÚoldr   © r   úy/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.6/site-packages/traitsui-6.1.2-py3.6.egg/traitsui/qt4/view_application.pyr   $   s
    
r   c       	      C   sŠ   |dks|dkr|j dkrd}tjjƒ }|dks:t|ƒ rRt| ||||||ƒjjS |j| |||||d�}|js„t	j
|ƒ |jtdƒ |jS )aF   Creates a stand-alone PyQt application to display a specified traits UI
        View.

    Parameters
    ----------
    context : object or dictionary
        A single object or a dictionary of string/object pairs, whose trait
        attributes are to be edited. If not specified, the current object is
        used.
    view : view object
        A View object that defines a user interface for editing trait attribute
        values.
    kind : string
        The type of user interface window to create. See the
        **traitsui.view.kind_trait** trait for values and
        their meanings. If *kind* is unspecified or None, the **kind**
        attribute of the View object is used.
    handler : Handler object
        A handler object used for event handling in the dialog box. If
        None, the default handler for Traits UI is used.
    scrollable : Boolean
        Indicates whether the dialog box should be scrollable. When set to
        True, scroll bars appear on the dialog box if it is not large enough
        to display all of the items in the view at one time.


    ZpanelNÚmodal)ÚkindÚhandlerÚidÚ
scrollableÚargsr   )r   r   ZQApplicationÚinstancer   ÚViewApplicationÚuiÚresultr   r	   Úaddr
   r   )	ÚcontextÚviewr   r   r   r   r   Úappr   r   r   r   Úview_application3   s     

r   c               @   s   e Zd ZdZdd„ ZdS )r   z; Modal window that contains a stand-alone application.
    c             C   sb   || _ || _|| _|| _|| _|| _|| _| jj| j | j| j| j| j| jd�| _|dkr^tƒ  dS )z! Initializes the object.
        )r   r   r   r   r   r   Ú	livemodalN>   r    r   )	r   r   r   r   r   r   r   r   r   )Úselfr   r   r   r   r   r   r   r   r   r   Ú__init__q   s    
zViewApplication.__init__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r"   r   r   r   r   r   j   s   r   )r&   Ú
__future__r   ÚosZ	pyface.qtr   Zpyface.util.guisupportr   r   Úsetr	   r   r   r   r   r   r   r   r   Ú<module>   s   7