a
    «ˆck  ã                   @   s4   d Z ddlmZ ddlmZmZ G dd„ deƒZdS )ú! The TVTK pipeline browser view. é    )ÚView)ÚInstanceÚon_trait_changec                   @   sP   e Zd ZdZdZdZedƒZedƒZdd„ Z	e
dƒd	d
„ ƒZdd„ Zdd„ ZdS )ÚBrowserViewr   zTVTK Pipeline BrowserÚleftz%tvtk.pipeline.browser.PipelineBrowserz0tvtk.plugins.scene.i_scene_manager.ISceneManagerc                 C   s,   ddl m} |ƒ | _| jj|d� | jjjS )z? Create the toolkit-specific control that represents the view. r   )ÚPipelineBrowser)Úparent)Ztvtk.pipeline.browserr   ÚbrowserÚshowZuiÚcontrol)Úselfr	   r   © r   úd/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/tvtk/plugins/browser/browser_view.pyÚcreate_control*   s    zBrowserView.create_controlzscene_manager:scenes_itemsc                 C   s    t | j|jƒ t | j|jƒ dS )z¶ Dynamic trait change handler.

        This is called when scenes are added/removed from the scene manager, it
        is used to add and remove objects from the pipeline.

        N)ÚmapÚ_remove_sceneÚremovedÚ
_add_sceneÚadded)r   Úeventr   r   r   Ú_on_scenes_changed:   s    
zBrowserView._on_scenes_changedc                 C   s"   | j j |¡ | j j |j¡ dS )z2 Add the specified scene to the pipeline browser. N)r
   ÚrenwinsÚappendÚroot_objectÚrender_window©r   Zscener   r   r   r   M   s    zBrowserView._add_scenec                 C   s.   || j jv r*| j j |¡ | j j |j¡ dS )z7 Remove the specified scene from the pipeline browser. N)r
   r   Úremover   r   r   r   r   r   r   U   s    zBrowserView._remove_sceneN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚpositionr   r
   Zscene_managerr   r   r   r   r   r   r   r   r   r      s   ÿ
r   N)r!   Zpyface.workbench.apir   Z
traits.apir   r   r   r   r   r   r   Ú<module>   s   	