%PDF- %PDF-
Mini Shell

Mini Shell

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

�

=	f|A���ddlZddlZddlZddl�ddlmZmZmZmZm	Z	ddl
mZddlm
Z
ddlmZ	ddlmZdZd
ZdZdZej6d
ej8�Zej6dej<�Zej6d�Z ej6dejB�Z"ej6dejB�Z#ej6dejB�Z$ej6dejB�Z%iZ&da'Gd�d�Z(d�Z)d�Z*dd�Z+d�Z,de-e.ddfd�Z/y#e$r"Zej+e�dd	lmZYdZ[��dZ[wwxYw)�N�)�*)�utils�tui�password�os_utils�
smart_install)�cups)�core_install)�to_string_utf8)�
import_module)�dyn_import_mod���zv(.*):/(.*?)/(\S*?)\?(?:serial=(\S*)|device=(\S*)|ip=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}[^&]*)|zc=(\S+))(?:&port=(\d))?z\*NickName:\s*\"(.*)"z$(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})zzc=(.*)z(.*)://(.*)zserial=(.*)z(\S*)(\s)?: (.*)Fc��eZdZdd�Zy)�DetectedDevicec�X�||_||_||_||_||_||_y)N)�PrinterName�	DeviceURI�
DeviceType�PPDFileType�PPDFileError�	IsEnabled)�self�Printer_Name�
Device_URI�Device_Type�ppdTyperrs       �/usr/share/hplip/base/queues.py�__init__zDetectedDevice.__init__?s/��&���#���%���"���(���"���N)FT)�__name__�
__module__�__qualname__r!�r"r rr>s��#r"rc��|dk7r>t||||||�}|tvrt|j|�y|g}|t|<ytj	d|z�y)Nz%s is not HP Device.)r�mapofDevices�append�log�warn)	�Key�printer_name�
device_uri�back_end�ppd_fileTyper�Is_Print_Q_Enabled�device1�
deviceLists	         r �addToDeviceListr4Ms^���t����j��<�P\�^p�q���,�����$�$�W�-��y�J�(�L������'�,�7�8r"c��ttjddd��}ttjddd��}tjd�\}}d}g}|jd�dk7s|jd	�dk7rtjd
�n`|j�D]M}	tj|�}|jd�}	|jd�}
|j|	|
f��Otj|�tjd
||fz�|�r8|D�]2}|\}	}
|
jd�r�|
jd�r�-tjtj!|	��tjtj!dt#|	�z��	t%|
�\	}}}
}}}}}}tjd|
z�t(j*j-d|	dz�}d}d}t(j*j/|�s.tj1d|z�t3t4|	|
|||d�ntjd|z�	t7|d�j9�}	t;t<j|j?d��jd��}tjd|z�d |	z}tj|�\}}tjd!|jKd"d�z�tLj|
�r&tLj|
�jd�}�n
tNj|
�r%tNj|
�jd�}n�tPj|
�r%tPj|
�jd�}n�tRj|
�rjtRj|
�jd�}tRj|
�jd�}d|vr|}n5tjd#|
z�d}ntjd#|
z�d}|���Dd}|jd$�dk7rd}|d%z|z}tjd&||||
|||||||fz�d}|d'k(rd(|vrtjCd)|	z�d}n@|d*k(rd(|vrtjCd+|	z�d}n|d,vrtjCd-|	z�d}d.|vrtT}|s'd}n$d/|vrtV}|sd}nd0|vrtX}n
|rt4}d}t3||	|
||||���5tjd�tH|fS#t$rY���wxYw#t&$rd\	}}}
}}}}}}d|
vrd}Y���wxYw#t$rd}Y���wxYw#t@$r�tjCd|z�t)jD|t(jF�rtjd|z�n&tjCd|z�d}tH|fcYcSd}Y���wxYw)1N�	configurezhpcups-install�0z
hpijs-installz	lpstat -vTzNo destinations added���zlpstat:zNo Queue addedrrz.HPCups installation=%d  HPIJS installation =%dz
cups-pdf:/zipp:/�-)	�Fr:r:r:r:r:r:r�HPzDevice URI: %sz
/etc/cups/ppdz.ppdFzPPD %s file not foundzPPD: %s�rbzutf-8r:zFail to read ppd=%s filezFile %s has read permissionsz)Insufficient permission to access file %szPPD Description: %szlpstat -p%szPrinter status: %s�
zunknown protocol device_uri=%s�Paused�_zyKey'%s': deviceType '%s' is_hp '%s' bus '%s' model '%s' serial '%s' dev_file '%s' host '%s' zc '%s' port '%s' Enabled'%d'�hpfaxzHP FaxzMIncorrect PPD file for fax queue '%s'. Fax queue must use 'HP-Fax-hplip.ppd'.�hpzUIncorrect PPD file for print queue '%s'. Print queue must not use 'HP-Fax-hplip.ppd'.)rAr@zYDevice %s is not HPLIP installed. Device must use the hp: or hpfax: to function in HPLIP.�hpcups�hpijs�
Postscript)-�to_bool�sys_conf�getr�run�findr*�info�
splitlines�LPSTAT_PATTERN�search�groupr)�AttributeError�debug�
startswith�bold�len�parseDeviceURI�Error�os�path�join�exists�errorr4�HPOTHER�open�readr�NICKNAME_PATTERN�decode�IOErrorr+�access�R_OKr(�replace�USB_PATTERN�NET_PATTERN�NET_ZC_PATTERN�NET_OTHER_PATTERN�HPCUPS�HPIJS�HPPS)�mode�is_hpcups_installed�is_hpijs_installed�st�output�status�
cups_printers�p�matchr-r.r/�is_hp�bus�model�serial�dev_file�host�zc�port�ppd_filer0r�fileptr�desc�cmdr,�part_1�part_2r1s                              r �parseQueuesr�Ys���!�(�,�,�{�<L�c�"R�S�� ����k�?�C�!P�Q�����;�'�J�B��
�F��M�
�{�{�*�+�r�1�V�[�[��5K�r�5Q����!�"��"�"�$�	�A�
�&�-�-�a�0��$�{�{�1�~��"�[�[��^�
��$�$�l�J�%?�@�	��I�I�m���I�I�>�AT�Vh�@i�i�j���f	w�A�'(�$�L�*��$�$�\�2���$�$�W�-���I�I�c�h�h�|�,�-��I�I�c�h�h�s�3�|�#4�4�5�6�
!�P^�_i�Pj�M��%��e�V�X�t�R��
�I�I�&��3�4��w�w�|�|�O�\�F�5J�K�H��L� �L��7�7�>�>�(�+��	�	�1�H�<�=����j��<�Ye�gk�l��	�	�)�h�.�/�
��x��.�3�3�5���)�+;�+B�+B�7�>�>�RY�CZ�+[�+a�+a�bc�+d�f�D�
�I�I�+�d�2�3���-�C����3��J�B���I�I�*�V�^�^�D�"�-E�E�F��!�!�*�-� �'�'�
�3�9�9�!�<���#�#�J�/�!�(�(��4�:�:�1�=���&�&�z�2�$�+�+�J�7�=�=�a�@��"�)�)�*�5�*�1�1�*�=�C�C�A�F��*�1�1�*�=�C�C�A�F���6�>� �C��H�H�=�z�I�J��C����9�:�E�F�����$(�"��;�;�x�(�R�/�(-�&���G�H�$���	�	�V�.1�(�E�3��v�W_�ae�gi�ko�qC�-D�D�E� %���w�&�x�4�/?��H�H�l�o{�{�|�#'�L���%�(�d�*:��H�H�t�xD�D�E�#'�L��_�4��H�H�x�{G�G�H�#���t�#�#)�L�.�'+����_�#(�L�-�'+��!�T�)�"&�L��")�L�#'�L���\�:�h��Ua�cu�v�Mf	w�N�H�H�R�L������]"�
��
��&�
!�Pt�M��%��e�V�X�t�R���:�%� �E��
!��8&���D����
����3�H�<�=��9�9�X�b�g�g�.��I�I�<�h�F�G��H�H�H�(�R�S�"�F�'��.�.���
�sP�/A
V�9V�3W�<V4�	V�V�V1�0V1�4W�W�BY�
Y�Yc�,�d}|tk(�rhd|jvsd|jvrB|jdk(r#tj	d|j
z�nd|j
z}nd|j
z}|dk7�r"datj|�tjd�\}}|dk(r+tj	d	�tjd
�y|dk(�r�tjtjtdd|j
�\}}|tjk7r#tjd|j
z�ytj!d
|j
z�t#j$d�r�d}	t'j(|	�y|j*dk(r�datjd|j
z�\}
}|
dk(r+tj	d	�tjd
�y|dk(rBtj,|j
�tj!d|j
z�ytj!d|j
z�yyyyd|jvsd|jvr[|jdk(r#tj	d|j
z�nQtjd|j
z�t.}n(tjd|j
z�t0}|dk(r|j*dk(rt2}|re|rb|r_da|j5|j
|j6|�|j9�tj	d�|j;�yyyy)NrAr@Fz'%s' is configured correctly.zBPPD file for '%s' is not correct. Need to choose correct PPD file.zR'%s' is not configured using HPLIP. Need to remove and re-cofigure using hp-setup.Tz'Do you want to remove and re-configure?z	User Exitrr:z5Failed to remove '%s' queue.
Remove using hp-toolbox.zF' %s' removed successfully.
Re-configuring this printer by hp-setup...zhp-setupzhp-setup -iz1'%s Queue is paused. Do you want to enable queue?z'%s' is enabled successfullyzManually enable '%s'.zStarting GUI loop...)�INTERACTIVE_MODErrr*rPr�Error_FoundrZr�enter_yes_no�sys�exitr
�cups_operation�
delPrinter�IPP_OKrJr�whichr�executer�
enablePrinter�QUEUES_INCORRECT_PPD�QUEUES_CONFIG_ERROR�
QUEUES_PAUSED�initr�show�exec_)�querk�dialog�app�	Error_msg�response�valuerp�
status_strr�responces           r �reconfigure_Queuer��s����I�����3�>�>�!�W����%>����E�)��	�	�9�C�O�O�L�M�`�cf�cr�cr�s�	�k�nq�n}�n}�~�I�����K��I�I�i� �!�.�.�/X�Y�O�H�e��5� ��	�	�+�&�������$��%)�%8�%8����JZ�\^�`d�fi�fu�fu�%v�"��
��T�[�[�(��I�I�V�WZ�Wf�Wf�f�g��H�H�f�gj�gv�gv�v�w��{�{�:�.�+�� �(�(��-�
�]�]�e�
#��K� �-�-�.a�cf�cr�cr�.s�t�O�H�e��5� ��	�	�+�&�������$���"�"�3�?�?�3����7����G�H����0����@�A�$�	/��.�3�>�>�!�W����%>����E�)��	�	�9�C�O�O�L�M��	�	�^�ad�ap�ap�q�r�0�	��I�I�j�mp�m|�m|�}�~�*�I�������%�!7�%�I���C��K��K�K�������	�B��K�K�M��I�I�,�-��I�I�K�%(��9r"c	��tj|�}|�tt��|j	d�j�xsd}|dv}|j	d�j�xsd}|dvrtt��|j	d�xsd}|j	d�xsd}|j	d�xsd}|j	d	�xsd}d}	|s|j	d
�xsdx}	}|j	d�xsd}
|dk(r	t
|
�}
|
d
k(rd}
||||||||	|
f	S#ttf$rd}
Y�%wxYw)Nrr:)rAr@�hpaior)�usb�net�bt�fw�parrr����r�r)	�DEVICE_URI_PATTERNrsrU�ERROR_INVALID_DEVICE_URIrN�lower�int�
ValueError�	TypeError)r.�mr/rtrurvrwrxryrzr{s           r rTrTsJ��� � ��,�A��y��,�-�-��w�w�q�z���!�'�R�H�
�1�
1�E�
�'�'�!�*�
�
�
�
"��C�
�3�3��,�-�-��7�7�1�:���E�
�W�W�Q�Z�
�2�F��w�w�q�z��R�H��7�7�1�:���D�	�B���G�G�A�J�$�"�$��T��7�7�1�:�?��D�
�e�|�	��t�9�D��1�9��D�
�U�C����$��D�H�H���I�&�	��D�	�s�D+�+D?�>D?c�<	�	ddlm}m}|tk(�r�	ddlm	}tj|j�t|�\}}	|	�r\t|j!��dk(rtj#d�t|j!��D]�\}
}t%|�dkDrH|s2datjd	t%|�|dj(fz�|D]}t+||���\tj#d
�tj#d|dj(z�t+|d|���t-j.|d
dd|�\}
}|
t0k7rdat&durQ|sOt%|�dk(rtjd
�n+tj3d�ntjd�tj4�y|t6k(�rc|dk(r*tjd�t
jd�t9j:|�\}}t=|dz�}t=|dz�}|tj>�}|jAdd
d
tB|�}tj|jD�t|�\}}	|	�rwt|j!��dk(rtj#d�t|j!��D]�\}
}t%|�dkDrvtjdt%|�|dj(fz�|s.da|jGd	t%|�|dj(fz�|D]}t+||||����tj#d
�tj#d|dj(z�t+|d|||���t-j.|||||�\}
}|
t0k7rdat&dur<|s:t%|�dk(rd
}nd}|jI|�ntjd�tj4�yy#t$r.tjd�t
jd�Y��kwxYw#t$rtjd�Y��`wxYw)Nr)�device�pmlzDevice library is not avail.)rz Failed to import password objectrzNo queues found.TzB%d queues of same device %s is configured.
Remove unwanted queues.r:z+Single print queue is configured for '%s'. FzNo Queue(s) configured.z*Queue(s) configured correctly using HPLIP.z/Could not complete Queue(s) configuration check�qt3zsThis is not supported in Qt3, requires GUI support (try running with --qt4). Also, try using interactive (-i) mode.z.queuesconfz.setupdialogzC%d queues of same device %s is configured.  Remove unwanted queues.)%r:r�r��ImportErrorr*rZr�r�r�rr
�setPasswordCallback�showPasswordPromptr+r��list�itemsrPrSr�rr�r	�disable�ERROR_NO_SI_DEVICErJ�releaseCupsInstance�GUI_MODEr�
import_dialogr
�argv�QueuesDiagnose�QUEUES_MSG_SENDING�showPasswordUI�showMessage�showSuccessMessage)�passwordObjrk�
ui_toolkit�
quiet_mode�
DEVICE_URIr�r�rr(rp�key�valr��SI_sts�	error_str�QApplication�
ui_package�ui�setupdialogr�r��msgs                      r �
main_functionr�@sN���!����	B�"�
�$�$�X�%@�%@�A�)�$�/���V���L�&�&�(�)�Q�.��	�	�,�-��� 2� 2� 4�5�
4���C��s�8�Q�;�%�&*�����!f�hk�lo�hp�qt�uv�qw�rD�rD�hE�"E�F�"�5��)�#�t�4�5��I�I�b�M��I�I�K�S�QR�V�M_�M_�_�`�%�c�!�f�d�3�
4�!.� 5� 5�d�B��d�K� X��F�I��+�+�"���e�#�!��<�(�A�-����!:�;����!M�N��H�H�F�G�� � �"�	
��	�����I�I�L�
M��H�H�Q�K�#(�#6�#6�z�#B� ��j�
�:�
�5�
6��#�J��$?�@���3�8�8�$���"�"�4��B�/A�+�N��� � ��!;�!;�<�)�$�/���V���L�&�&�(�)�Q�.��	�	�,�-��� 2� 2� 4�5�
A���C��s�8�Q�;��H�H�b�eh�il�em�nq�rs�nt�oA�oA�eB�B�C�%�&*���*�*�+p�ru�vy�rz�{~�@A�|B�|N�|N�rO�,O�P�"�A��)�#�t�V�C�@�A��I�I�b�M��I�I�K�S�QR�V�M_�M_�_�`�%�c�!�f�d�F�C�@�
A�!.� 5� 5�d�J��PS�U`� a��F�I��+�+�"���e�#�!��<�(�A�-�6��I���-�-�c�2��H�H�F�G�� � �"�_
��[���	�	�0�1���������	9��H�H�7�8�	9�s"�P?�Q9�?3Q6�5Q6�9R�R)NN)0r�rV�re�gr:rrrrr	�prntr
�	installerr�sixextr�	importlibr
r��er*rPrrhrirjr[�compile�Ir��	MULTILINEr^re�
IGNORECASErfrgrdrLr(r�rr4r�r�rTr��UI_TOOLKIT_QT4r�r&r"r �<module>r�s\��.�	�	��;�;��"�"�7�'�
��	����
���R�Z�Z�!^�`b�`d�`d�e���2�:�:�:�B�L�L�I���b�j�j�D�E������N�2�=�=�9���B�J�J�1�"�-�-�@���b�j�j�+�B�M�M�:������3�R�]�]�C������#�#�	9�~�D=�B!I�H!%�X�>�`e�rv�a#��y�7��I�I�a�L�6�6��7�s�D&�&E
�+E�E


Zerion Mini Shell 1.0