a
    ¦ˆc¤  ã                   @   s\   d dl mZ d dlmZmZmZmZmZ eeƒG dd„ deƒƒZeeƒG dd„ deƒƒZ	dS )é    )ÚIDropHandler)ÚCallableÚ	HasTraitsÚListÚprovidesÚStrc                   @   s(   e Zd ZdZeZeZdd„ Zdd„ ZdS )ÚBaseDropHandlerz Basic drop handler
    c                 C   s   |   ||¡S ©N)Úon_can_handle©ÚselfÚeventÚtarget© r   úV/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/drop_handler.pyÚcan_handle_drop   s    zBaseDropHandler.can_handle_dropc                 C   s   |   ||¡S r	   )Ú	on_handler   r   r   r   Úhandle_drop!   s    zBaseDropHandler.handle_dropN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r
   r   r   r   r   r   r   r   r      s
   r   c                   @   s,   e Zd ZdZeeƒZeZdd„ Z	dd„ Z
dS )ÚFileDropHandlerz: Class to handle backward compatible file drop events
    c                 C   s@   |  ¡  ¡ r<|  ¡  ¡ D ]"}| ¡ }| t| jƒ¡r dS qdS )zA Does the drop event contails file data with matching extensions TF)ÚmimeDataZhasUrlsÚurlsÚtoLocalFileÚendswithÚtupleÚ
extensions)r   r   r   ÚurlÚ	file_pathr   r   r   r   4   s    zFileDropHandler.can_handle_dropc                 C   s$   |  ¡  ¡ D ]}|  | ¡ ¡ qdS )z+ Open the file using the supplied callback N)r   r   Ú	open_filer   )r   r   r   r   r   r   r   r   =   s    zFileDropHandler.handle_dropN)r   r   r   r   r   r   r   r   r!   r   r   r   r   r   r   r   %   s
   	r   N)
Zpyface.i_drop_handlerr   Z
traits.apir   r   r   r   r   r   r   r   r   r   r   Ú<module>
   s
   