a
    ¨ˆcÄ  ã                   @   sD   d Z ddlmZ ddlmZ ddlmZmZ ddd„Zddd	„Z	d
S )z8Simple utility functions provided by the scripting API.
é   )ÚRecorder)ÚRecorderWithUI)Úget_recorderÚset_recorderTc                 K   sF   |rt | d�}|jdd� ntƒ }t|ƒ d|_|j| fi |¤Ž |S )a  Convenience function to start recording.  Returns the recorder.

    Parameters
    ----------

    object :  object to record.

    ui : bool specifying if a UI is to be shown or not

    kw : Keyword arguments to pass to the register function of the
    recorder.
    )ÚrootZlive)ÚkindT)r   Zedit_traitsr   r   Ú	recordingÚregister)ÚobjectZuiÚkwÚr© r   úZ/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/apptools/scripting/util.pyÚstart_recording   s    
r   c                 C   s.   t ƒ }| | ¡ d|_tdƒ |r*| ¡  dS )zpStop recording the object.  If `save` is `True`, this will pop up
    a UI to ask where to save the script.
    FN)r   Ú
unregisterr   r   Zui_save)r
   ÚsaveÚrecorderr   r   r   Ústop_recording.   s    
r   N)T)T)
Ú__doc__r   r   Zrecorder_with_uir   Zpackage_globalsr   r   r   r   r   r   r   r   Ú<module>
   s
   
