3
6ßL]Š	  ã               @   sp   d dl mZmZmZmZ d dlmZmZmZ d dl	m
Z
 d dlmZ G dd„ deƒZG dd„ deƒZd	d
„ ZdS )é    )Ú	HasTraitsÚInstanceÚListÚUnicode)ÚItemÚTableEditorÚView)ÚOKCancelButtons)ÚObjectColumnc               @   s   e Zd ZdZeZeZeZdS )Ú_RolezThis represents the role model.N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚnameÚdescriptionr   Úpermissions© r   r   úN/tmp/pip-install-5sebvq2j/apptools/apptools/permissions/default/select_role.pyr      s   r   c               @   s\   e Zd ZdZeeƒZeeƒZe	e
dd�e
dd�gdddd�Zeed	ded
�ddded�ZdS )Ú
_RolesViewz/This represents the view used to select a role.r   )r   r   Ú	selectionTF)ÚcolumnsÚselectedZ
sort_modelZconfigurableÚmodel)Z
show_labelÚeditorzSelect a RoleÚreadonlyÚmodal)ÚtitleÚstyleÚkindZbuttonsN)r   r   r   r   r   r   r   r   r   r   r
   Ztable_editorr   r   r	   Ztraits_viewr   r   r   r   r   &   s   

r   c             C   sP   dd„ | D ƒ}t |d�}|jƒ rB|jdk	rB|jj|jj|jjf}n
ddg f}|S )z2Return a single role from the given list of roles.c             S   s    g | ]\}}}t |||d �‘qS ))r   r   r   )r   )Ú.0r   r   r   r   r   r   ú
<listcomp>@   s   zselect_role.<locals>.<listcomp>)r   NÚ )r   Zconfigure_traitsr   r   r   r   )Zrolesr   ÚviewÚroler   r   r   Úselect_role<   s    

r%   N)Z
traits.apir   r   r   r   Ztraitsui.apir   r   r   Ztraitsui.menur	   Ztraitsui.table_columnr
   r   r   r%   r   r   r   r   Ú<module>   s   