3
6ßL]³  ã               @   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   sB   |rt | d�}|jdd� ntƒ }t|ƒ d|_|j| f|Ž |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)ÚobjectÚuiÚkwÚr© r   ú=/tmp/pip-install-5sebvq2j/apptools/apptools/scripting/util.pyÚstart_recording   s    
r   c             C   s.   t ƒ }|j| ƒ d|_tdƒ |r*|jƒ  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
   
