%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/hplip/prnt/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/hplip/prnt/__pycache__/cups.cpython-312.pyc

�

=	fe���n�ddlZddlZddlZddlZddlZddlZddlZddl�ddlm	Z	m
Z
mZddlm
Z
dZ	ejd�ZdZe�*ej%d�rej'd�\ZZed	z
Zeej*d<e	j,d
�Ze�eej*d<dZdZdZdZ d
Z!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0d Z1d!Z2d"Z3d#Z4d$Z5d%Z6d&Z7d'Z8d(Z9d)Z:d*Z;d+Z<d,Z=dZ>dZ?dZ@d-ZAd.ZBd/ZCd/ZDdZEd
ZFdZGdZHdZIdZJd-ZKd.ZLd0ZMd1ZNd2ZOd3ZPd4ZQd5ZRd6ZSd7ZTd8ZUd9ZVd:ZWd;ZXd<ZYd=ZZd>Z[d?Z\d@Z]dAZ^dBZ_dCZ`dDZadEZbdFZcdGZddHZedIZfdJZgdKZhdLZidMZjdNZkdOZldPZmdQZndRZodSZpdTZqdUZrej�dVej��Zuej�dWej��Zwej�dXej��Zxej�dYej��ZydZ�Zzd[�Z{d\�Z|d�d]�Z}d�d^�Z~d_�Zd`�Z�da�Z�db�Z�ej�dce�j�Z�gdd�Z�e�e
�j�j��D]Z�dee�zZ�e�e�vs�
e��je��� e�ddZ�e��jgdf��dg�Z�dh�Z�di�Z�dj�Z�dk�Z�dl�Z�d�dm�Z�dn�Z�do�Z�dp�Z�dq�Z�dr�Z�ds�Z�dt�Z�du�Z�dv�Z�dw�Z�dx�Z�dy�Z�dz�Z�d{�Z�d�d|�Z�d�d}�Z�d~�Z�d�Z�d��Z�d�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�y#e$r8ejd�s"ej5d�ej9d
�Y���wxYw)��N)�*)�utils�models�os_utils)�PY3z!~`!@#$%^&*()=+[]{}()\/,.<>?'";:| �LANG�C�.z.UTF-8�cupsext�HPLIP_BUILDz=CUPSEXT could not be loaded. Please check HPLIP installation.������d�e�f�g�h�i�j�k�l�m���i@i@i@i@i@i@i@i@i	@i
@i@i@i
@i@���iiiiiiiiiii	i
iii
iiiiiiiiiiiiiiiiiiii	i
iiz\*NickName:\s*\"(.*)"z/^loglevel\s?(debug|debug2|warn|info|error|none)z.*hp-(.*?)(-.*)*\.ppd.*z.*hp-(.*?)(_.*)*\.ppd.*c���t�}tj�}|jd�}g}|D]}||vs�||d}�tjD]
}||vs�|cSy)NFzfamily-class)�
getPPDPathr�	ModelData�read_all_files�FAMILY_CLASSES)�model�
models_dir�m�dict�family_type�fs      �/usr/share/hplip/prnt/cups.py�getFamilyClassNamer.�st����J�����A�	
�	�	�%�	 �D��K�
�/���A�:��A�w�~�.�+�/��
"�
"�������8��c�\�tj�}|jd�}|D]�}||vr{td||�d}|||j	�vr||ddz}�9|jd�r|dz}�P|jd�r|j
dd�}|dz}�yd|zdz}����S)	zq
    get ppds from models.dat for postscript printers
    for pclm printers forming ppd name from model name
    Fzdict[m]�ppd-name�.gz�apolloz.ppd.gz�hp_�hp-)rr$r%�print�keys�
startswith�replace)r'r)r*�key�ppd_name�model1s      r-�
getPpdNamer=�s���	����A�	
�	�	�%�	 �D�
����A�:�
�	�$�q�'�
"��#�
�D��G�L�L�N�
"��A�w�z�*�U�2�X�� � ��*��	�/���"�"�5�)����u�U�3�� ��*����+�i�/���)�*�Or/c��d}d}t|d�}|D]4}d|vs�|jd�}||dzt|�dz
}|dk(s�3d}�6|S)Nr�/etc/hp/hplip.conf�rzclass-driver�=r
�yes��open�find�len)�ppds�family_check�filename_config�	file_conf�line�count�family_check_strs       r-�isfamilydrvrN�sl���L�
+�O��_�S�)�I��!���T�!��I�I�c�N�E�#�E�!�G�C��I�a�K�8���5�(� ��!��r/c���|�g}tjjd�|z}|D]E}tjj|d�}tjj
|�s�C|cSy)z�
        Returns the CUPS ppd path (not the foomatic one under /usr/share/ppd).
        Usually this is /usr/share/cups/model.
    N�;z
cups/model)�prop�ppd_search_path�split�os�path�join�exists)�addtional_paths�search_pathsrU�ppd_paths    r-r#r#�sb��
�����'�'�-�-�c�2�_�D�L�����7�7�<�<��l�3��
�7�7�>�>�(�#��O�r/c��d}t|d�}|D],}d|vs�|jd�}||dzt|�dz
}�.S)z*
        return path for hplip ppds. 
    r?r@zppd=rAr
rC)rXrIrJrKrLrZs      r-�getPPDPath1r\�sW��
+�O��_�S�)�I��1���T�>��I�I�c�N�E��E�!�G�C��I�a�K�0�H�	1��Or/c��g}g}g}tjjd�r|jd�tjjd�r|jd�|D]&}|j	tj
|���(|D]b}t
|d�}|D]O}|jd�r�t|�dkDs�$	|j�\}}}	}
|dvs�?|j|��Q�d|jd	�|jd
�|jd�|jd�|S#t$rY��wxYw)
zk
        Scan all /etc/cups/*.convs and /usr/share/cups/mime
        files for allowable file formats.
    z	/etc/cupsz/etc/cups/*.convsz/usr/share/cups/mimez/usr/share/cups/mime/*.convsr@�#r
)zapplication/octet-streamzapplication/vnd.cups-postscriptzimage/x-bmpztext/cppzapplication/x-pythonzapplication/hplip-fax)rTrUrW�append�extend�globrDr8rFrS�
ValueError)�paths�allowable_mime_types�filesrUr,�	conv_filerK�source�dest�cost�progs           r-�getAllowableMIMETypesrks9��

�E����E�	�w�w�~�~�k�"�
���(�)�	�w�w�~�~�,�-�
���3�4��&��
���T�Y�Y�t�_�%�&�
�8����C�L�	��	8�D��?�?�3�'�C��I��M��04�
�
��,�F�D�$���!`�`�(�/�/��7�	8�	8����
�.����
�+���� 6�7���� 7�8����"����s�
D?�?	E�
Ec�6�|jd�r&tj|d�jd�}nt	|d�jd�}	t
j
|jd��jd�}|S#t$rd}Y|SwxYw)Nr2r@i�utf-8r
�)
�endswith�gzip�GzipFile�readrD�nickname_pat�search�decode�group�AttributeError)r,�nickname�descs   r-�getPPDDescriptionrz0s����z�z�%���=�=��C�(�-�-�d�3����3�<�$�$�T�*����"�"�8�?�?�7�#;�<�B�B�1�E���K�������K��s�3B	�	B�Bc��t�\}}}i}|dk(r�|dkr�tjdd�}tj	d|z�tj|dd��D]I}t|�}d	|vr�d
|j�vr�&d
|vr�+|||<tj	|�d|����K|Stj	d�tj�}t�}tjdd
d�}	|	rtjj|	�sd}	tj	d|z�tj	d|	z�|D�]}
|
s�d|
j�vsd|
j�vs�,||
ddk(s�8||
d}d	|j�vr�Sd
|j�vr�fd
|
vr�ktjj|
�r|
}n�	tjj|	|
�}tjj|�sC	tjj||
�}tjj|�s|
}	|||<��|S#t $r|
}Y�wxYw#t $r|
}Y�(wxYw)Nr
r�dirs�ppdz&(CUPS 1.1.x) Searching for PPDs in: %szHP*ppd*;hp*ppd*T��pattern�	abs_paths�foo2�
gutenprintz: z8(CUPS 1.2.x) Getting list of PPDs using CUPS_GET_PPDS...�ppdbasez/usr/share/ppdzCUPS PPD base path = %szFoomatic PPD base path = %sr5r4zppd-make�HPzppd-make-and-model)�getVersionTuple�sys_conf�get�log�debugr�	walkFilesrz�lowerr�
getPPDListr#rTrUrWrVrw)�major�minor�patchrG�ppd_dirr,ry�ppd_dict�
cups_ppd_path�foomatic_ppd_pathr}rUs            r-�
getSystemPPDsr�>sF��)�+��E�5�%�
�D���z�e�a�i��,�,�v�u�-���	�	�:�W�D�E�����2C�t�T�	0�A�$�Q�'�D��d�N� �D�J�J�L�0� �A�%���Q���	�	�a��.�/�	0�x�K�c	�	�	�L�M��%�%�'��"��
�$�L�L���<L�M�� ������7H�(I� 0���	�	�+�m�;�<��	�	�/�2C�C�D��#	&�C�����	�	��#�u��	�	��';���
�j�)�T�1���}�%9�:���$�*�*�,�.�$��
�
��4�$��+��w�w�~�~�c�*�"��3�#%�7�7�<�<�0A�3�#G�D�$&�7�7�>�>�$�#7�!3�+-�7�7�<�<�
�s�+K�D�,.�7�7�>�>�$�+?�/2��!%�D��J�G#	&�L�K��(6�!/�+.�D�!/��
 .�'�#&�D�'�s$� I9� I(�(I6�5I6�9J�Jc�j�t|�t|�}}||kDr||}}||}}tt|dz��}td|dz�D]c}||gdg|zz}}td|dz�D]C}||dz||dz
dz}	}||dz
}
||dz
||dz
k7r|
dz}
t||	|
�||<�E�e||S)za
    Calculates the Levenshtein distance between a and b.
    Written by Magnus Lie Hetland.
    r
r)rF�list�range�min)�a�b�nr)�current�i�previous�j�add�delete�changes           r-�levenshtein_distancer��s���
�q�6�3�q�6�q�A��1�u���!����!���5��1��:��G�
�1�Q�q�S�\�
2��#�a�S�!��Q��Y�'���q��1���	2�A�"�1�+�a�-���1���a���C��a��c�]�F���1��v��1�Q�3����!����S�&�&�1�G�A�J�	2�
2��1�:�r/z.*?(\d+))z	foomatic:r5r4zhp r2z.ppdzdrv:z-pclz-pcl3z	-jetreadyz-zxsz-zjsz-psz-postscriptz-pdfz-jrz-lidlz-lidilz-ldlz-hpijsz-%s)z-seriesz series�_seriesc�`�|j�}tD]}|j|d�}�|S�Nrn)r��STRIP_STRINGS2r9�r'�xs  r-�stripModel2r��s3���K�K�M�E�
�%���
�
�a��$��%��Lr/c�`�|j�}tD]}|j|d�}�|Sr�)r��
STRIP_STRINGSr9r�s  r-�
stripModelr��s3���K�K�M�E�
�%���
�
�a��$��%��Lr/c�x�tjd�i}i}tj}tjd|z�|D]m}t	t
jj|��}t||�||<||dkrtjd|||fz�t|||�}�otjd|z�|D][}|||k(s�|D]C}t
jj|�t
jj|�k(s�C�S||||<�]tj|�t|�dkD�r�tjd�	tj|�jd�}t|�}tjd|z�i}	td	�D�]D}
d
|
z}tjd|z�t||z�|z}d\}
}|D]�}	tjt
jj|��jd�}t|�}tjd
|z�t||z�|z}tjd|z�tjd|z�||k(r7tjd�|
dz
}
|||	|<tj|	�tjd���t|	�s��B|	}|S|S|S#t $rY��t"$rY��*wxYw#t $rY|St"$rY|SwxYw)zM
        Match up a model name to a PPD from a list of system PPD files.
    z1st stage edit distance matchzFDetermining edit distance from %s (only showing edit distances < 4)...rzdist('%s') = %dzMin. dist = %dr
z$2nd stage matching with model numberzmodel_number=%dr�
zFactor = %d)rrnzmins_model_number= %dzmins_adj_model_number=%dzadj_model_number=%d�matchz***)r�r��sys�maxsizer�rTrU�basenamer�r�rF�
number_patr�rv�intr�rwrb)�stripped_modelrG�mins�eds�min_edit_distancer,�tr)�model_number�matchesr��factor�adj_model_number�number_matchingr��mins_model_number�mins_adj_model_numbers                 r-�
getPPDFiler��s(���I�I�-�.�
�D�
�C������I�I�V�Yg�g�h�
�;���r�w�w�'�'��*�+��%�n�a�8��A���q�6�A�:��I�I�'�1�c�!�f�+�5�6�� 1�3�q�6�:��;��I�I��!2�2�3�
�"���q�6�&�&��
"���7�7�#�#�A�&�"�'�'�*:�*:�1�*=�=��
"��q�'��Q��
"��I�I�d�O�
�4�y�1�}��	�	�8�9�(	�%�+�+�N�;�A�A�!�D�L��|�,�L�
�I�I�'�,�6�7��G��1�X�
���Q����	�	�-�&�0�1�#&�|�F�':�#;�F�#B� �).�&����%�A�!�,6�,<�,<�R�W�W�=M�=M�a�=P�,Q�,W�,W�XY�,Z�)�,/�0A�,B�)��	�	�"9�<M�"M�N�-0�0A�&�0H�,I�&�,P�)��I�I�8�;P�P�Q��I�I�3�6F�F�G�,�0@�@��	�	�'�*�'�1�,��%)�!�W���
��	�	�'�*��I�I�e�$�)%�,�w�<�"�D���K�A
�@�K�4�K��+*�!� �%�!� �!��)�	��L�K�K�	��H�K�K	�s1�&/L!�7A$L�	L�L�L�!	L9�-L9�8L9c	�
�t|�}t|�}tj|�}|dk(r|j	dd�}n|j	dd�}|dk(rt|�}nt|�}tjd|z�g}|dk(r�|D]�}tj|�}	|	��|	jd�|k(s�0tjd|z�	|	jd�jd�}
tjrd	|vs1tjrd	|
vstjrd	|
vs	d
|
vsd|
vs��|j!||
D�cgc]
}|s�|d	k7s�|��c}f���n�|D]�}t"j|�}	|	��|	jd�|k(s�0tjd|z�	|	jd�jd�}
tjrd	|vs1tjrd	|
vstjrd	|
vs	d
|
vsd|
vs��|j!||
D�cgc]
}|s�|d	k7s�|��c}f���tj|�t%|�}|dk(�rPtjd|z�t't)t+|�|�j-��}
tj|
�t%|
�}|r�|
D]�\}}tj|�}	|	��tjd|z�	|	jd�jd�}
tjrd	|vs1tjrd	|
vstjrd	|
vs	d
|
vsd|
vs��|j!||
D�cgc]
}|s�|d	k7s�|��c}f���tj|�t%|�}|dk(r"tj/d
t+|�z�y|dk(rtjd�|dddfStjd|z�tj0tj2tj4tj6fD]i}|D]b\}}|D]X}tj8j	|tj0�|k(s�5tjd|�d|���|dfcccS�d�ktjd|z�dD]0}|D])\}}||vs�tjd|z�|dfccS�2tjd�|dddfS#t$rg}
Y��KwxYwcc}w#t$rg}
Y���wxYwcc}w#t$rg}
Y��FwxYwcc}w)Nrr1z
family-ppdz!Matching PPD list to model  %s...r
zFound match: %sr�-�hpijs�ps�pdfzFNo PPD found for model %s using new algorithm. Trying old algorithm...z.No PPD found for model %s using old algorithm.zOne match found.rnzC%d matches found. Searching based on PDL: Host > PS,PDF > PCL/OtherzSelecting '-z' PPD: z<%d matches found. Searching based on Filters: HPCUPS > HPIJS)�hpcupsr�zSelecting PPD: %sz<No specific PDL located. Defaulting to first found PPD file.)rNr.r�normalizeModelNamer�r�r�r��ppd_patr�rvrSrwrQ�hpcups_build�hpijs_buildr_�ppd_pat1rFr�r�r��items�error�
PDL_TYPE_HOST�PDL_TYPE_PS�PDL_TYPE_PDF�PDL_TYPE_PCL�	PDL_TYPES)�mqr'rGrH�family_classr;r�r�r,r��pdls�p�num_matches�matches2�num_matches2�d�pdl_listr�s                  r-�getPPDFile2r�s
���T�"�L�#�E�*�L��%�%�e�,�E��Q���&�&��A�&�x��&�&��a�(�x��1�}�$�U�+��$�X�.���I�I�1�N�B�C��G��a���	W�A��M�M�!�$�E�� ��;�;�q�>�^�3��I�I�/�!�3�4�#�#�k�k�!�n�2�2�3�7�t��)�)�g�Q�.>��*�*�w�$��D�DU�DU�Za�im�Zm��$�,�E�T�M�!�.�.�!��-T�A��q�G�|�a�-T�)U�V�	W��	W�A��N�N�1�%�E�� ��;�;�q�>�\�1��I�I�/�!�3�4�#�#�k�k�!�n�2�2�3�7�t��)�)�g�Q�.>��*�*�w�$��D�DU�DU�Za�im�Zm��$�,�E�T�M�!�.�.�!��-T�A��q�G�|�a�-T�)U�V�	W��I�I�g���g�,�K��a���	�	�Z�]k�k�l��
�:�n�#=�t�D�J�J�L�M���	�	�(���8�}��� �
U���1��
�
�a�(���$��I�I�/�!�3�4�"�$�{�{�1�~�3�3�C�8���)�)�g�Q�.>��)�)�g��o�4�CT�CT�Y`�hl�Yl����%�4�-�����t�+R�!�q�Q�'�\�A�+R�'S�T�
U�	�	�	�'���'�l���a���	�	�B�Z�P^�E_�_�`��	��	��	�	�$�%���
�1�
�r�"�"��I�I�S�Va�a�b��"�"�F�$6�$6�v�7J�7J�F�L_�L_�
`�#��"�	#�K�A�x��
#���#�#�'�'��6�+?�+?�@�A�E��I�I�1�a�@�A��r�7�N�	
#�	#�#��I�I�L�{�Z�[�
���"�	�K�A�x��A�v��	�	�-��3�4��2�w��	���I�I�L�M��A�J�q�M�2����U*�#� "��#��
.U��*�#� "��#��
.U��"*�"�!��"��,Ssl� T9�U�U�U�9 U�.U"�6U"�<U"� U'�U9�U9�U9�9U�U�U�U�'U6�5U6c���	d}d}d}tjd|tjfz�tjr\|j	dt
�}|tk(rd}d}n�|tk(s	|tk(rd}d}n�|tk(rd	}d
}n�|tk(rd}d}n�d}d}n�|j	dt
�tk(rd
}d}|j	dt
�tk(s|j	dt
�tk(rd}d}|j	dt
�tk(rd}d}nd}d}g}tjtj	dd�dd��D]}|j|��tjd|z�|D]A}|j|�dk\s�t!|�|k(s�'|}tjd|z�ntj#d|z�|||fS#fccYSxYw)Nz
HP Fax hpcupsz
HP-Fax-hpcupsz4Searching for fax PPD for model %s  hpcups_build =%dzfax-typezHP-Fax3-hpcupszHP Fax3 hpcupszHP-Fax2-hpcupszHP Fax2 hpcupszHP-Fax4-hpcupszHP Fax4 hpcupszHP-Fax-CDM-hpcupszHP Fax CDM hpcupsz
HP-Fax3-hpijsz
HP Fax3 hpijsz
HP-Fax2-hpijsz
HP Fax2 hpijsz
HP-Fax4-hpijsz
HP Fax4 hpijszHP-Fax-hpijszHP Fax hpijsr|r}zHP-Fax*.ppd*Tr~zppds=%srzFound fax PPD: %sz8Unable to locate the HPLIP Fax PPD file: %s.ppd.gz file.)r�r�rQr�r��
FAX_TYPE_NONE�FAX_TYPE_MARVELL�
FAX_TYPE_SOAP�FAX_TYPE_LEDMSOAP�
FAX_TYPE_LEDM�FAX_TYPE_CDMrr�r�r_rErzr�)r�r'�fax_ppd�nick�expected_fax_ppd_name�faxTyperGr,s        r-�
getFaxPPDFiler��s���23����� /���	�	�H�E�RV�Rc�Rc�Kd�d�e�����f�f�Z��7�G��*�*�(8�%�'���M�)�W�8I�-I�(8�%�'���M�)�(8�%�'���L�(�(;�%�*��(7�%�&���v�v�j�-�0�4D�D�(7�%�&���v�v�j�-�0�M�A�R�V�V�J�Xe�Ef�j{�E{�(7�%�&���v�v�j�-�0�M�A�(7�%�&��(6�%�%����������f�e�!<�n�`d�e�	�A��K�K��N�	��	�	�)�D�.�!��	h�A��v�v�+�,��1�6G��6J�d�6R����	�	�-��1�2��		h�
�I�I�P�Qf�f�g��,�d�2�2��w�,�d�2�2�s�FG �G �&5G � G*c��d}	t|d�}|D]T}tj|�}|��|jd�j	�}t
j
d|z�|cS	t
j
d�y#t$rt
jd|z�Y�9t$rt
jd|z�Y�[wxYw)	Nz/etc/cups/cupsd.confr@r
zCUPS error_log LogLevel: %sz
%s not found.z%s: I/O error.z CUPS error_log LogLevel: unknown�unknown)
rD�pat_cups_error_logr�rvr�r�r��OSErrorr��IOError)�	cups_confr,�lr)�levels     r-�getErrorLogLevelr��s���&�I����C� ���	�A�"�(�(��+�A��}�����
�(�(�*���	�	�7�%�?�@���	��I�I�0�1����/��	�	�/�I�-�.��0��	�	�"�Y�.�/�0�s�B�!C�# C�Cc�h�g}d|z}d}		t|d�}|t|d�j�vr�tj�}d}	|j	�}	||	vrfd}t|�r+|j
|j��t|�r�+|j
|	j��t|�|kDr1n1|r.|j|	j��t|�|kDrn��dj|�S#ttf$rtjd|z�YywxYw)	Nz[Job %d]z/var/log/cups/error_logr@FT�
z*Could not open the CUPS error_log file: %srn)rDrrr�Queue�readlinerFr_r��strip�putrVr�r�r�r�)
�job_id�	max_lines�
cont_interval�ret�sr�r,�queue�	job_foundrKs
          r-�getPrintJobErrorLogr�s��
�C��V��A�)�I�	� 	"��Y��$�A��D��C�(�-�-�/�/����
��!�	���:�:�<�D��D�y�$(�	�!�%�j��J�J�u�y�y�{�3�"�%�j��
�
�4�:�:�<�0��s�8�i�/�!�%�!�I�I�d�j�j�l�3�"�5�z�M�9� %�'�*�9�9�S�>�!��=��!�	��I�I�B�Y�N�O��	�s�D�'D1�0D1c�\�tj�}|�tjd�|S)Nz$The CUPS default printer is not set.)r�getDefaultPrinterr�r�)r@s r-rrs'���!�!�#�A��y��	�	�8�9��Hr/c�f�trt|d�}td�tj	|�S)NrmzOYou do not have permission to set the default printer. You need authentication.)r�str�setPasswordPromptr�setDefaultPrinter��printer_names r-rr	s+��
��,��0�|��g�h��$�$�\�2�2r/c�8�td�t|t�S)NzVYou do not have permission to accept jobs on a printer queue. You need authentication.)r�controlPrinter�CUPS_ACCEPT_JOBSrs r-�acceptr
����n�o��,�(8�9�9r/c�8�td�t|t�S)NzVYou do not have permission to reject jobs on a printer queue. You need authentication.)rr�CUPS_REJECT_JOBSrs r-�rejectrrr/c�8�td�t|t�S)NzMYou do not have permission to start a printer queue. You need authentication.)rr�IPP_RESUME_PRINTERrs r-�startrs���e�f��,�(:�;�;r/c�8�td�t|t�S)NzLYou do not have permission to stop a printer queue. You need authentication.)rr�IPP_PAUSE_PRINTERrs r-�stoprs���d�e��,�(9�:�:r/c�8�td�t|t�S)NzBYou do not have permission to purge jobs. You need authentication.)rr�IPP_PURGE_JOBSrs r-�purgers���Z�[��,��7�7r/c�j�|tttttfvrt
j
||�Sy)Nr)rrrrrrr)r	�cups_ops  r-rr#s0���#�%5�7H�J\�^l�m�m��%�%�l�G�<�<�r/c�2�|sytj|�S�N)r�openPPD��printers r-rr)s�����?�?�7�#�#r/c�*�tj�Sr)r�closePPD�r/r-r#r#/s������r/c�2�|sytj|�Sr)r�getPPDr s r-r&r&2s�����>�>�'�"�"r/c�,�tj|�Sr)r�getPPDOption��options r-r(r(8�������'�'r/c�*�tj�Sr)r�getPPDPageSizer$r/r-r-r-;s���!�!�#�#r/c�*�tj�Sr)r�getPrintersr$r/r-r/r/>s����� � r/c�.�tj||�Sr�r�getJobs)�my_job�	completeds  r-r2r2Ms���?�?�6�9�-�-r/c�\�tj|d�tj|d�zS)Nrr
r1)r3s r-�
getAllJobsr6Ps#���?�?�6�1�%������(B�B�Br/c�*�tj�Sr)r�
getVersionr$r/r-r8r8S�������r/c�*�tj�Sr)rr�r$r/r-r�r�Vs���"�"�$�$r/c�*�tj�Sr)r�	getServerr$r/r-r<r<Ys������r/c���td�|�tj||�Stjdd�}|D]3}|j|k(s�tj|j
|�cSy)NzDYou do not have permission to cancel a job. You need authentication.rF)rr�	cancelJobr2�idrh)�jobidrh�jobsr�s    r-r>r>\sj���\�]���� � ��u�-�-����q�!�$���	8�A��t�t�u�}��(�(�����7�7�	8�r/c�*�tj�Sr)r�resetOptionsr$r/r-rCrCh������!�!r/c�,�tj|�Sr)r�	addOptionr)s r-rFrFks�����V�$�$r/c�*�tj�Sr)r�
getOptionsr$r/r-rHrHnr9r/c�,�tj|�Sr)r�duplicateSection)�sections r-rJrJqs���#�#�G�,�,r/c���tjj|�rPts3|j	d�}|j	d�}|j	d�}t
j
|||�Sy)Nrm���)rTrUrWr�encoder�printFileWithOptions)r!�filename�titles   r-�	printFilerRtsY��	�w�w�~�~�h����n�n�W�-�G����w�/�H��L�L��)�E��+�+�G�X�u�E�E�r/c��td�tjd|�d|�d|�d|�d|�d|�d�
�|r8tjj|�stj
d|z�ytj||||||�S)NzEYou do not have permission to add a printer. You need authentication.zaddPrinter('z', 'z')zPPD file '%s' not found.)rMzPPD file not found)	rr�r�rTrUrWr�r�
addPrinter)r	�
device_uri�location�ppd_filer'�infos      r-rTrT�sp���]�^��I�I�
�
�H�h��t�E�F�������x�0��	�	�,�x�7�8�)����l�J��(�E�SW�X�Xr/c�B�td�tj|�S)NzHYou do not have permission to delete a printer. You need authentication.)rr�
delPrinterrs r-rZrZ�s���`�a����l�+�+r/c�|�td�tjdd�}|�d|��}tj|�S)NzHYou do not have permission to enable a printer. You need authentication.�
cupsenableT� )rr�whichr�execute)r	�
cmd_full_path�cmds   r-�
enablePrinterrb�s6���`�a��K�K��d�3�M�!�<�	0�C����C� � r/c�*�tj�Sr)r�getGroupListr$r/r-rdrd�rDr/c�,�tj|�Sr)r�getGroup�rvs r-rfrf�s�����E�"�"r/c�,�tj|�Sr)r�
getOptionListrgs r-riri�s��� � ��'�'r/c�.�tj||�Sr)r�	getOption�rvr*s  r-rkrk�s�����U�F�+�+r/c�.�tj||�Sr)r�
getChoiceListrls  r-rnrn�s��� � ���/�/r/c�0�tj|||�Sr)r�	getChoice)rvr*�choices   r-rprp�s�����U�F�F�3�3r/c�*�tj�Sr)r�
setOptionsr$r/r-rsrs�r9r/c�,�tj|�Sr)r�removeOptionr)s r-ruru�r+r/c�,�tj|�Sr)r�setPasswordCallback)�funcs r-rwrw�s���&�&�t�,�,r/c�,�tj|�Sr)rr)�prompts r-rr�s���$�$�V�,�,r/c�.�tj||�Sr)r�findPPDAttribute)�name�specs  r-r|r|�s���#�#�D�$�/�/r/c�*�tj�Sr)r�releaseCupsInstancer$r/r-r�r��s���&�&�(�(r/c��d}|dkr~|dz
}||�\}}|tk7r	||fSt�|dkrN|tk(rtj	d�n/|dk(r|jd�nddlm}|j|d�|dkr�~fS)Nrrr
zSCould not connect to CUPS Server due to insufficient privileges.Try with valid user�qt3z]<b>Could not connect to CUPS Server due to insufficient privileges.</b><p>Try with valid user)�ui_utils)�
IPP_FORBIDDENr��INTERACTIVE_MODEr�r��	FailureUI�ui4r�)	�operation_func�mode�
ui_toolkit�ui_obj�cups_op_args�cnt�result�
status_strr�s	         r-�cups_operationr��s���
�C�

��'��q���+�\�:���
��]�"���:���
 �!��Q�w��+�+��I�I�s�t��5�(��$�$�&E�F�,��&�&�v�0O�P���'� �:��r/r)i�r)rr)r)�rT�os.pathrp�re�time�tempfilera�base.g�baserrr�base.sixextr�INVALID_PRINTER_NAME_CHARS�getenv�current_language�newlangrLrS�encoding�environ�
import_extr�ImportErrorr��warnr��exit�IPP_PRINTER_STATE_IDLE�IPP_PRINTER_STATE_PROCESSING�IPP_PRINTER_STATE_STOPPED�PPD_UI_BOOLEAN�PPD_UI_PICKONE�PPD_UI_PICKMANY�
UI_SPINNER�UI_UNITS_SPINNER�UI_BANNER_JOB_SHEETS�
UI_PAGE_RANGE�UI_JOB_STORAGE_MODE�UI_JOB_STORAGE_PIN�UI_JOB_STORAGE_USERNAME�UI_JOB_STORAGE_ID�UI_JOB_STORAGE_ID_EXISTS�UI_INFOrrr�CUPS_GET_DEFAULT�CUPS_GET_PRINTERS�CUPS_ADD_MODIFY_PRINTER�CUPS_DELETE_PRINTER�CUPS_GET_CLASSES�CUPS_ADD_MODIFY_CLASS�CUPS_DELETE_CLASSrr�CUPS_SET_DEFAULT�CUPS_GET_DEVICES�
CUPS_GET_PPDS�
CUPS_MOVE_JOB�CUPS_AUTHENTICATE_JOB�IPP_JOB_PENDING�IPP_JOB_HELD�IPP_JOB_PROCESSING�IPP_JOB_STOPPED�IPP_JOB_CANCELLED�IPP_JOB_ABORTED�IPP_JOB_COMPLETED�IPP_OK�IPP_OK_SUBST�IPP_OK_CONFLICT�IPP_OK_IGNORED_SUBSCRIPTIONS�IPP_OK_IGNORED_NOTIFICATIONS�IPP_OK_TOO_MANY_EVENTS�IPP_OK_BUT_CANCEL_SUBSCRIPTION�IPP_OK_EVENTS_COMPLETE�IPP_REDIRECTION_OTHER_SITE�IPP_BAD_REQUESTr��IPP_NOT_AUTHENTICATED�IPP_NOT_AUTHORIZED�IPP_NOT_POSSIBLE�IPP_TIMEOUT�
IPP_NOT_FOUND�IPP_GONE�IPP_REQUEST_ENTITY�IPP_REQUEST_VALUE�IPP_DOCUMENT_FORMAT�IPP_ATTRIBUTES�IPP_URI_SCHEME�IPP_CHARSET�IPP_CONFLICT�IPP_COMPRESSION_NOT_SUPPORTED�IPP_COMPRESSION_ERROR�IPP_DOCUMENT_FORMAT_ERROR�IPP_DOCUMENT_ACCESS_ERROR�IPP_ATTRIBUTES_NOT_SETTABLE�IPP_IGNORED_ALL_SUBSCRIPTIONS�IPP_TOO_MANY_SUBSCRIPTIONS�IPP_IGNORED_ALL_NOTIFICATIONS� IPP_PRINT_SUPPORT_FILE_NOT_FOUND�IPP_INTERNAL_ERROR�IPP_OPERATION_NOT_SUPPORTED�IPP_SERVICE_UNAVAILABLE�IPP_VERSION_NOT_SUPPORTED�IPP_DEVICE_ERROR�IPP_TEMPORARY_ERROR�IPP_NOT_ACCEPTING�IPP_PRINTER_BUSY�IPP_ERROR_JOB_CANCELLED�IPP_MULTIPLE_JOBS_NOT_SUPPORTED�IPP_PRINTER_IS_DEACTIVATED�CUPS_ERROR_BAD_NAME�CUPS_ERROR_BAD_PARAMETERS�compile�	MULTILINErs�Ir�r�r�r.r=rNr#r\rkrzr�r��
IGNORECASEr�r�r��TECH_CLASS_PDLS�valuesr��ppr_r�r`r�r�r�r�r�r�rrrr
rrrrrrr#r&r(r-r/r2r6r8r�r<r>rCrFrHrJrRrTrZrbrdrfrirkrnrprsrurwrr|r�r�r$r/r-�<module>r�s���.
���	�����(�(��F��� �r�y�y��(���G��#�(8�(>�(>�s�(C�,�2�2�3�7�����8��� �B�J�J�v���e���y�)�G��#�-��
�
�6���� �����������
������
�����������

������������ �������������������
��
�����������������
������$��$����!&����"�����
����������
����������������� &����"��"��$�� &��#�� &��#)� ���$�� ��"���������� ��"(��#����"���r�z�z�6����E���R�Z�Z� V�XZ�X\�X\�]��
�"�*�*�3�R�T�T�
:���2�:�:�4�b�d�d�;����B� 
�� " �J�D�P�4�R�Z�Z�����
7�
�=��
�f�$�$�+�+�-�	.�"�A�	���B�	������b�!�"��q�!�
�
���6�7���J�Zk�n33�p�(("�^
�3�:�:�<�;�8��$��#�(�$�
!�.�C� �%��
�"�%� �-�
�	Y�,�!�"�#�(�,�0�4� �(�-�-�0�)���y���2�9�9�]�#����P�Q��������s�A2K7�79L4�3L4

Zerion Mini Shell 1.0