B
    ÔùÓ`Ë  ã               @   sb   d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
 G dd„ deƒZG dd„ deeƒZd	S )
é    )ÚBoolÚStringÚAliasÚInteger)ÚSerialisable)ÚBase64Binary)Úhash_passwordc               @   s4   e Zd ZdZd	dd„Zedd„ ƒZejdd„ ƒZdS )
Ú
_ProtectedNÚ Fc             C   s   |st |ƒ}|| _dS )zSet a password on this sheet.N)r   Ú	_password)ÚselfÚvalueÚalready_hashed© r   úA/tmp/pip-unpacked-wheel-zhp1095k/openpyxl/worksheet/protection.pyÚset_password   s    z_Protected.set_passwordc             C   s   | j S )z.Return the password value, regardless of hash.)r   )r   r   r   r   Úpassword   s    z_Protected.passwordc             C   s   |   |¡ dS )z-Set a password directly, forcing a hash step.N)r   )r   r   r   r   r   r      s    )r
   F)Ú__name__Ú
__module__Ú__qualname__r   r   Úpropertyr   Úsetterr   r   r   r   r	      s   
r	   c                   sÜ   e Zd ZdZdZeƒ ZedƒZeƒ Z	eƒ Z
eƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zeƒ Zedd�Zedd�Zedd�Zedd�ZdZdd	d
„Z d‡ fdd„	Z!dd„ Z"dd„ Z#dd„ Z$‡  Z%S )ÚSheetProtectionzâ
    Information about protection of various aspects of a sheet. True values
    mean that protection for the object or action is active This is the
    **default** when protection is active, ie. users cannot do something
    ZsheetProtectionÚsheetT)Ú
allow_none)ÚselectLockedCellsÚselectUnlockedCellsÚalgorithmNamer   ÚobjectsÚ
insertRowsÚinsertHyperlinksÚ
autoFilterÚ	scenariosÚformatColumnsÚdeleteColumnsÚinsertColumnsÚpivotTablesÚ
deleteRowsÚformatCellsÚ	saltValueÚ
formatRowsÚsortÚ	spinCountr   Ú	hashValueFNc             C   sŠ   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	|| _
|| _|| _|| _|| _|| _|d k	rn|| _|| _|| _|| _|| _d S )N)r   r   r"   r(   r#   r*   r%   r   r    r$   r'   r   r   r+   r!   r&   r   r   r)   r,   r-   )r   r   r   r"   r(   r*   r#   r%   r   r    r$   r'   r   r   r+   r!   r&   r   r   r)   r,   r-   r   r   r   Ú__init__K   s,    zSheetProtection.__init__r
   c                s   t t| ƒ ||¡ |  ¡  d S )N)Úsuperr   r   Úenable)r   r   r   )Ú	__class__r   r   r   i   s    zSheetProtection.set_passwordc             C   s
   d| _ d S )NT)r   )r   r   r   r   r0   n   s    zSheetProtection.enablec             C   s
   d| _ d S )NF)r   )r   r   r   r   Údisabler   s    zSheetProtection.disablec             C   s   | j S )N)r   )r   r   r   r   Ú__bool__v   s    zSheetProtection.__bool__)FFFTTTTTTTTFFTTTNNNNN)r
   F)&r   r   r   Ú__doc__Útagnamer   r   r   Zenabledr   r"   r(   r#   r*   r%   r   r    r$   r'   r   r   r+   r!   r&   r   r)   r   r,   r   r   r-   Ú	__attrs__r.   r   r0   r2   r3   Ú__classcell__r   r   )r1   r   r   $   sD   



     
r   N)Zopenpyxl.descriptorsr   r   r   r   Z!openpyxl.descriptors.serialisabler   Zopenpyxl.descriptors.excelr   Zopenpyxl.utils.protectionr   Úobjectr	   r   r   r   r   r   Ú<module>   s
   