%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/system-config-printer/troubleshoot/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/system-config-printer/troubleshoot/__pycache__/PrintTestPage.cpython-312.pyc

�

Hf�P���ddlZddlZddlZddlmZddlZddlmZddlmZddlmZddl	Z	ddl
Z
ddlmZm
Z
ddl�ddlZddl�d	Zd
ZGd�de�Zy)
�N)�GLib)�Gdk)�Gtk)�Pango)�TimedOperation�OperationCanceled�)�*z/com/redhat/PrinterSpoolerzcom.redhat.PrinterSpoolerc�T�eZdZejed�ejed�ejed�ejed�ejed�ejed�ejed�iZd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�
PrintTestPage�Pending�Held�
Processing�Stopped�Canceled�Aborted�	Completedc��tj||d�tj�}|j	d�|jd�tj�}|jdd�|jd�|jd�|j|ddd�||_dtd�zdztd	�z|_
tj�}|jd�|j	d
�|jtj j"�tj$j'td��|_|j|j(ddd�tj$j'td��|_|j|j*ddd�|j|ddd�tj,�}tj.�}tj0td
�|d��}tj0td�tj2�d��}tj2�}	tj0td�|	d��}
tj2�}tj0td�|d
��}tj0td�tj2�d��}
|j5d�||_|
j9d�|	j;dt<j>j@�|	j;dd�|j9d�|j;dt<j>j@�|j;dd�|
j9d�|jC|�|jC|�|jC|
�|jC|�|jC|
�|jEd�tjF�}|jItjJjLtjJjL�|jOtjPjR�|jU|�||_+|j|ddd�tjtd���}|jd�|jdd�|j|ddd�tj�}|j	d�tjXtd���|_-tjXj]|jZtd��}|j|jZddd�|j|ddd�|j|ddd�i|_/|ja||�y)NzPrint test page�rTFz"<span weight="bold" size="larger">z	Test Pagez	</span>

z�Now print a test page.  If you are having problems printing a specific document, print that document now and mark the print job below.�zPrint Test PagezCancel All Jobs�Test)�active�Jobr	)�text�Printer��Document�Status��	ellipsizezwidth-chars�z*Did the marked print jobs print correctly?)�label��Yes�No)1�Question�__init__r�VBox�set_spacing�set_border_width�Label�
set_alignment�set_use_markup�
set_line_wrap�
pack_start�
main_label�_�main_label_text�
HButtonBox�
set_layout�ButtonBoxStyle�START�Button�new_with_label�print_button�
cancel_button�TreeView�CellRendererToggle�TreeViewColumn�CellRendererText�	set_radio�	test_cell�
set_resizable�set_propertyr�
EllipsizeMode�END�
append_column�set_rules_hint�ScrolledWindow�
set_policy�
PolicyType�	AUTOMATIC�set_shadow_type�
ShadowType�IN�add�treeview�RadioButton�yes�new_with_label_from_widget�persistent_answers�new_page)�self�troubleshooter�pager"�hbox�tvr@�test�job�printer_cell�printer�	name_cell�name�status�sw�vbox�nos                 �>/usr/share/system-config-printer/troubleshoot/PrintTestPage.pyr'zPrintTestPage.__init__3sr�����4��1B�C��x�x�{�����"�����r�"��	�	���
���Q��"�
���d�#�
���T�"������u�a�0���� D� !�+��!/�1>�!?� !�#/�!0�!0����~�~� �����q�!����!������+�+�1�1�2��J�J�5�5�q�9J�7K�L�������*�*�E�5�!�<� �Z�Z�6�6��:K�8L�M�������+�+�U�E�1�=�����u�e�Q�/�
�\�\�_���*�*�-�	��!�!�1�V�9�i��B��� � �!�E�(�C�,@�,@�,C�!�L���+�+�.���$�$�a�	�l�L�q�I���(�(�+�	��!�!�1�Z�=�)�!�D���#�#�Q�x�[�#�2F�2F�2I�*+�-�����U�#�"������t�$��!�!�;��0C�0C�0G�0G�H��!�!�=�"�5����D�!�����U�-@�-@�-D�-D�E����
�r�2����d�#�
���$��
���#��
���'�"�
���$��
���&�!�
���4� �
�
�
�
"��
�
�
�s�~�~�/�/����1I�1I�J�
���C�N�N�-�-�.�
�������
�����U�E�1�-��	�	��"N� O�P��
���T�"�
���Q��"������u�a�0��x�x�{�����!���?�?�!�E�(�3���
�_�_�
7�
7����1�T�7�
K��������5�%��3�����U�E�1�-�����u�e�Q�/�"$�������t�,�c�J���jj}d|vry�jj�}|d�_d}|j	di�}|j�D]#}|j
�D]\}}|dk(s�|}�#�%|�dtd�|zz}nd}�j|z}	�jj|	�tjttttt�}
�j j#|
�i�_�j&j	d	g�}�fd
�}t)||���_	�j*j-�\}
}	d�jjdz}|
j5�D�cgc]}|
|d
j7|�r|��}}t9t;|�j=t;|���}d}|D]b}	|
|}|
jAd�}|�j$|<|
jC|d||v�|
jC|d|��jE||��dy#t.t0j2f$rYywxYwcc}w#g}Y��xYw#t>$r	||}n#t>$rYY��wxYwY��wxYw)N�
cups_queueF�_authenticated_connection�cups_printer_ppd_defaults�	MediaTypez

z;Remember to load paper of type '%s' into the printer first.��test_page_job_idc�����j}	gd�}|jdd|��}|jd|��}||fS#t$r+|jdd��}|jd��}Y||fSwxYw)	N)zjob-id�job-name�	job-state�job-printer-uri�printer-namez
not-completedF)�
which_jobs�my_jobs�requested_attributes�	completed)rrrt)rrrs�rr)�authconn�getJobs�	TypeError)�c�r�	jobs_dict�completed_jobs_dictrUs    �rd�get_jobsz'PrintTestPage.display.<locals>.get_jobs�s�����
�
�A�
I�%��
�I�I�/�/4�<=�&�?�	�'(�i�i�K�FG�'0�'I�#��2�3�3���
I��I�I�/�/4�&�6�	�&'�i�i�K�i�&H�#��2�3�3�
I�s�+>�.A2�1A2��parent�/rprr	T)#rV�answers�
get_windowrw�get�values�itemsr1r2r0�
set_markupr�	ListStore�bool�int�strrO�	set_model�job_to_iterrSr�op�runr�cups�IPPError�keys�endswith�list�set�union�KeyError�append�	set_value�
update_job)rUr�r��	mediatype�defaults�opts�opt�value�mediatype_string�
label_text�model�	test_jobsr~r|r}�queue_uri_ending�x�jobs_on_this_printer�jobsr[�j�iters`                     rd�displayzPrintTestPage.display�s�����%�%�-�-���w�&���$�$�/�/�2��� ;�<��
��	��;�;� ;�R�@���O�O�&�	�D�"�j�j�m�
�
��U��+�%� %�I��
�	�� �%��,J�*K�)2�*3� 4�� "���)�)�,<�<�
����"�"�J�/��
�
�t�"�"�"�"�	$��
	
�
�
����'�����+�+�/�/�1C�R�H�	�	4�(!�(�6�:���	�/3�w�w�{�{�~�,�Y�+�
	&�"�T�%8�%8�%@�%@��%N�N��/8�~�~�/@�$I�!�,5�a�L�9J�,K�,4�H�6F�,G�-H�%&�$I� �$I��S��^�)�)�3�0D�+E�F�G��"���
	%�C�
��c�N���<�<��&�D�$(�D���S�!��O�O�T�1�c�Y�&6�7��O�O�T�1�c�*��O�O�S�!�$�
	%���?"�4�=�=�1�	��	��$I��	&�#%� ���
��+�C�0�A��������
�sf�I�,.I6� I1�:I6�0I?�I.�-I.�1I6�6I<�?	J"�	J�J"�	J�J"�J�J"�!J"c�����jjd�j��_�jjd�j
��_�jjd�j��_	�fd�}�jj�}t||���_
	�jj��_	t'j(�}|�_|r&|j-�j.t0t2��t5j6d�j8��_y#t t"j$f$rY��wxYw#d}Y�zxYw)N�clicked�toggledc�J���j}|jdgd���}|S)Nr�)�job-created�
job-completed�job-stoppedzjob-progresszjob-state-changed)�events)rw�createSubscription)rz�sub_idrUs  �rd�create_subscriptionz:PrintTestPage.connect_signals.<locals>.create_subscription�s1����
�
�A��)�)�3�3H�*�I�F��Mrer��path�dbus_interfacer	)r9�connect�
print_clicked�print_sigidr:�cancel_clicked�cancel_sigidr@�test_toggled�
test_sigidrVr�rr�r�r�rr�r��dbus�	SystemBus�bus�add_signal_receiver�handle_dbus_signal�	DBUS_PATH�
DBUS_IFACEr�timeout_add_seconds�update_jobs_list�timer)rU�handlerr�r�r�s`    rd�connect_signalszPrintTestPage.connect_signals�s2����,�,�4�4�i�6:�6H�6H�J��� �.�.�6�6�	�8<�8K�8K�M����.�.�0�0�)�26�2C�2C�E���	��$�$�/�/�2�� �"5�f�E���	��'�'�+�+�.�D�K�	��.�.�#�C������#�#�T�%<�%<�*3�4>�
$�
@��-�-�q�$�2G�2G�H��
��"�4�=�=�1�	��	��
	��C�s�5D>�E�>E�E�E#c����jr0�jj�jtt���j
j
�j��jj
�j��jj
�j��fd�}�jj�}t|�jf|���_	�j j#�	�`t-j.�j0�y#t$t&j(f$rY�>wxYw#Y�CxYw)Nr�c�@���j}|j|�y�N)rw�cancelSubscription)r�rzrUs  �rd�cancel_subscriptionz=PrintTestPage.disconnect_signals.<locals>.cancel_subscription
s����
�
�A�
� � �&�)rer)r��remove_signal_receiverr�r�r�r9�
disconnectr�r:r�r@r�rVr�rr�r�r�rr�r��sub_seqr�
source_remover�)rUr�r�s`  rd�disconnect_signalsz PrintTestPage.disconnect_signalss����8�8��H�H�+�+�T�-D�-D�2;�<F�
,�
H�	
���$�$�d�&6�&6�7����%�%�t�'8�'8�9����!�!�4�?�?�3�	*��$�$�/�/�2�� �"5�#'�;�;�.�)/�1���	��G�G�K�K�N�	���	
���D�J�J�'��"�4�=�=�1�	��	��
	��s�+D(�E�(E�E�Ec�B���jsiS�jj��_�jj�}�jj�}|�jd<Gd�d�}�jj�}||�j}�fd�}t||f|���_	�jj�}|�jd<�jS#ttj f$rY�jSwxYw)N�test_page_successfulc��eZdZd�Zd�Zy)�2PrintTestPage.collect_answer.<locals>.collect_jobsc�J�g|_|j|jd�yr�)r��foreach�each)rUr�s  rdr'z;PrintTestPage.collect_answer.<locals>.collect_jobs.__init__(s����	��
�
�t�y�y�$�/rec
�b�|jj|j|ddddd��y)Nrr	rrr)r�r�r�)rUr�r�r��	user_datas     rdr�z7PrintTestPage.collect_answer.<locals>.collect_jobs.each,s'���	�	� � �%�)�)�T�1�a��A�q�"A�BreN)�__name__�
__module__�__qualname__r'r��rerd�collect_jobsr�'s
��
0�
Crer�c	���d}�
j}g}|D]5\}}}}}d}	|r	|j|�}	|j||||||	f��7|S#t$r&|�|jd��}�
j|}	Y�IwxYw)N�allrv)rw�getJobAttributes�AttributeErrorrx�	job_attrsr�)r�r�rz�
with_attrsrZ�jobidr]�docr`�attrsrUs          �rd�collect_attributesz8PrintTestPage.collect_answer.<locals>.collect_attributes1s�����I��
�
�A��J�7;�
O�3��u�g�s�F����6� !� 2� 2�E� :���!�!�D�%��#�v�u�#M�N�
O����*�6�$�,�()�	�	�e�	�(D�I� $���u� 5��6�s�A�,A=�<A=r�test_page_job_status)�	displayedrS�copyr�rVr�rQ�
get_activerO�	get_modelr�rr�r�rr�r�)rUr��successr�r�r�r�r�s`       rd�collect_answerzPrintTestPage.collect_answers�����~�~��I��.�.�3�3�6����$�$�/�/�2���(�(�%�%�(��/6����+�,�	C�	C��
�
�'�'�*���U�#�(�(��	�(!�"4�#'�'�)/�1���	�������J�3=�D�L�L�/�0��|�|���"�4�=�=�1�	���|�|��	�s�)C7�7D�Dc���|jj�|jj}|d}|j	�|_|j
|jd<y)N�!_authenticated_connection_factoryrh)r��cancelrVr��get_connectionrw)rUr��factorys   rd�cancel_operationzPrintTestPage.cancel_operationPsQ���������%�%�-�-���=�>���.�.�1��
�48�M�M����0�1rec��td�tj|j�tjd|j
�|_y)Nz,D-Bus signal caught: updating jobs list soon��)�
debugprintrr�r��timeout_addr�)rU�argss  rdr�z PrintTestPage.handle_dbus_signalYs7���B�C����D�J�J�'��%�%�s�D�,A�,A�B��
rec�~�|j|}|jj�}	|d}|�|j|d|�|j|d|d�|j|d|j|d	�y#t$r4	|d}|j	d�}||dzd}n#t$rd}YnwxYwY��wxYw)
Nrqrpr�r	rrrnrro)r�rOr�r��rfindr��STATE)rUr��job_dictr�r��printer_name�urir{s        rdr�zPrintTestPage.update_job^s�������&���
�
�'�'�*��	$�#�N�3�L��#��O�O�T�1�l�3�
����q�(�:�"6�7�
����q�$�*�*�X�k�-B�"C�D���	$�
$��0�1���I�I�s�O��"�1�q�5�6�{����
$�#��
$��	$�s5�A?�?	B<�	B(�'B<�(B6�3B<�5B6�6B<�;B<c�T��tj�}tj|�}tjd|�}||jd<|jj
�|jj
�}�fd�}d}ddg}|D�]}		|	�2t|�df|��|_|jj�}
n�|	dk(r�tj�\}}tj|d�tj|�t|�df||	d�|�	�|_|jj�}
	tj|�d}|jj#d
g�}|j%
�||jd
<yy#t $rY�MwxYw#t&$rd|jd<Yyt($rd
|jd<Yyt*j,$r�}
|
j.\}
}|
t*j0k(r?|j3|	�t5|�dz
kr|�tj|�d}Yd}
~
���|
|f|jd<t7t9d�t9d�|z|jj
��Yd}
~
yd}
~
wwxYw)Nz%d/%b/%Y:%T %z�test_page_attemptedc�R���d}|j�}|j|i|��S)Nr�)r��
printTestPage)r��kwargsr�rzr�s    �rd�print_test_pagez4PrintTestPage.print_clicked.<locals>.print_test_pageys2����A�B�G��&�&�)�A�"�1�?�?�T�4�V�4�4rez
text/plainrgrsThis is a test page.
)�file�format)r
r�rlr��test_page_submit_failurer�r	zError submitting test pagez3There was an error during the CUPS operation: '%s'.)�time�	localtime�strftimerSrVr�r�rr�r��tempfile�mkstemp�os�write�close�unlink�OSErrorr�r�r�RuntimeErrorr�r�r��IPP_DOCUMENT_FORMAT�index�len�show_error_dialogr1)rU�widget�now�tt�whenr�r�tmpfname�	mimetypes�mimetyper��tmpfdr��e�sr�s               @rdr�zPrintTestPage.print_clickedqs�����i�i�l��
�^�^�S�
!���}�}�.��3��9=���� 5�6��%�%�-�-���$�$�/�/�2��	5�
���<�(�	�!�2	�H�1
��#�,�o�/6�|�/D�.F�5;�=�D�G�!�G�G�K�K�N�E���-�(0�(8�(8�(;�%�U�H��H�H�e�%>�?��H�H�e�$�,�o�/6�|�/D�.F�>F�@H�6J�5;�	=�D�G�
!�G�G�K�K�N�E���	�	�8�,� $�H��.�.�2�2�4F��K�����U�#�>B��'�'�(:�;��92	��(#�����%�
�FN��'�'�(B�C���
�FO��'�'�(B�C���=�=�
������A���1�1�1��O�O�X�.�#�y�/�A�2E�F��+��	�	�8�,�#'���GH�!�f��'�'�(B�C�!�1�%A�#B�#$�&8�$9�;<�$=�#'�#6�#6�#A�#A�#D�F���
�sQ�B0F)�F�>F)�	F&�#F)�%F&�&F)�)J'�J'�J'�0AJ"�AJ"�"J'c�d��d�jd<g}�jj�D]\}}|j|���fd�}t	||f�j
j
����_	�jj�y#ttjf$rYywxYw)NT�test_page_jobs_cancelledc����j}|D]}	|j|��y#tj$r=}|j\}}|tj
k7r||f�jd<Yd}~�cd}~wwxYw)N�test_page_cancel_failure)rw�	cancelJobr�r�r��IPP_NOT_POSSIBLErS)�jobidsrzr�r&r'rUs     �rd�cancel_jobsz1PrintTestPage.cancel_clicked.<locals>.cancel_jobs�sy����
�
�A��
U��U��K�K��'�
U���}�}�U��V�V�F�Q���D�1�1�1�OP�RS�f��/�/�0J�K���U�s�(�A8�3A3�3A8r)rSr�r�r�rrVr�r�r�rr�r�)rUrr.r�r�r/s`     rdr�zPrintTestPage.cancel_clicked�s����>B���� :�;����+�+�1�1�4�	"�K�E�4��M�M�5�!�	"�	U�!�+�#)�)�)-�)<�)<�)G�)G�)J�L���	��G�G�K�K�N��!�4�=�=�1�	��	�s�8B�B/�.B/c��|jj�}|j|�}|j|d�}|j	|d|�y)Nr)rOr��get_iter�	get_valuer�)rU�cellr�r�r�rs      rdr�zPrintTestPage.test_toggled�sD���
�
�'�'�*���~�~�t�$�����$��*��
����q�f�*�-rec�j�d�}tj�|jj�}t	||f|��|_	|j
j
�}|jj}|jj�}|d}|jjdg�}|dD]�}|d}	|	|_|d}
|d	}|d
k(rT|
|vs|d|k(rG|j#d�}||j$|
<|j'|dd�|j'|d
|
�n�r|
|j$vr��|
|vrE|dvrA|jjdg�}
|
j#|
|df�|
|jd<|j)|
|���t+j,|j.�t+j0|d|j2�|_t5d|dz�tj�y#ttjf$rtj�YywxYw)Nc���|j}	|j|jg|jdzg�}|S#t$r |j|jg�}Y|SwxYw)Nr	)rw�getNotificationsr�r�r�)rUrz�
notificationss   rd�get_notificationsz9PrintTestPage.update_jobs_list.<locals>.get_notifications�sp���
�
�A�
C� !� 2� 2�T�[�[�M�59�\�\�A�5E�4F�!H�
�
!� ��"�
C� !� 2� 2�T�[�[�M� B�
� � �
C�s�+;�%A$�#A$rTrgrlr�znotify-sequence-numberz
notify-job-idznotify-subscribed-eventr�rqrr	)r�r��test_page_completionsznotify-textznotify-get-intervalzUpdate again in %dsF)r�
threads_enterrVr�rr�r�rr�r��
threads_leaver�rOr�rSr�r�r�r�r�r�rr�r�r�r�r�)rUr8r�r7r�r��queuer��event�seqr[�nser��comps              rdr�zPrintTestPage.update_jobs_list�s1��	!�	�����$�$�/�/�2�� �"3�#'�'�)/�1���	� �G�G�K�K�N�M�
�%�%�-�-���
�
�'�'�*����%���+�+�/�/�0B�B�G�	�"�8�,�	)�E��0�1�C��D�L���(�C��1�2�C��m�#��9�$��.�)�U�2� �<�<��.�D�,0�D�$�$�S�)��O�O�T�1�d�3��O�O�T�1�c�2���D�,�,�,���y� ��7�7��.�.�2�2�4K�R�P�����c�5��#7�8�9�CG��'�'�(?�@��O�O�S�%�(�3	)�:	
���D�J�J�'��-�-��/�0��!�!�#��
�	�)�!�"7�8�9�	:�������Y"�4�=�=�1�	���� ��	�s�H�-H2�1H2N)r�r�r�r��IPP_JOB_PENDINGr1�IPP_JOB_HELD�IPP_JOB_PROCESSING�IPP_JOB_STOPPED�IPP_JOB_CANCELED�IPP_JOB_ABORTED�IPP_JOB_COMPLETEDrr'r�r�r�r�r�r�r�r�r�r�r�r�rerdrr*s����"�"�A�i�L�����6���%�%�q����"�"�A�i�L��#�#�Q�z�]��"�"�A�i�L��$�$�a��n�

7�E�K-�ZX�t$I�L(�<0�dB�C�
E�&A�F�0.�Arer)r�r��	dbus.glib�
gi.repositoryrrrrrrr�timedopsrr�base�errordialogsr�r�r&rr�rerd�<module>rMsI��.����	������6����
&�	�&�
�i�H�ire

Zerion Mini Shell 1.0