%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/reportlab/graphics/barcode/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/reportlab/graphics/barcode/__pycache__/lto.cpython-312.pyc

�

��d����ddlmZddlmZddlmZddlmZmZ	Gd�de�Z
Gd�de
�Zd	�Ze
d
k(re�yy)�)�
Standard39)�colors)�cm)�ascii_uppercase�digitsc��eZdZdZdezZdezZdezZdZdezZ	dezZ
dezZeZd	ezZ
d	ezZ						d
d�Zd�Zy
)�BaseLTOLabela!
    Base class for LTO labels.

    Specification taken from "IBM LTO Ultrium Cartridge Label Specification, Revision 3"
    available on  May 14th 2008 from :
    http://www-1.ibm.com/support/docview.wss?rs=543&context=STCVQ6R&q1=ssg1*&uid=ssg1S7000429&loc=en_US&cs=utf-8&lang=en+en
    g������@g333333�?g333333�?g@gQk�w��@g�(\���?g��_vO�?�
Nc�n�t||j�|_||_t	|�dk7s|t
tzvrtd|z��|st	|�dkDs|j�std|z��|t|xsd�jdt	|�z
�zdd�d|��}t	|�dk7rtd	|�d
|�d
|�d���||_tj|||j|j|j|j |j"|j$d|�
�
y)a
           Initializes an LTO label.

           prefix : Up to six characters from [A-Z][0-9]. Defaults to "".
           number : Label's number or None. Defaults to None.
           subtype : LTO subtype string , e.g. "1" for LTO1. Defaults to "1".
           border : None, or the width of the label's border. Defaults to None.
           checksum : Boolean indicates if checksum char has to be printed. Defaults to False.
           availheight : Available height on the label, or None for automatic. Defaults to None.
        �zInvalid subtype '%s'�zInvalid prefix '%s'rN�L�zInvalid set of parameters (z, �)T)�ratio�	barHeight�barWidth�gap�lquiet�rquiet�quiet�checksum)�max�
CODEBARHEIGHT�height�border�lenr�
string_digits�
ValueError�isalnum�str�zfill�labelr�__init__�	CODERATIO�CODEBARWIDTH�CODEGAP�
CODELQUIET�
CODERQUIET)�self�prefix�number�subtyperr�availheightr#s        �@/usr/lib/python3/dist-packages/reportlab/graphics/barcode/lto.pyr$zBaseLTOLabel.__init__s�� �+�t�'9�'9�:��������L�A�����>�>��3�g�=�>�>��c�&�k�A�o��.�.�"��2�V�;�<�<�"�S���1�%5�%;�%;�A��F��O�%L�L�b�q�Q�"�$���u�:��?��#)�6�7�<�=�
=���
����D�!�"&�.�.�&*�k�k�%)�%6�%6� $���#'�?�?�#'�?�?�"&�%-�		/�c��|j�|j||�|jrN|j|j�|j	dd|j
|j|j�tj|||j
|jz
dz|j|jz
�|j�y)z$Draws the LTO label onto the canvas.r�@N)
�	saveState�	translater�setLineWidth�	roundRect�
LABELWIDTH�LABELHEIGHT�
LABELROUNDr�drawOn�CODENOMINALWIDTHr�restoreState)r*�canvas�x�ys    r/r:zBaseLTOLabel.drawOnDs�����������A���;�;�������,����Q������(�(����
)�	���$� ��?�?�4�+@�+@�@�#�E��*�*�4�;�;�6�	8�	���r0)�N�1NFN)�__name__�
__module__�__qualname__�__doc__rr7r8r9r%r;rr&r'r(r)r$r:�r0r/r	r		s{����r��J���(�K����J��I���{���2�I�M��B�;�L��G��l�"�J��l�"�J� �"�"�"� %�#'�'/�Rr0r	c�@�eZdZdZdZdezZdezZdZdZ	dZ
d�Zd	�Zy
)�VerticalLTOLabelzT
    A class for LTO labels with rectangular blocks around the tape identifier.
    )zHelvetica-Bold�rg�������?皙�����?�)
�red�yellow�
lightgreen�	lightblue�grey�	orangered�pink�	darkgreen�orange�purplec��d|vr|d|_|d=nd|_|j|jz
|d<tj|g|��i|��y)zp
        Initializes the label.

        colored : boolean to determine if blocks have to be colorized.
        �coloredFr.N)rWr8�BLOCKHEIGHTr	r$)r*�args�kwargss   r/r$zVerticalLTOLabel.__init__hsZ�����!�)�,�D�L��y�!� �D�L� $� 0� 0��1A�1A� A��}�����d�4�T�4�V�4r0c�$�tj||||�|j�|j|j�|jddd�|j
||�|j|j|jzz
dz}t|j�D�]�}|j\}}|j}||jdz
k(r|j|d}	|\}}|dz}||f}n|j|}	|j�|j
|||jzzd�|jrh|	j�rX|jt!t"|j$t'|	�t#j(ddd��j+��n|jddd�|j-dd|j|j.d��|j
|j|j0|	g|���zdz|j.dz�|j3d�|j4|�|jddd�|j7dd|	�|j9����|j9�y)z5Draws some blocks around the identifier's characters.rr2rNT)�fillg�V@)r	r:r3r5�	LINEWIDTH�setStrokeColorRGBr4r7�NBBLOCKS�
BLOCKWIDTH�range�	LABELFONTr#rW�isdigit�setFillColorRGB�getattrr�COLORSCHEME�int�Color�rgb�rectrX�stringWidth�rotate�setFont�drawCentredStringr<)
r*r=r>r?�xblocks�i�font�size�newfont�parts
          r/r:zVerticalLTOLabel.drawOnvs<�����D�"���	�	�������D�N�N�+�� � ��A�q�)�����A���?�?�D�M�M�$�/�/�$A�B�C�G���t�}�}�%�	"�A��>�>�L�T�4��n�n�G��T�]�]�Q�&�'��z�z�!�"�~��&���t�������,���z�z�!�}���������W�a����&7�8�!�<��|�|�����&��&�&���04�0@�0@��T��0K�06���Q��1�0E�)G�GJ�s�u�N��&�&�q�!�Q�/��K�K��1�d�o�o�t�/?�/?�d�K�K����d�o�o�.@�f�.@�.@��.P��.P�P�RU�U�"�.�.�s�2�
5��M�M�$���F�N�N�G�$��"�"�1�a��+��$�$�Q��4�0����!�3	"�4	���r0N)
rBrCrDrErbrr`rXr]r_rfr$r:rFr0r/rHrHTs;���'�I��2��J��r�'�K��I��H�	�K�5�%r0rHc�8�ddlm}ddlm}|d|j��}|jdd�|j\}}|j
|dz|d	tzz
d
�dtzx}}dtzx}}dtz}	d
tz}
d}td|d�j|||�||
z
}|dz
}td|dd��j|||�||
z
}|dz
}td|d�j|||�||
z
}|dz
}td|dd��j|||�||
z
}|dz
}td|dd��j|||�||
z
}|dz
}td|ddd��j|||�|j�|j�y)z
Test this.r)�Canvas)�	pagesizesz
labels.pdf)�pagesize�	Helvetica�r2�zSample LTO labels�r
g333333@i��RL�3rrJ)rT)rW)rrWN)
�reportlab.pdfgen.canvasrv�
reportlab.librw�A4rmrnrr	r:rH�showPage�save)rvrwr=�widthr�xpos�xorig�ypos�yorig�colwidth�
lineheight�counts            r/�testr��s���.�'�
�L�9�<�<�
8�F�
�N�N�;��#��l�l�O�U�F�
���U�3�Y��q��t��5H�I��r�6��D�5��r�6��D�5��B�w�H��r��J��E���u�c�"�)�)�&�$��=��J��D�	�Q�J�E���u�c�� � &��v�t�T� :��J��D�	�Q�J�E��T�5�#�&�-�-�f�d�D�A��J��D�	�Q�J�E��T�5�#�!�#�#)�6�&�$��#=��J��D�	�Q�J�E��T�5�#� �"�"(�&���t�"<��J��D�	�Q�J�E��T�5�#�!�4�1�17����d�1K�
�O�O��
�K�K�Mr0�__main__N)�!reportlab.graphics.barcode.code39rr�r�reportlab.lib.unitsr�stringrrrr	rHr�rBrFr0r/�<module>r�sK��9� �"�;�I�:�I�VG�|�G�R#�J�z���F�r0

Zerion Mini Shell 1.0