%PDF- %PDF-
Mini Shell

Mini Shell

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

�

HfI��
��ddlZddlZddlZddlZddlZddlZddlZddlZejdd�ddl	m
Z
ddl	mZddl	mZddl	m
Z
ddl	mZdd	l	mZdd
lmZddlZddlZddlZddl	mZddlZddlZddlZddlZddlZddlZddlmZdd
l�ddl Z ddl!Z!ddl"Z"ddl#m$Z$ejJd�	ejdd�ddl	m&Z&dZ'ddl)Z)e)jTe jVe jX��ddl!m-Z-e j\Z/dZ0dZ1dZ2e
jfd�e'r�e&jhjkde&jljne&jpjre&jpjre&jpjre&jpjre&jpjte&jpjre&jpjre&jpjrd��Z;Gd�d�Z<Gd�d �Z=Gd!�d"�Z>Gd#�d$�Z?Gd%�d&ej�Z@Gd'�d(e�ZAy#e($rdZ'Y���wxYw))�N�Notifyz0.7)r)�GLib)�GObject)�Gdk)�	GdkPixbuf)�Gtk)�GtkGUI)�Pango)�saxutils)�*)�reducez1.9.47�Secret�1)rTF)�domain�	localedir)�StateReason�printer�zdocument-print-previewz"System Config Printer Notificationzorg.system.config.printer.store)�userr�object�protocol�port�server�authtype�uric�:�eZdZej�Zd�Zd�Zy)�
ServiceGetc�N�tjjdd�|_y�Nr)r�Service�get_sync�service��selfs �-/usr/share/system-config-printer/jobviewer.py�__init__zServiceGet.__init__^s��!�>�>�2�2�1�37�9�D�L�c��|jS�N)r"r#s r%�get_servicezServiceGet.get_servicebs���<�<�r'N)�__name__�
__module__�__qualname__rr r"r&r*�r'r%rr[s�� �&�.�.�"��	9�	 r'rc�&�eZdZe�Zd�Zd�Zy)�
ItemSearchc��tjj|t|tjj
d�|_yr))rr �search_sync�NETWORK_PASSWORD�SearchFlags�LOAD_SECRETS�items)r$r"�attrss   r%r&zItemSearch.__init__is2�����3�3�G�4D�49�4:�4F�4F�4S�4S�48�	:�D�Jr'c��|jSr))r6r#s r%�	get_itemszItemSearch.get_itemsps���:�:�r'N)r+r,r-�listr6r&r9r.r'r%r0r0fs�����	:�	r'r0c��eZdZd�Zd�Zy)�
PasswordStorec	�r�tjt|tj||d|j�yr))r�password_storer3�COLLECTION_DEFAULT�on_password_stored)r$r7�name�secrets    r%r&zPasswordStore.__init__us1���!�!�"2�"'�"(�";�";�"&�"(�"&�"&�"9�"9�

;r'c�.�tj|�yr))r�password_store_finish)r$�source�result�unuseds    r%r@z PasswordStore.on_password_stored~s���(�(��0r'N)r+r,r-r&r@r.r'r%r<r<ts��	;�	1r'r<c�L�eZdZdd�Zdd�Zdd�Zd�Zd�Zdd�Zd�Z	d	�Z
dd
�Zy)
�PrinterURIIndexNc�H�i|_|�g}||_|j�yr))r�names�_collect_names)r$rKs  r%r&zPrinterURIIndex.__init__�s&������=��E���
����r'c��|jsy|s	tj�}|jD]}|j	|���g|_y#t$rYywxYw)N��
connection)rK�cups�
Connection�RuntimeError�add_printer)r$rO�crAs    r%rLzPrinterURIIndex._collect_names�se���z�z���
��O�O�&���J�J�	2�D����d�q��1�	2���
��
 �
��
�s�A�	A�Ac�J�	|j||��y#t$rYywxYw)N)rArO)�_map_printer�KeyError)r$rrOs   r%rSzPrinterURIIndex.add_printer�s,��	����G�
��C���	��	�s��	"�"c���g}d|vr+|d}t|�tk7r|g}|j|�d|vr|j|d�d|vr|j|d�|D]}||j|<�y)N�printer-uri-supportedznotify-printer-uri�printer-more-info)�typer:�extend�appendr)r$rr7�uris�
uri_supportedrs      r%�update_from_attrsz!PrinterURIIndex.update_from_attrs�s�����"�e�+�!�"9�:�M��]�#�t�+�!.��
��K�K��'��5�(��K�K��3�4�5��%�'��K�K��2�3�4��	(�C� '�D�L�L���	(r'c��|j�t|jj��}|D]"}|j||k(s�|j|=�$yr))rLr:r�keys)r$rr^rs    r%�remove_printerzPrinterURIIndex.remove_printer�sQ�������D�L�L�%�%�(�)���	&�C��|�|�C� �G�+��L�L��%�	&r'c��|j�	|j|S#t$r|j||��cYSwxYw)N)rrO)rLrrWrV)r$rrOs   r%�lookupzPrinterURIIndex.lookup�sJ������	F��<�<��$�$���	F��$�$�#�*�$�E�E�	F�s�!�A�Ac�h�|j�t|jj��Sr))rL�setr�valuesr#s r%�all_printer_namesz!PrinterURIIndex.all_printer_names�s&�������D�L�L�'�'�*�+�+r'c��|j�|jj�D]\}}||k(s�|cSt�r))rLrr6rW)r$rArrs    r%�lookup_cached_by_namez%PrinterURIIndex.lookup_cached_by_name�sA������ �L�L�.�.�1�	�L�C���$���
�	��r'c�4�	|�tj�}gd�}|�|j||��}n|j||��}|d}|j
||�|�||j|<|S#t$rt�tj
$rt�wxYw)N)�printer-namerYrZ�r�requested_attributes�rorm)rPrQ�getPrinterAttributesrRrW�IPPErrorr`r)r$rrArO�rr7s      r%rVzPrinterURIIndex._map_printer�s���	��!�!�_�_�/�
�N�A���"�7�7�S�NO�8�Q��#�7�7��NO�8�Q���^�$������e�,��?� $�D�L�L�������	��N��}�}�	��N�	�s�AA/�/(Br))NNN)r+r,r-r&rLrSr`rcrerirkrVr.r'r%rIrI�s0���
��
(�&�F�,��r'rIc�(�eZdZejj
ddfejj
deffejj
deejffejj
ddfd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zy)�CancelJobsOperationNr.)�destroy�job-deleted�	ipp-error�finishedc���tjj|�t|�|_||_||_||_||_|rFt|j�dkDrtd�}td�}n\td�}td�}nEt|j�dkDrtd�}td�}ntd�}td	�}tj||d
d
��}	|	jtd�tjj|tjj�|	j!tjj�|	j#d
�|	j%d�tj&j)dd�}
tj*�}|j-tj.tj0j2�|j5dd�|
j7|ddd�tj8|��}|j;d
�|j5dd�|
j7|ddd�|	j<j7|
ddd�|	j?d|j@�|	j?d|jB�|	jE�|	|_#d|_$tKd|z�y)N�zDelete Jobsz(Do you really want to delete these jobs?z
Delete Jobz&Do you really want to delete this job?zCancel Jobsz(Do you really want to cancel these jobs?z
Cancel Jobz&Do you really want to cancel this job?T)�title�
transient_for�modal�destroy_with_parentz
Keep Printing�F��r��label�response�delete-eventz+%s)&rr&r:�jobids�	purge_job�hostr�
encryption�len�_r�Dialog�add_buttons�ResponseType�NO�YES�set_default_response�set_border_width�
set_resizable�HBox�new�Image�set_from_stock�STOCK_DIALOG_QUESTION�IconSize�DIALOG�
set_alignment�
pack_start�Label�
set_line_wrap�vbox�connect�on_job_cancel_prompt_response�on_job_cancel_prompt_delete�show_all�dialogrO�
debugprint)
r$�parentr�rr�r�r��dialog_title�dialog_labelr��hbox�imager�s
             r%r&zCancelJobsOperation.__init__�s8����� � �$�'��F�m���"�����	���	�$�����4�;�;��!�#� ��/�� �!K�L�� ���� �!I�J���4�;�;��!�#� ��/�� �!K�L�� ���� �!I�J�����<�v�#'�T�C�����A�o�.��0@�0@�0C�0C�(�#�*:�*:�*>�*>�	@��#�#�S�%5�%5�%8�%8�9�����#����e�$��x�x�|�|�U�B�'���	�	���
���c�7�7����9L�9L�M�
���S�#�&������u�a�0��	�	��-��
���T�"�
���S�#�&������u�a�0�������e�U�A�6����
�D�$F�$F�G������(H�(H�I������������E�D�L�!r'c� �td|z�y)Nz-%s)r�r#s r%�__del__zCancelJobsOperation.__del__s���E�D�L�!r'c���|jr!|jj�d|_|jr!|jj�d|_td|z�y)NzDESTROY: %s)rOrvr�r�r#s r%�
do_destroyzCancelJobsOperation.do_destroysK���?�?��O�O�#�#�&�"�D�O��;�;��K�K���"��D�K��M�D�(�)r'c�&�|jd�y)Nrv)�emitr#s r%rvzCancelJobsOperation.destroy)s���	�	�9�r'c�X�|j|tjj�yr))r�rr�r��r$r��events   r%r�z/CancelJobsOperation.on_job_cancel_prompt_delete,s���*�*�F�C�4D�4D�4G�4G�Hr'c�|�|j�d|_|tjjk7r|jd�yt
|j�dk(r|jd�ytj|j|j|j|j|j��y)Nryr)r�rr��
reply_handler�
error_handler)rvr�rr�r�r�r�r��	asyncconnrQr�rr��
_connected�_connect_failed)r$r�r�s   r%r�z1CancelJobsOperation.on_job_cancel_prompt_response/s�����������s�'�'�+�+�+��I�I�z�"���t�{�{��q� ��I�I�z�"�����4�9�9�#'�9�9�)-���,0�O�O�,0�,@�,@�		Br'c�8�td|�dt|����y)Nz$CancelJobsOperation._connect_failed �:)r��repr)r$rO�excs   r%r�z#CancelJobsOperation._connect_failedAs���:�t�UX�z�Z�[r'c�"�||_|jrtd�}ntd�}|jj|�|jj	|j
d|j|j|j��y)Nzdeleting jobz
canceling jobr�r�r�)rOr�r��_begin_operation�	cancelJobr��cancelJob_finish�cancelJob_error)r$rOrF�	operations    r%r�zCancelJobsOperation._connectedDsp��$����>�>��.�)�I��/�*�I����(�(�)�4����!�!�4�;�;�q�>�4�>�>�15�1F�1F�15�1E�1E�	"�	Gr'c��td|�dt|����t|�tjk(rh|j
\}}|tjk7r3|tjk7r |jd|jd|�|j|d�y|jj�|jj�d|_|jd|jd|�|jd�y)NzcancelJob_error r�rxrry)r�r�r[rPrr�args�IPP_NOT_POSSIBLE�
IPP_NOT_FOUNDr�r�r�rO�_end_operationrv)r$rOr��e�ms     r%r�z#CancelJobsOperation.cancelJob_errorQs����z�4��:�F�G���:����&��X�X�F�Q���T�*�*�*��T�'�'�'��	�	�;����A���<��!�!�*�d�3��O�O�*�*�-��O�O�#�#�&�"�D�O��I�I�{�D�K�K��N�C�8��I�I�z�"�r'c���td|�dt|����|jd|jd�|jd=|jsM|jj�|jj
�d|_|jd�y|j|jd|j|j|j��y)NzcancelJob_finish r�rwrryr�)r�r�r�r�rOr�rvr�r�r�r�)r$rOrFs   r%r�z$CancelJobsOperation.cancelJob_finishbs����
�D�&�M�J�K��	�	�=�$�+�+�a�.�1��K�K��N��{�{��O�O�*�*�-��O�O�#�#�&�"�D�O��I�I�z�"��
� � �$�+�+�a�.�$�.�.�04�0E�0E�04�0D�0D�
!�
Fr')r+r,r-r�SignalFlags�RUN_LAST�int�
TYPE_PYOBJECT�__gsignals__r&r�r�rvr�r�r�r�r�r�r.r'r%ruru�s����+�+�4�4�d�B�?��+�+�4�4�d�S�F�C��+�+�4�4�d��g�3�3�4�6��+�+�4�4�d�B�?�
�L�,"�\"�	*��I�B�$\�G��"Fr'ruc�0�eZdZegd��ZdejjddfiZ				dNd�Z	d�Z
d�Zd�ZdOd	�Z
d
�ZdPd�Zd�Zd
�Zd�Zd�ZdOd�Zd�ZdOd�Zd�ZdOd�Zd�Zd�Zd�Zd�Zd�ZdOd�Zd�Zd�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,�Z0d-�Z1d.�Z2d/�Z3dOd0�Z4d1�Z5dOd2�Z6dOd3�Z7dOd4�Z8dOd5�Z9d6�Z:d7�Z;dOd8�Z<d9�Z=dOd:�Z>d;�Z?d<�Z@d=�ZAd>�ZBd?�ZCd@�ZDdA�ZEdB�ZFdC�ZGdD�ZHdE�ZIdF�ZJdG�ZKdH�ZLdI�ZMdJ�ZNdK�ZOdL�ZPdM�ZQy)Q�	JobViewer)�job-k-octets�job-name�job-originating-user-name�job-printer-uri�	job-state�time-at-creation�auth-info-required�
job-preservedryNr.c��"�tjj|�||_||_||_||_||_tj�}d|v|_	d|v|_
i|_i|_g|_
i|_t�|_t�|_i|_d|_i|_i|_i|_d|_i|_i|_t�|_g|_|j9gd�dgd�t:j<��t?j@d�	�}	|	jCd
t>jDtGd�dtGd�|jHfd
t>jJtGd�dtGd�|jLfdt>jNtGd�dtGd�|jPfdt>jRtGd�dtGd�|jTfdt>jVtGd�dtGd�|jXfdt>jZtGd�dtGd�|j\fddtGd�dddfddtGd�dd|j^fd dtGd!�dd|j`fd"t>jbdd#tGd$�|jdfg
�t?jf�|_4|jhjk|	d%�|jhjmd&�|jhjo�|jpjs|jhju��t?jv�|_<d'D]�}
|
st?jz�}nc|	j}|
�}|jd(�|j��}|
dk(r,||_At?jv�}
|j�|
�|j��|jxj�|���d)D]w}
|	j}|
�}|j|
d"k(�|j�|
d"k(�|j��}|j��|j�j�|d%��yd(d(tGd*�|j�fd+d(tGd,�|j�fd(d+tGd-�|j�fd(d+tGd.�|j�fd(d(tGd/�|j�ffD]�\}}}}|r|r�
t?j��}|r<|j�d0t�j�j��|j�d1d2�t?j�||�}|j�||d�|j�d+�|j�j�|���t?j��}t?j�tGd3�|d4�5�}|j�d+�|j�j�|�t?j�tGd6��}t?j��}|j�|d(�t?j��}|j�d0t�j�j��|j�d1d2�|j�|d+�|j�||j�d�|j�||j�d�|j�j�|�t?j�t�t��|__|j�j�dt>j�j��|j�j�|j��|j�j�d+�|j�j��|_f|j�j�t>j�j��|j�j�d7|j��|j�j�d8|j��|j�j�d9|j��|jpj�t��|jpj��|r
t�d:�|�}|r|rtGd;�z}ntGd<�}n|rd=z}ntGd>�}|jpj�tGd?�|z�|r|jpj�|�d@�}t>j�j��}||t��|_v||dA�|_w|j�j��|_y|j�j�d�|j�j�|j�dd|j�j��|j�j��dddBdBt�j��jdC�|jr�|js�t?�j�|_�|�j�j|j��|�jj�dD|�j�|�jj�d9|�j
�|�j�j
d(�|��t�j�}|�j�|�jd+��t�j�|_��t�j�|_��t�j �|_��t%�j&||||�j|�j|�j"�E�|_�|�j$j�dF|�j(�|�j$j�dG|�j*�|�j$j�dH|�j,�|�j$j�dI|�j.�|�j$j�dJ|�j0�|�j$j�dK|�j2�|�j$j�dL|�j4�|�j$j�dM|�j6�|�j$j�dN|�j8�|�j$j�dO|�j:�|�j$j�dP|�j<�|�j$�j?�d|_�|s��t%�j&|d+|�j|�j|�j"�Q�|_�|�j@j�dG|�j*�|�j@j�dH|�j,�|�j@�j?�|js|jpj��t?�jB�|_�|�jDj�tGdR��|�jD�jGt>�jH�jJ�|�jD�jMdSdS�|�jDj�|jp�|�jDj�dT|�jN�|�jDjs|jhju��t?j@dU�	�}|jCd"t>jbdd#tGd$�|�jNfg�t?jf�|_�|�jPjk|d%�|�jPjmdV�|�jPjo�|�jDjs|�jPju��t?�jR�}|�jD�jU|�t?�jV�}|�jPj}dW�}|j��}|j�d+�|j�|d�|j�|d(d(d�t?�jX�|_�|j�|�jZd+d+d�y)XN�actions�persistencer)�
JobsWindow�treeview�	statusbar�toolbar�statusicon_popupmenu)r�r�)r�JobActionGroup)rA�
cancel-job�_CancelzCancel selected jobs�
delete-job�_DeletezDelete selected jobs�hold-job�_HoldzHold selected jobs�release-job�_ReleasezRelease selected jobs�reprint-job�Re_printzReprint selected jobs�retrieve-job�	Re_trievezRetrieve selected jobs�move-jobz_Move To�authenticate-job�
_Authenticate�job-attributesz_View Attributes�closez<ctrl>wzClose this window���ay
<ui>
 <accelerator action="cancel-job"/>
 <accelerator action="delete-job"/>
 <accelerator action="hold-job"/>
 <accelerator action="release-job"/>
 <accelerator action="reprint-job"/>
 <accelerator action="retrieve-job"/>
 <accelerator action="move-job"/>
 <accelerator action="authenticate-job"/>
 <accelerator action="job-attributes"/>
 <accelerator action="close"/>
</ui>
)
r�r�r�r�r�r�r�Nr�r�F)r�r�r�r�r�r�r��JobT�User�Document�Printer�Size�	ellipsizezwidth-chars�zTime submittedr{��text�Status�changed�button_release_eventz
popup-menuc��|dz|zS)Nz, r.)�x�ys  r%�<lambda>z$JobViewer.__init__.<locals>.<lambda>/s��Q��X��\�r'z
my jobs on %szmy jobsz%szall jobszDocument Print Status (%s)c�.�	|j|td�}|S#tj$rft	d|z�t
jjt
jjddtt�}|jd�Y|SwxYw)Nr�No %s icon availableT�)�	load_icon�	ICON_SIZEr�GErrorr�r�Pixbufr��
Colorspace�RGB�fill)�theme�icon�pixbufs   r%rz%JobViewer.__init__.<locals>.load_icon@s���
 ����$�	�1�=���M��
�>�>�
 ��2�T�9�:�"�)�)�-�-�y�/C�/C�/G�/G�)-�q�)�Y�H�����Q���M�

 �s��A5B�Bzprinter-printing��?��activate)�bus�my_jobs�specific_destsr�rr��refreshz	job-addedz	job-eventzjob-removedzstate-reason-addedzstate-reason-removedzstill-connectingz
now-connectedz
printer-addedz
printer-eventzprinter-removed)rrr�rr�zJob attributesiX�delete_event�AttrsActionGroupz+
<ui>
 <accelerator action="close"/>
</ui>
z/close)�rr&�loop�applet�suppress_icon_hiderrr�get_server_caps�notify_has_actions�notify_has_persistence�jobs�jobitersr��
jobs_attrsrg�active_jobs�stopped_job_prompts�printer_state_reasons�num_jobs_when_hidden�connecting_to_device�state_reason_notifications�auth_info_dialogs�job_creation_times_timer�new_printer_notifications�completed_job_notifications�authenticated_jobs�ops�
getWidgets�config�PACKAGEr�ActionGroup�add_actions�STOCK_CANCELr��on_job_cancel_activate�STOCK_DELETE�on_job_delete_activate�STOCK_MEDIA_PAUSE�on_job_hold_activate�STOCK_MEDIA_PLAY�on_job_release_activate�
STOCK_REDO�on_job_reprint_activate�
STOCK_SAVE_AS�on_job_retrieve_activate�on_job_authenticate_activate�on_job_attributes_activate�STOCK_CLOSE�on_delete_event�	UIManager�job_ui_manager�insert_action_group�add_ui_from_string�
ensure_updater��add_accel_group�get_accel_group�Menu�job_context_menu�SeparatorMenuItem�
get_action�
set_sensitive�create_menu_item�move_job_menuitem�set_submenu�showr]�set_is_important�create_tool_itemr��insert�_set_job_job_number_text�_set_job_user_text�_set_job_document_text�_set_job_printer_text�_set_job_size_text�CellRendererText�set_propertyr
�
EllipsizeMode�END�TreeViewColumn�set_cell_data_funcr�r��
append_column�CellRendererPixbufr��_set_job_status_icon�_set_job_status_text�	TreeStorer��str�store�set_sort_column_id�SortType�
DESCENDING�	set_model�set_rules_hint�
get_selection�	selection�set_mode�
SelectionMode�MULTIPLEr��on_selection_changed� on_treeview_button_release_event�on_treeview_popup_menu�
set_icon_name�ICON�hider
�	set_title�set_transient_for�	IconTheme�get_default�	icon_jobs�icon_jobs_processing�copy�icon_no_jobsr�	composite�	get_width�
get_heightr�
InterpType�BILINEAR�
StatusIcon�
statusicon�set_from_pixbuf�toggle_window_display�on_icon_popupmenu�set_visible�dbus�	SystemBus�connect_signals�set_process_pendingrP�	getServerr��getPortr�
getEncryptionr��monitor�Monitor�
on_refresh�	job_added�	job_event�job_removed�state_reason_added�state_reason_removed�still_connecting�
now_connected�
printer_added�
printer_event�printer_removedr�
my_monitor�Window�JobsAttributesWindow�set_position�WindowPosition�MOUSE�set_default_size�job_attributes_on_delete_event�attrs_ui_manager�VBox�add�Toolbar�Notebook�notebook)r$rrrr rrr��notify_caps�job_action_group�action_name�item�action�printers�skipr�rA�setter�cell�columnrr�	the_destsr|rr�attrs_action_groupr�r�s                             r%r&zJobViewer.__init__�sU
��	��� � �$�'���	����"4������,����,�,�/��"+�{�":���&3�{�&B��#���	���
��������5���#&�5�� �%'��"�$%��!�$&��!�*,��'�!#���(,��%�)+��&�+-��(�"%�%���������*�
 6�6�
8�!'���	�	0��?�?�1A�B���$�$��s�/�/��9��t��)�*�D�,G�,G�I��s�/�/��9��t��)�*�D�,G�,G�I��S�2�2�A�g�J���'�(�$�*C�*C�E��� 4� 4�a�
�m�T��*�+�T�-I�-I�K������*�
�t��*�+�T�-I�-I�K���!2�!2�A�k�N�D��+�,�d�.K�.K�M��T�1�Z�=�$��d�C�#�T�1�_�+=�t�T��2�2�4�!�4��+=�)>��d��0�0�2��#�/�/�4���&�'��)=�)=�?�%'�	�*"�m�m�.������/�/�1A�2�F����.�.�
�	� 	
���)�)�,����'�'��)<�)<�)L�)L�)O�P� #������	.�	0�K���,�,�/��)�4�4�k�B���$�$�e�,��.�.�1���*�,�-1�D�*�"�x�x�{�H��$�$�h�/��I�I�L��!�!�(�(�$�/�/	0�2%�	+�K�&�0�0�+�>�F�� � �+��"8�9��#�#�[�G�%;�<��*�*�-�D��I�I�L��L�L����r�*�	+����%��$�*G�*G�H���q��y�$�*A�*A�B���q��}�d�.I�.I�J���q��|�T�-G�-G�H����&�	�4�+B�+B�C�	E�	0�)�D�)�T�6��$���'�'�)�D���!�!�;��0C�0C�0G�0G�H��!�!�=�"�5��'�'��d�3�F��%�%�t�V�T�:�� � ��&��M�M�'�'��/�%	0�(�#�#�&���#�#�Q�'7�%8�$�Q�G�����d�#��
�
�#�#�V�,��#�#�Q�x�[�1���%�%�(�����4��'��#�#�&�����;��(;�(;�(?�(?�@����=�"�-����4��&��!�!�4��)B�)B�D�I��!�!�4��)B�)B�D�I��
�
�#�#�V�,��]�]�3��,��
��
�
�%�%�q�#�,�,�*A�*A�B��
�
����
�
�+��
�
�$�$�d�+����4�4�6��������� 1� 1� :� :�;������y�$�*C�*C�D��
�
���5�#�D�D�	F��
�
���|�T�-H�-H�I����%�%�t�,��������� 9�>�J�I����/�*�Y�6���)�����y�(���*�
�����!�!�1�%A�#B�U�#J�K���O�O�-�-�v�6�		��
�
�)�)�,��"�E�4�0���$-�u�6H�$I��!� �N�N�/�/�2���������"���� � �$�"3�"3�"#�Q�"&�"3�"3�"=�"=�"?�"&�"3�"3�">�">�"@�"#�Q�"%�s�"+�"6�"6�"?�"?�"%�	'��;�;�t�:�:�!�n�n�/�D�O��O�O�+�+�T�->�->�?��O�O�#�#�Z��1K�1K�L��O�O�#�#�\�4�3I�3I�J��O�O�'�'��/��;��.�.�#�C������ � �$�'��N�N�%��	��L�L�O��	��,�,�/������C��7E�-1�Y�Y�T�Y�Y�37�?�?�D���	
�����i����9������k�4�>�>�:������k�4�>�>�:������m�T�-=�-=�>������2�D�4K�4K�L������4�d�6O�6O�P������0�$�2G�2G�H������o�t�/A�/A�B������o�t�/A�/A�B������o�t�/A�/A�B������/��1E�1E�F�����������%�o�o�#�t�37�9�9�4�9�9�9=���J�D�O�
�O�O�#�#�[�$�.�.�A��O�O�#�#�[�$�.�.�A��O�O�#�#�&��{�{��O�O� � �#�$'�J�J�L��!��!�!�+�+�Q�/?�-@�A��!�!�.�.�s�/A�/A�/G�/G�H��!�!�2�2�3��<��!�!�3�3�T�_�_�E��!�!�)�)�.�*.�*M�*M�	O��!�!�1�1�4�3F�3F�3V�3V�3Y�Z� �_�_�3E�F���&�&��#�/�/�4���&�'��)L�)L�N�)�	�!$�
�
� 0������1�1�3E�r�J����0�0��	�	
���+�+�.��!�!�1�1�4�3H�3H�3X�3X�3[�\��x�x�{���!�!�%�%�t�,��+�+�.���&�&�1�1�8�<���&�&�)�����t�$�����a� �����%���2������
��������d�A�6r'c���|jj�|jr|jj�|jj	�|j
j
�|jj
�fD]2}|D]+}t|dd�dk7s�	|j�d|_�-�4|j�&tj|j�d|_
|jD]}|j!��|j"r'|j$s|j&j)d�|j+d�y#tj$rY��wxYw)N�closedTFry)r��cleanupr�r�r|r/rhr,�getattrr�rr
r�r.�
source_remover2rvrr#r�r�r�)r$�l�notification�ops    r%r�zJobViewer.cleanup�s:���������?�?��O�O�#�#�&��������0�0�7�7�:��1�1�8�8�;�=�
	/�A� !�
/���L�(�D�9�T�A��$�*�*�-�
+/�L�'�
/�
	/��(�(�4����� =� =�>�,0�D�)��(�(�	�B��J�J�M�	��;�;�t�:�:��O�O�'�'��/��	�	�:���! �;�;����s�)E�E2�1E2c��||_yr))�process_pending_events)r$�whethers  r%r�zJobViewer.set_process_pending�s
��&-��#r'c��|js|jsH|jj�d|j_|js|j�y|jj
�y)NFT)rrr�r|�visibler��quit)r$r�s  r%rGzJobViewer.on_delete_event�sS���;�;�d�i�i��O�O� � �#�&+�D�O�O�#��;�;������
�I�I�N�N��r'c���t|jj��D]}|jjd��i|_|j
j
�y)Nr�T)�ranger��get_n_pages�remove_pager&r�r|)r$�widgetr��pages    r%r�z(JobViewer.job_attributes_on_delete_event�sQ���$�-�-�3�3�5�6�	*�D��M�M�%�%�b�)�	*�����!�!�&�&�(�r'c�D�tj|||j�Sr))�errordialogs�show_IPP_Errorr�)r$�	exception�messages   r%r�zJobViewer.show_IPP_Error�s���*�*�I�w����P�Pr'c��t|jdd�}|rd}|jr:|r|jj��n0|jj	��n|r�|jj�}|jj�}|jj�\}}}}	|r?|jd�|�|jd�|jj�n~|jjd�nb|jj�|jjd�|jj�}|�|jd�||j_
y)Nr�FT)r�r�r#r|rW�
get_windowr�r��get_geometry�set_skip_taskbar_hint�iconifyr��presentr�)
r$r�
force_showr��w�aw�loc�s�area�os
          r%r�zJobViewer.toggle_window_display�s)���4�?�?�I�t�<����G��&�&�����$�$�'����$�$�'���O�O�.�.�0���.�.�9�9�;��$(�O�O�$@�$@�$C�!��a��q���+�+�T�2��~��0�0�$�7��O�O�+�+�.��O�O�/�/��7����'�'�*����5�5�u�=��.�.�9�9�;���>��,�,�e�4�&-�+����r'c��|j�rd}nd}|jj|d��|jr|jj|d��yy)N�allz
not-completedF)�
which_jobs�refresh_all)�
get_activer�rr�)r$�toggletoolbuttonr�s   r%�on_show_completed_jobs_clickedz(JobViewer.on_show_completed_jobs_clickedsR���&�&�(��J�(�J������
���F��?�?��O�O�#�#�z�u�#�M�r'c����tj�}d}�jj�D�]U\}}td�}d|v�r|d}||z
}d}|dkrtd�}n�|dkrt	|dz�}td	�|z}n�|d
kr.t	|dz�}	|	dk(rtd�}n�td
�|	z}n�|dkr.t	|d
z�}
|
dk(rtd�}nmtd�|
z}n^|dkr.t	|dz�}|dk(rtd�}n:td�|z}n+d}tj
dtj|��}|�jvs��*�j|}�jj|d|���X|r.�js"�fd�}
tjd|
�}|�_
|s2�jr&tj�j�d�_
|S)NF�Unknownr�T�xza minute agoi�<z%d minutes agoi�Qr{zan hour agoz%d hours agoi�:	�	yesterdayz%d days agoi_7z	last weekz%d weeks agoz%B %Yc�x��tj��j�}tj�|Sr)�r�
threads_enter�update_job_creation_times�
threads_leave)�retr$s �r%�update_times_with_lockingzFJobViewer.update_job_creation_times.<locals>.update_times_with_locking2s.����!�!�$��4�4�7���!�!�$��
r')�timer$r6r�r��strftime�	localtimer%rl�	set_valuer.r�timeout_add_secondsr�)r$�now�need_update�job�data�t�created�ago�mins�hours�days�weeks�iterr�s`             r%r�z#JobViewer.update_job_creation_times	s�����i�i�l���������*�#	2�I�C���)��A�!�T�)��1�2���G�m��"����<��.�)�A��7�]���b��>�D��*�+�d�2�A��<�'�����1�E���z��m�,���n�-��5���+�+���|� 4�5�D��q�y��k�N���m�,�t�3���/�/���(8�!9�:�E���z��k�N���n�-��5��"'�K��
�
�w�����0H�I�A��d�m�m�#��}�}�S�)���
�
�$�$�d�A�q�1�G#	2�J�t�<�<�
��(�(�"�.G�H�A�,-�D�)���,�,��"�"�D�$A�$A�B�04��-��r'c� �|j�|j�|jj|�|tj
jk(r6d|jvr'ddl}|j|j�}||_yyy)N�troubleshooterr)r|rvr(�removerr�r��__dict__�troubleshoot�run�on_troubleshoot_quitr	)r$r�r��jobidrr	s      r%�print_error_dialog_responsez%JobViewer.print_error_dialog_responseCst����������� � �'�'��/��s�'�'�*�*�*��t�}�}�4�#�!-�!1�!1�4�3L�3L�!M��&4��#�5�+r'c��|`yr))r	)r$r	s  r%rzJobViewer.on_troubleshoot_quitNs���r'c����j|||��|�jvry�j}�jjd�}|j	|d|�td|z�|�j|<�jj�}|��|\}}�jj�dtjjfk(rI|tjd�k(r1�jjtj�dddd��js�fd�}	t!j"d|	�yy)	NrNrzJob %d addedr{Fr�c�v��tj��j�tj�y�NFr�r#s�r%�!start_updating_job_creation_timesz<JobViewer.add_job.<locals>.start_updating_job_creation_timesks*����!�!�$��.�.�1��!�!�$�r'i�)�
update_jobr$rlr]r�r�r%r��get_visible_range�get_sort_column_idrrnro�TreePath�scroll_to_cellr.r�timeout_add)
r$r�r�rOrlrr��start�endrs
`         r%�add_jobzJobViewer.add_jobQs�������d�z��:��d�i�i����
�
���z�z� � �$�'��
����q�#�&��N�S�(�)�!��
�
�c���
�
�/�/�2���� �L�U�C��
�
�-�-�0�Q�58�\�\�5L�5L�5N�N�����a��(��
�
�,�,�c�l�l�n�d�.3�S�#�?��,�,�
�
���c�#D�E�-r'c��|jj�|jr|jj�yyr))r��updater�r#s r%�update_monitorzJobViewer.update_monitorss.���������?�?��O�O�"�"�%�r'c	��|jt|j��z
}||jvr|j	|�|rzd}	|�6tj|j|j|j��}td|z�t|�}|j||��}|r|j!|�||j"|<d}	|j%dt
j&�}t)|�}|t
j*t
j,fvr�gd�}	ddg}
|j%d	�}t/j|j0|j|j|j��}|j3||
�
�}	|d}
t7|
t�s|
g}
|
|d<|j!|�|j||	��}|j!|�|j%dt
j&�}t)|�}	|d=|j:j=�t
j*k(xr|j%dd�dk(}|rM|j?||j%d�|j%d	�|j%dg�|j@�d|_!|jE�y#t$rY��t$rY��#t
j$rYywxYw#t4$rtd�dd
g}
Y��qwxYw#t8$rY��	t$rY��t
j$rY��)wxYw#t4$rY��5wxYw)N�r�rr�z
requesting %srpFr�)r��job-hold-untilr�r��
device-urir�rn�1No auth-info-required attribute; guessing instead�username�password�_status_textr$�none)#�required_job_attributesrgrbr&�update_job_attributes_viewerrPrQr�rr�r�r:�getJobAttributesrR�AttributeErrorrrr r$�get�IPP_JOB_PROCESSINGr��IPP_JOB_HELD�IPP_JOB_STOPPED�authconnr�rqrW�
isinstance�
ValueErrorr��
queue_draw�get_authenticationr�submenu_set�update_sensitivity)r$r�r�rOrsr7�job_requires_auth�jstater��jattrs�pattrsrrT�auth_info_requireds              r%rzJobViewer.update_jobxs6���(�(�3��	�	��+=�=���$�/�/�!��-�-�c�2���E�
��%�!%���t�y�y�7;�y�y�=A�_�_�"N�J��O�a�/�0��!�H��"�3�3�S�JK�4�M������U�#���	�	�#��!��+	��X�X�{�D�,C�,C�D�F��V��A��T�&�&��(<�(<�=�=�K��.��=���h�h� 1�2���'�'����.2�i�i�.2�i�i�48�O�O�E���.�.�c�EK�/�M��B�).�/C�)D�&�"�#5�t�<�*<�)=�&�2D�E�.�/����U�#��*�*�C�AG�+�I�����U�#����;��0G�0G�H����L��	��^�$�	
�
�
� � �#��$�"3�"3�3�2�!�X�X�'7��@�1�2�	��
�#�#�S�$�(�(�L�*A�%)�X�X�/@�%A�%)�X�X�/C�R�%H�%)�[�[�
2�
!������"��a �
��!�
���=�=�
��
��@ �B��!3�4�*4�j�)A�&�B�� �	���	���}�}�	��	���	��	�su�A$J;�B:L	�K*�A8L	�
L9�;	K'�K'�K'�&K'�*L�L	�L�L	�		L6�L6� L6�5L6�9	M�Mc��||jv�rw	tjd�t}t�}d}|r�d|vr�tjj|�\}	}
|	dk(r;tj|��}|j�\}}
}}}t|�|d<nItjj|
�\}}
|�d}
n"tjj|�\}
}|	�|
�d}n4|jt|
j!��t|	�d��||j"vrd}d	t|�i}|�rd|v�r
||fD]�}t�}|j%�D]\}}||i}|j|��t'�}|j)�}t+||�}|j-�}|s�s|D�cgc]}d
��}}|j/d�}|dj1�j3d
�||<|j/d�}|dj5�j3�j7�||<ntd�|rB	t9j:|j<|j>|j@|jB��}|ry|�w	jGtId��|jK||�|jM�|jO�td|z�|j"jQ|�y|ro|rltWjXt[j\��d} |j_�}|j|�t| �|d
<|ja||�yyyy#td�YyxYwcc}w#tD$rd}Y��wxYw#tjR$rjM�tU�YyjM�tU�Y��xYw)Nz1.9.37z;Authentication required but authenticateJob() not availabler(�smb)rrF)rrr�r'rrz!Failed to find secret in keyring.r#�authenticating jobz"Automatically authenticated job %d)1r-rP�requirer��
USE_SECRET�dict�urllib�parse�	splittype�smburi�SMBURI�separaterk�	splithost�
splitnportr �lowerr1r6rr*r0r9�index�get_attributesr/�
get_secret�decoder3rQr�r�rr�rRr�r��authenticateJobr�r!r�rr�nonfatalException�pwd�getpwuid�os�getuidr��display_auth_info_dialog)!r$r��
device_uri�printer_urir>�show_dialog�
try_secret�informational_attrs�	auth_info�scheme�restr�groupr�sharerr(�
serverportr�identifying_attrs�
keyring_attrsr7�key�val�key_val_dict�service_objr"�
search_objr6r�indrTr's!                                 r%r7zJobViewer.get_authentication�s����d�,�,�,�
����h�'�$�J�"&�&���I��j�,>�>�!'���!7�!7��!D�����U�?� �-�-�Z�8�C�'*�|�|��%�U�F�E��8�47��K�'��1�)/���)?�)?��)F�&�Z��!�)�!%��)/���)@�)@�*�)M�����>�V�^�!&�J�'�.�.�C�����<Q�=@�&�\�1K�L��d�-�-�-�"�
�#(��k�):� <���j�,>�>�&7�9L�%M�E�M� �F�E�$1�$7�$7�$:�4���S�(+�c�{�����l�3�4�#-�,�K�)�5�5�7�G�!+�G�U�!;�J�&�0�0�2�E��1C�$D�A�R�$D�	�$D�0�6�6�
�C��).�q��)@�)@�)B�)F�)F�v�)N�	�#��0�6�6�
�C��).�q��)<�)<�)>�)B�)B�)D�)K�)K�)M�	�#���%E�(� C�D��'� �+�+�T�_�_�26�)�)�26�)�)�8<���I�A��i�3�)��&�&��*>�(?�@��%�%�s�I�6��$�$�'��'�'�*�� D�s� J�K��+�+�/�/��5��"�k��<�<�����6�q�9�� 3� 8� 8� :�
��$�$�%6�7�(+�X��
�f�%��-�-�s�M�B�'2�!�{-��
��>�?���f%E�� $�'�!&�J�'���}�}���$�$�'�%�(��)��$�$�'�%�(�s7�N�	N�AN�A5N1�
N�N.�-N.�1-O=� O=c	���|j|}	|d}tj|t
��}||_||_|jtjj�|D�cgc]}d��}}tjtj��d}d|vr(	|j!d�}	|||	<|j#|�d}
|D]"}||
dk(r|j'|�n|
dz
}
�$|j)t+d	�|j-d
t+d��|fz�||j.|<|j1d|j2�|j1d
|j4�||_|j9�|j;d�|j=�y#t$rtd�ddg}Y���wxYwcc}w#t%�Y��xYw)Nr�r&r'r()r>�allow_rememberrArr{z;Authentication required for printing document `%s' (job %d)r�r�r�r�T)r$rWr�r3�
AuthDialogrDrfr>r�rr��CENTERrUrVrWrXrO�
set_auth_inforT�field_grab_focus�
set_promptr�r/r-r��auth_info_dialog_response�auth_info_dialog_delete�job_idr��set_keep_above�show_now)r$r�rfr�r>r�rr_r'rlrO�fields            r%rYz"JobViewer.display_auth_info_dialogEs����y�y��~��	:�!%�&:�!;��
�$�$�9K�5?�A��,���$6��!����S�/�/�6�6�7�"4�4�A�R�4�	�4��<�<�����.�q�1���+�+�
%�(�.�.�
�;��!)�	�#���$�$�i�0�
��'�	�E����2�%��'�'��/���Q�J�E�		�	���1�?�@� �H�H�Z��9��>��!�!�	"�'-����s�#����
�D�$B�$B�C������(D�(D�E���
��������t�$������O�	:��+�
,�",�j�!9��	:��5��
%�!�$�s#�F.�,	G
�&'G�.G
�	G
�G!c�X�|j|tjj�yr))rtrr��CANCELr�s   r%ruz!JobViewer.auth_info_dialog_deleters���&�&���0@�0@�0G�0G�Hr'c��|j}|j|=|tjjk7r|j�y|j
�}	tj|j|j|j|j��}d}|jt!d��	|j#||�|j%�}|j&j)|�|j+�|j5�|r�	t7|dd�}	t7|dd�}
|	��|
��	|
j9d�}|||	d<|	j=d��d	|	j=d
��d|	j=d��d
�}|
j9d�}||}
t?�}|	jA�D]\}}||i}|jC|��tE|||
�}tdtF|fz�|j�y#t$rtd�YywxYw#t,j.$r,}|j0\}}|j3||�Yd}~��Vd}~wwxYw#t:$rY��wxYw#tI�Y��xYw)Nr#z+Error connecting to CUPS for authenticationFrBrfr>r'r�@rz (r�)r(zkeyring: created id %d for %s)%rvr-rr��OKrv�
get_auth_infor3rQr�r�rr�rRr�r�r�rS�get_remember_passwordr1r�r!rPrrr�r�r�r�rO�
IndexErrorr/rEr6r r<�idrT)r$r�r�rr_rT�rememberr�r�rfr>rlrArBr7rgrhri�password_objs                   r%rtz#JobViewer.auth_info_dialog_responseusr���
�
���"�"�5�)��s�'�'�*�*�*��N�N����(�(�+�	�	��#�#�T�_�_�*.�)�)�*.�)�)�04���A�A���	���A�2�3�4�	'�
���u�i�0��3�3�6�H��#�#�'�'��/����"�
	
�����
%� '��)8�)-�!/�
�&-�f�.B�.2�&4�"�!�,�1C�1O��0�6�6�
�C��09�#��
�f�-�,9�+<�+<�f�+E�+8�+<�+<�h�+G�+8�+<�+<�j�+I�K�D�-�2�2�J�?�C�&�s�^�F� �F�E�$1�$7�$7�$:�4���S�(+�c�{�����l�3�4�$1��15�17�$9�L�� ?�2�t�*� L�M�	�����a�	��E�F��	���}�}�	'��V�V�F�Q������A�&�&��	'��$&����� 
%�!�$�s]�AH�7A
H �I2�6I"�B&I2�H�H� I�3!I�I�"	I/�+I2�.I/�/I2�2Jc�8�|jsy|jrd|_yt|jj	��}|t|j
j	��z
}|jj�D]\}}t|dd�dk7s�|dz
}�t|j�}td|z�td|z�td|jz�|jry|jjd�|jj|dkDxs||jkD�|j rLt#j$�r7t#j&�|j rt#j$�r�5yyyy)	NFr�Tr{zopen notifications: %dznum_jobs: %dznum_jobs_when_hidden: %dr)rr r�r/rbr0r,r6r�r'r�r*r#r��set_has_tooltipr�r�r�events_pending�main_iteration)r$�open_notifications�reasonr��num_jobss     r%�set_statusicon_visibilityz#JobViewer.set_statusicon_visibility�sl���{�{���"�"�',�D�#�� �$�"@�"@�"E�"E�"H�I���c�4�#C�#C�#H�#H�#K�L�L��$(�$C�$C�$I�$I�$K�	(� �F�L���h��5��=�"�a�'�"�	(���(�(�)���,�/A�A�B��N�X�-�.��.��1J�1J�J�K��&�&��
	
���'�'��/����#�#�%7�!�%;�&J�%-��0I�0I�%I�	K��)�)�c�.@�.@�.C����!��)�)�c�.@�.@�.C�)�.C�)r'c��tjtjj�}|j	||d�yr)r�Event�	EventType�NOTHING�show_treeview_popup_menu�r$r�r�s   r%ryz JobViewer.on_treeview_popup_menu�s,���	�	�3�=�=�0�0�1���%�%�x���:r'c�^�|jdk(r|j|||j�yy)N�)�buttonr�r�s   r%rxz*JobViewer.on_treeview_button_release_event�s)���<�<�1���)�)�8�U�E�L�L�I�r'c	�	�|�|jj�}|j�\}}|jj	d�}|jj	d�}|jj	d�}|jj	d�}|jj	d�}|jj	d�}	|jj	d�}
|jj	d�}|jj	d	�}t|�d
k(r"||||||	||
|f	D]}
|
j
d��yd}d}d}d}d}d}|jj�}t�}g|_
|D�]?}|jj|�}|jj|d
�}|jj|�|j|}d
|vrX|d
}|t j"k\rd}|t j$k7rd}|t j&k7rd}|j)dd�sd}|j)d
t j"�t j&k7s|j)dd�dk7rd}|j)dd�}|s��	|jj+|�}|||<��Bt|j/��dk(r,	|j1t3|j/��d
�t|�d
kDr�t5j6�}t3|�}|j9�|D]�}	|jj;|�}t5j<|��}|j
|du�|j?�|jA||jB|�|j|���|jDjG|�d}|j
|�|j
|�|j
|�|j
|�|j
|�|	j
|�|j
|�|
j
|�|j
d�y#t,$r|}Y���wxYw#t,$rY���wxYw#t,$rd}Y��QwxYw)Nz/cancel-jobz/delete-jobz	/hold-jobz/release-jobz/reprint-jobz
/retrieve-jobz/authenticate-jobz/job-attributesz	/move-jobrFTr�r�r$r*r�r�r{r�)$r�rr�get_selected_rowsrIrRr�rS�printer_uri_indexrirEr�rl�get_iter�	get_valuer]r$rP�IPP_JOB_CANCELED�IPP_JOB_PENDINGr1r/rerWrbr
r:rrO�sortrk�MenuItemrW�_submenu_connect_hack�on_job_move_activaterUrV)r$rs�model�pathlist�cancel�delete�hold�release�reprint�retrieve�authenticate�
attributes�mover��cancel_sensitive�hold_sensitive�release_sensitive�reprint_sensitive�authenticate_sensitive�move_sensitive�other_printers�job_printers�pathrrr�r�rr�
printers_menu�menuitems                               r%r9zJobViewer.update_sensitivity�s������
�
�3�3�6�I�%�7�7�9�����$�$�/�/��?���$�$�/�/��?���"�"�-�-�{�;���%�%�0�0�.�A���%�%�0�0�.�A���&�&�1�1�?�C���*�*�5�5�7J�K���(�(�3�3�5F�G�
��"�"�-�-�{�;����>�Q��!�6�4��'�8���z�;�
-���$�$�e�,�
-�
����� �� ��!%�����/�/�A�A�D���v������	,�D��:�:�&�&��-�D��J�J�(�(�$��2�E��K�K���u�%��)�)�E�"�C��c�!���$����-�-�-�',�$���,�,�,�%*�N���)�)�)�(-�%������7�(-�%������.�.�0�37�3D�3D�E����)�6�2�6J�J�).�&��'�'�,�d�3�C��"�"�4�4�;�;�S�A�G�),��W�%�9	,�<��!�!�$�%��*�
��%�%�t�L�,=�,=�,@�'A�!�'D�E����!�#��H�H�K�M�!�>�2�N����"�)�
0����0�0�F�F��P�C��<�<�w�7���&�&��4��8��
�
� ��*�*�H�,0�,E�,E�,/�1��$�$�h�/�
0�
�"�"�.�.�
�>�!�N����-�.����!1�1�2����>�*����/�0����/�0����0�1����N�+��"�"�#9�:�� � ��&��M �"�!�G�"���
��
�� ���C��s6�,R�,+R(�R8�R%�$R%�(	R5�4R5�8S�Sc�&�|j|�yr))r9)r$rss  r%rwzJobViewer.on_selection_changed@s������+r'c	�`�|jjdddd||j��yr))rP�popup�get_time)r$r�r��event_buttons    r%r�z"JobViewer.show_treeview_popup_menuCs*�����#�#�T�4��t�\�%*�^�^�%6�	8r'c�D�|jjdddd||�yr))r�r�)r$rr�r�s    r%r�zJobViewer.on_icon_popupmenuHs ���!�!�'�'��t�T�4���Nr'c�t�t|jj��|_|j	�yr))r�r$rbr*r��r$r�s  r%�on_icon_hide_activatezJobViewer.on_icon_hide_activateKs&��$'������):�$;��!��&�&�)r'c���i}tjj�D]\}}|dk(r�|||<�tjdgd|��}tjd|j|�y)N�SYSTEM_CONFIG_PRINTER_UIzsystem-config-printerT)�	close_fds�env�
)rW�environr6�
subprocess�Popenrr��poll_subprocess)r$r�r�rA�value�ps      r%�#on_icon_configure_printers_activatez-JobViewer.on_icon_configure_printers_activateOsq�����:�:�+�+�.�	�K�D�%��1�1���C��I�	�
��� 7�9�(,�#�
7��� � �"�d�&:�&:�A�>r'c�*�|j�}|duSr))�poll)r$�process�
returncodes   r%r�zJobViewer.poll_subprocessYs���\�\�_�
��T�!�!r'c�r�|j�|jr|jj�yyr))r�rr�r�s  r%�on_icon_quit_activatezJobViewer.on_icon_quit_activate]s%�������9�9��I�I�N�N��r'c�&�|jd�yr��on_job_cancel_activate2r�s  r%r9z JobViewer.on_job_cancel_activatebs���$�$�U�+r'c�&�|jd�y)NTr�r�s  r%r;z JobViewer.on_job_delete_activatees���$�$�T�*r'c�H�|jr�t|j|j|j|j
|j|�}|jj|�|jd|j�|jd|j�yy)Nryrx)r�rur�r�rr�r2r]r��on_canceljobs_finished�on_canceljobs_error)r$r�r�s   r%r�z!JobViewer.on_job_cancel_activate2hsr���;�;�$�d�o�o�t�y�y�$�)�)�&*�o�o�t�{�{�I�O�B��H�H�O�O�R� ��J�J�
�D�$?�$?�@��J�J��T�%=�%=�>�r'c��|j�|jj|�}|j|=|j�yr))rvr2rOr!)r$�canceljobsoperation�is   r%r�z JobViewer.on_canceljobs_finishedps8���#�#�&��H�H�N�N�/�0���H�H�Q�K����r'c���|j�t|�tjk(rH|j\}}|tj
k7r%|tjk7r|j||�y|�r))r!r[rPrrr�r�r�r�)r$r�rr�r�r�s      r%r�zJobViewer.on_canceljobs_errorvs_��������:����&��X�X�F�Q���T�*�*�*��T�'�'�'��#�#�Q��*���	r'c�t�	tj|j|j|j|j
��}|jD]?}|jtd��	|j|d�|j%��A~|j#�y#t$rYywxYw#tj$rr}|j\}}|tjk7r%|tjk7r|j!||�|j#�|j%�Yd}~yd}~wwxYw)Nr#zholding job�
indefinite�r3rQr�r�rr�rRr�r�r��setJobHoldUntilrPrrr�r�r�r�r!r��r$r�rTrr�r�s      r%r=zJobViewer.on_job_hold_activate�s��	��#�#�T�_�_�*.�)�)�*.�)�)�04���A�A��[�[�	 �E�
����-� 0�1�	
��!�!�5�,�7�
����	 �
������%�	��	���=�=�
������A���.�.�.���+�+�+��'�'��A�.��#�#�&�� � �#���
��+�AB#�-B2�#	B/�.B/�2D7�A'D2�2D7c�t�	tj|j|j|j|j
��}|jD]?}|jtd��	|j|d�|j%��A~|j#�y#t$rYywxYw#tj$rr}|j\}}|tjk7r%|tjk7r|j!||�|j#�|j%�Yd}~yd}~wwxYw)Nr#z
releasing jobzno-holdr�r�s      r%r?z!JobViewer.on_job_release_activate�s��	��#�#�T�_�_�*.�)�)�*.�)�)�04���A�A��[�[�	 �E�
����/� 2�3�	
��!�!�5�)�4�
����	 �
������%�	��	���=�=�
������A���.�.�.���+�+�+��'�'��A�.��#�#�&�� � �#���
�r�c��	tj|j|j|j|j
��}|jD]}|j|��~|j�y#tj$r;}|j\}}|j||�|j�Yd}~yd}~wt$rYywxYw)Nr#)r3rQr�r�rr�r��
restartJobrPrrr�r�r!rRr�s      r%rAz!JobViewer.on_job_reprint_activate�s���	��#�#�T�_�_�*.�)�)�*.�)�)�04���A�A����
%�����e�$�
%��	
������}�}�	��V�V�F�Q������A�&����"����	��	�s�A$A7�7C�
1C�C�Cc���	tj|j|j|j|j
��}|jD�]b}	|j|�}|d}	|d}td|dz�D�]/}|j|||�}|jd�}	|jd�}
|jd	d
�}|
�utd�t|�z}
|dk(r|
d
z}
nS|jd�dk7r|
|j!dd
�z}
n)|jd�dk7r|
|j!dd�z}
|	��_t#j$td�|jt"j&j(��}|j+t"j,t"j.j0t"j2t"j.j4�|j7|
�|j9d�|j;�}
|
t"j.j4k(r(|j=�}	t?j@|	|�n|
t"j.j0k(r	|jI�tKjL|	���$tGd�y��e~|jW�y#t$rYywxYw#t$r|jdd�}Y���wxYw#tBt>jDf$rtGd|z�Y��wxYw#tNjP$r<}|jR\}}|jU||�|jW�Yd}~yd}~wwxYw)Nr#r�znumber-of-documentszdocument-countrr{�filez
document-namezdocument-formatrA�	retrievedzapplication/postscriptz.pszapplication/vnd.r�zapplication/vndzapplication/�.z	Save File)r|r}r�TzUnable to save file z%Unable to retrieve file from job file),r3rQr�r�rr�rRr�r-rWr/r��getDocumentr�rk�find�replacer�FileChooserDialog�FileChooserAction�SAVEr�r8r�r{�
STOCK_SAVEr�set_current_name�set_do_overwrite_confirmationr
�get_filename�shutil�copyfile�IOError�Errorr�rvrW�unlinkrPrrr�r�r!)r$r�rTrr7r[�document_count�document_number�document�tempfilerA�formatr�r��file_to_saver�r�s                 r%rCz"JobViewer.on_job_retrieve_activate�s��	��#�#�T�_�_�*.�)�)�*.�)�)�04���A�A��[�[�8	�E�7
��(�(��/��!�"3�4��E�%*�+@�%A�N�(-�Q��q�0@�'A�)�O��]�]�;���O�H�'�|�|�F�3�H�#�<�<��8�D�%�\�\�*;�R�@�F��|� ��~�c�/�.B�B��!�%=�=�#'�%�<�D�#�[�[�);�<��B�#'�&�.�.�9J�B�*O�#O�D�#�[�[��8�B�>�#'�&�.�.���*M�#M�D��+�!$�!6�!6�a��n�:>�/�/�36�3H�3H�3M�3M�"O���*�*�$'�$4�$4�c�6F�6F�6M�6M�$'�N�N�C�4D�4D�4G�4G�I��/�/��5��<�<�T�B�#)�:�:�<��#�s�'7�'7�':�':�:�+1�+>�+>�+@�L�P� &����,� G�&��)9�)9�)@�)@�@� ����(��	�	�(�+�"�#J�K��S)�8	�t
������}�	��	�� �E�%*�Y�Y�0@�!�%D�N�E��H%,�V�\�\�#:�P� *�+A�,�+N� O�P���=�=�
������A��#�#�Q��*��#�#�&���	
�sz�AK�L%�+K�0GL%�K8�AL%�1L%�	K�K�K5�1L%�4K5�5L%�8'L"�L%�!L"�"L%�%M4�81M/�/M4c�����tjd��d���fd�	}|jd|�|jd|�fS)Nr{c�X���jd�rtj�|g����yyr)�acquirer�idle_add)r�r�r��callback�	only_onces  ���r%�handle_eventz5JobViewer._submenu_connect_hack.<locals>.handle_events+���� � �%�(�� � �(�D�8�4�8�)r'zbutton-press-eventrr))�	threading�	Semaphorer�)r$r�rr�rrs  `` @r%r�zJobViewer._submenu_connect_hacksA����'�'��+�	�	9����2�L�A����j�,�7�9�	9r'c��	tj|j|j|j|j
��}|jD]}|j||���~|j�y#tj$r;}|j\}}|j||�|j�Yd}~yd}~wt$rYywxYw)Nr#)rv�job_printer_uri)r3rQr�r�rr�r��moveJobrPrrr�r�r!rR)r$r�r
rTrr�r�s       r%r�zJobViewer.on_job_move_activates���	��#�#�T�_�_�*.�)�)�*.�)�)�04���A�A����
J���	�	�%��	�I�
J��	
������}�}�	��V�V�F�Q������A�&����"����	��	�s�A&A9�9C�1C�C�Cc��	tj|j|j|j��}dg}ddg}|jD]c}|j||��}|jd�}|j||��}	|d}	|j||jd�||	d��ey#t
$rYywxYw#t$rtd�d	d
g}	Y�PwxYw)Nr#Fr�r�r%rprnr&r'r(T)
rPrQr�rr�rRr�r-r/rqrWr�r7)
r$r�rT�
jattrs_req�
pattrs_reqrr<rr=r>s
          r%rDz&JobViewer.on_job_authenticate_activate,s
��	����d�i�i�&*�i�i�,0�O�O�=�A�(�(�
�*�L�9�
��[�[�	D�E��'�'��>H�(�J�F��*�*�/�0�C��+�+�3�BL�,�N�F�
>�%+�,@�%A�"�
�#�#�U�F�J�J��,E�%(�*<�d�
D�	D��
�	��	���
>��/�0�&0�*�%=�"�
>�s#�6B2�C�2	B>�=B>�C�Cc��|jj�|jr|jj�|j�yr))r�rr�r�)r$�
toolbuttons  r%�on_refresh_clickedzJobViewer.on_refresh_clickedHs5���������?�?��O�O�#�#�&��&�&�)r'c� �	tj|j|j|j��}|jD�]�}||jvs�tj�}tjt|���}|jj||�}tj�}|j|�tj �}|j#dt%d�|d��tj �}|j#dt%d�|d��tj&tt�}	|j)|	�|j+�j-tj.j0�|	j3dtj4j6�|	|f|j|<|j9||�	����|j:j=�y
#t
$rYywxYw)z> For every selected job create notebook page with attributes. r#Fr�r�Namer�r{�Value)�connN)rPrQr�rr�rRr�r&r�ScrolledWindowr�rkr��append_page�TreeViewr�r`�insert_column_with_attributesr��	ListStorerprrrtru�NONErmrn�	ASCENDINGr,r�r�)
r$r�rTr�scrolledwindowr��
page_index�
attr_treeviewr��
attr_stores
          r%rEz$JobViewer.on_job_attributes_activateOs���	����d�i�i�&*�i�i�,0�O�O�=�A��[�[�	B�E��D�O�O�+�!$�!3�!3�!5���	�	��E�
�3��!�]�]�6�6�~�u�M�
� #����
��"�"�=�1��+�+�.���;�;�A�q��y�<@�q�<�J��+�+�.���;�;�A�q��z�<@�q�<�J� �]�]�3��4�
��'�'�
�3��+�+�-�6�6�s�7H�7H�7M�7M�N��-�-�q�#�,�,�2H�2H�I�*4�j�)A�����&��1�1�5�q�1�A�'	B�*	
�!�!�*�*�-��1�	��	�s�6H�	H
�H
c�(�|�|}n7	tj|j|j|j��}||jvrn|j|\}}	|j|�}|j�|j�D]&\}}|dvr�|j|t|�g��(yy#t
$rYywxYw#t$rYytj$r+|jj|�|j|=YywxYw)z* Update attributes store with new values. Nr#F)zjob-idzjob-printer-up-time)rPrQr�rr�rRr&r-r.rrr�r��clearr6r]rk)	r$rrrTr r�r7rAr�s	         r%r,z&JobViewer.update_job_attributes_vieweros�����A�
��O�O�$�)�)�*.�)�)�04���A���D�O�O�#�!%����!7��Z��	
��*�*�5�1��
����$�{�{�}�
6���e��<�<���!�!�4��U��"4�5�
6�$�� �
��
��"�
���=�=�
��
�
�)�)�$�/��O�O�E�*��
�s)�6B:�C	�:	C�C�		D�:D�Dc�l�|jdtj�}|tjk\ryy)Nr�FT)r/rPr�)r$�jobdata�states   r%�
job_is_activezJobViewer.job_is_active�s,�����[�$�*?�*?�@���D�)�)�)��r'c
���d}|�o|j�c|jj�}d}|jj|g�D]}||jk(s�|j}n|�d|_|�.|jj|g�D]}|�|}�||kDs�|}�|��|j	�}|t
jkDr�t
j|}|j�}	tjj�}|j|dd�}	|	j||j�dz|j�dz|	j�dz|	j�dz|j�dz|j�dzddt j"j$d�|S|S#t&j($rt+d|z�Y|SwxYw)NFrr�g�?�r	)�worst_reason�get_printerr)r/�	get_levelr�REPORT�
LEVEL_ICONr�rrr�rr�r�r�rr�r�rr
r�)
r$rrr*�foundr��levelrr�emblems
          r%�add_state_reason_emblemz!JobViewer.add_state_reason_emblem�s������?�t�0�0�<��'�'�3�3�6�G��E��4�4�8�8�'�2�F�
���T�.�.�.�#'�#4�#4�L��
��#�$(��!����4�4�8�8�'�2�F�
*���'�#)�L��l�*�#)�L�	
*��#� �*�*�-�E��{�)�)�)�"�-�-�e�4�������
?��M�M�5�5�8�E�"�_�_�d�B��:�F��$�$�f�&,�&6�&6�&9�A�&=�&,�&7�&7�&:�Q�&>�&,�&6�&6�&9�A�&=�&,�&7�&7�&:�Q�&>�&,�&6�&6�&9�A�&=�&,�&7�&7�&:�Q�&>�&)�3�&/�&:�&:�&C�&C�S�J��
�v�
���~�~�?�� 6�� =�>��
�?�s�.C
F<�<!G!� G!c��|jsy|�&t|jj��dkD}|rp|j}|jj�D]F\}}|j
dtj�}|tjk(s�:|j}nn|j}	|j|�}|S#t�Y|SxYw)Nrr�)rr�r$rbr�r6r/rPr�r0r�r�r2rT)r$�	have_jobsrrr$r;s      r%�get_icon_pixbufzJobViewer.get_icon_pixbuf�s����{�{�����T�Y�Y�^�^�.�/�!�3�I���^�^�F�"&�)�)�/�/�"4�
���w� ���k�4�3G�3G�H���T�4�4�4�!�6�6�F��	
��&�&�F�	!��1�1�6�:�F��
��	!�� ��
�s�5C�Cc���|jsy|�Et|j�}|dk(rtd�}n|dk(rtd�}ntd�|z}|jj|�y)NrzNo documents queuedr{z1 document queuedz%d documents queued)rr�r$r�r��set_tooltip_markup)r$�tooltipr�s   r%�set_statusicon_tooltipz JobViewer.set_statusicon_tooltip�sd���{�{���?��D�I�I��H��1�}��1�2���Q���/�0���1�2�X�=�����*�*�G�4r'c�v�t�}|jj�D]%\}}t|�dkDs�|j	|��'td|z�t�}t|�rQt�}|jD]*}|j|d}||vs�|j	|��,td|z�g}|D] }|j|j|��"d|_	t|�dkDr)|d}|D]
}	|	|kDs�	|	}�||_	td|z�tj�|jjd�|j�:|jj�\}
}|jjd|�n�d}d}d}
d}|jD]G}	|j|d}|t"j$k(r|
dz}
�/|t"j&k(s�C|dz}�I|
dkDs|dkDr,t)d	�|
|fz}|jjd|�|j*r[|j,sO|j/|�
�}|j0j3|�|j5�|j7|��tj8�y#t $rY��wxYw)NrzUpset printers: %s�job-printer-namezMy upset printers: %szWorst reason: %srAr�r{zprocessing / pending:   %d / %d�r4)r8)rgr)r6r�r�r�r'r$r\r*rr�r��pop�get_description�pushrWrPr0r�r�rr#r5r�r�r�r9r�)r$r4�upset_printersr�reasons�my_upset_printersr�
my_reasonsr*r�r|r8�status_message�
processing�pending�	job_staters                 r%�
update_statuszJobViewer.update_status�s������ $� :� :� @� @� C�	-��G�W��G�}�q� ��"�"�G�,�	-�	�(�>�9�:��E����� #����)�)�
4���)�)�E�*�+=�>���n�,�%�)�)�7�3�	
4�

�/�2C�C�D��
�(�	D�G����t�9�9�'�B�C�	D�!����
��a��%�a�=�L�$�
*���L�(�#)�L�
*�!-�D���*�\�9�:����������A�����(�#�0�0�@�@�C��U�G��N�N����G�,��G��N��J��G��)�)�
*��� $�	�	�%� 0�� =�I��� 7� 7�7�!+�a��J��$�"6�"6�6�%��k�G�
*��a��W�q�[�!"�#D�!E��U\�H]�!]�����#�#�A�~�6��;�;�t�:�:��)�)�Y�)�?�F��O�O�+�+�V�4��*�*�-��'�'��'�9������! ����s�3J+�+	J8�7J8c��|j�}|tjkrygd�}|j�|vry|j	|�y)N)�otherzcom.apple.print.recoverable�connecting-to-devicezcups-remote-pendingzcups-remote-pending-heldzcups-remote-processingzcups-remote-stoppedzcups-remote-canceledzcups-remote-abortedzcups-remote-completedzcups-waiting-for-job-completed)r,r�WARNING�
get_reason�notify_printer_state_reason)r$r�r0�	blacklists    r%�(notify_printer_state_reason_if_importantz2JobViewer.notify_printer_state_reason_if_important(sL��� � �#���;�&�&�&���	�8����9�,���(�(�&�1r'c�.�|j�}||jvrtdt|�z�y|j	�}|t
jk(s|j�dk(rtjj}ntjj}|j�\}}tjj||d�}d|_|j!|�|j"r|j%tj&�|j)d|j*�||j|j�<|j-�	|j/�y#t0j2$r
t5�YywxYw)Nz Already sent notification for %srKrTr�)�	get_tupler,r�r�r,r�ERRORrMr�Urgency�NORMAL�LOWr>�Notificationr��
user_notified�set_urgencyr"�set_timeout�
EXPIRES_NEVERr��#on_state_reason_notification_closedr�rWrr
rT)r$r��tupler0�urgencyr|rr�s        r%rNz%JobViewer.notify_printer_state_reasonOsG��� � �#���D�3�3�3��:�T�6�]�J�K��� � �#���[�&�&�&���� �$:�:��n�n�+�+�G��n�n�(�(�G��.�.�1�
����*�*�.�.��t�Y�G��#���� � �'�*��"�"��$�$�f�&:�&:�;����h�"�F�F�	H�?K��'�'��(8�(8�(;�<��&�&�)�	!���� ���~�~�	!�� �	!�s�#E4�4F�Fc�`�tdt|�z�d|_|j�y)NzNotification %s closedT)r�r�r�r�)r$r�r�s   r%r\z-JobViewer.on_state_reason_notification_closedks,���,�t�\�/B�B�C�"����&�&�)�r'c��|jj|i�}|jdtd��}|jd�}|��|jd�}|�idg}tj|j
|j|j|j��}	|j||��}|jd�}|�'tjj|�\}	}
|	dvry|jdtd��}tj j#td	�td
�||fzd�}|j%tj&j(�|j+d|j,�||_||j0|<|j3�	|j5�y#tj$rYywxYw#t6j8$r
t;�YywxYw)
Nr�r�r�r%r#rn)�socket�ipp�httpr@r;zDocument printedz1Document `%s' has been sent to `%s' for printing.rr�)r$r/r�r3rQr�r�rr�rqrPrrrFrGrHrrWr�rYrTrVr��$on_completed_job_notification_closedrr0r�rWrr
rT)
r$rr�r�r[rZr=rTr7r`rarr�s
             r%�notify_completed_jobzJobViewer.notify_completed_jobqs����i�i�m�m�U�B�'���7�7�J��)��5���g�g�0�1���"����,�/�J��!�&����'�'����.2�i�i�.2�i�i�48�O�O�E����2�2��IO�3�Q�E�
#�Y�Y��5�
��%�!'���!7�!7��!D�����!A�A���'�'�-�q��|�<���*�*�.�.��2D�0E�./�1H�/I�/7�/6�/8�/8�/8�9��	� � �&�.�.�"4�"4�5����h�"�G�G�	I�"���2>��(�(��/��&�&�)�	!���� ��1�}�}�����2�~�~�	!�� �	!�s$�#G�/G�G�G�G9�8G9c�V�|j}|j|=|j�yr))rr0r�)r$r�r�rs    r%rdz.JobViewer.on_completed_job_notification_closed�s'���"�"���,�,�U�3��&�&�)r'c��|jj�i|_t�|_i|_t
�|_yr))rlr"r$rgr'r%rIr�)r$�mons  r%r�zJobViewer.on_refresh�s5���
�
������	��5�����
�!0�!3��r'c�j�|jdd�}	|jj|�}|jr||jvry||d<||j
vr|j
||�n]||jk(rN|j�D];\}}	||j|vs�|	|j||<td|�d|	�d���=||j
vry|j|�r|jj|�n)||jvr|jj|�|jd��|j rR|j|�sy|j"j|g�D] }
|
j$r�|j'|
��"yy#t$r|}Y���wxYw)	Nr�rAr;zAdd �=z	 (my job)Tr<)r/r�rerWrr%rr�r6r$r�r&r'r�r
rHrr)rXrP)r$rhr�	eventnamer�r$rr�attrr�r�s           r%r�zJobViewer.job_added�s����k�k�,�b�1��	��,�,�3�3�S�9�G����7�$�2E�2E�#E��&-��"�#���
�
�%��L�L�%��)�
�D�O�O�
#�&�}�}�/�
F���e��t�y�y��/�/�-2�D�I�I�e�$�T�*���e� D�E�
F���
�
�%�����w�'���� � �%�(�
�d�&�&�
&����#�#�U�+����d��+��;�;��%�%�w�/���4�4�8�8�'�2�F�
K���+�+��A�A�6�J�
K�	��;�	��G�	�s�F#�#F2�1F2c�
�|jdd�}	|jj|�}|jr||jvry||d<|j|�r|jj|�n)||jvr|jj|�|j||�|j�||jvry|j|}|jrk|dk(s|dk(ra|dtjk(rK|d}t|�t k7r|g}d}	|D]}
|
j#d	�s�d
}	n|	s|j%|�|j�r�|dk(s,|dk(�r�|dtj&tj(fv�r�||j*v�r�d
}|d}|tj,k(s|tj.k(r|dd
k(rd}n�|d}
|d}|
j1d�dk7rt3d�||fz}n`|
j1d�dk7rt3d�||fz}n;|
j1d�dk7s|tj&k7rd}nt3d�|||
fz}|�r�t5d�|j7dd
��t9j:t3d�|j<��}|j?t3d�t8j@jBt8jDt8j@jF�|jIt8j@jF�|jKd�|jMd�|jOtP�t8jRjUdd�}|jKd�t9jV�}|jYt8jZt8j\j^�|ja|ddd�t8jbjUdd�}dt3d�zd ztejf�z}	|d!tjhk(r|d"}|d#z
}|t3d$�|zz
}t9jj|�%�}|jmd
�|jod
�|jqdd�|ja|ddd�|ja|ddd�|jrja|ddd�|jud&|jv|�|j*j|�|jy�yyyyyy#t$r|}Y��=wxYw#t$rY��wxYw)'Nr�rAr;�
job-completed�job-state-changedr��job-state-reasonsF�job-canceledTzjob-stoppedr$r�znotify-textr�zbackend errorsr�zBThere was a problem sending document `%s' (job %d) to the printer.z
filter errorsz6There was a problem processing document `%s' (job %d).zbeing pausedz:There was a problem printing document `%s' (job %d): `%s'.zProblem detected)r�zPrint Error)r|r}�	_Diagnoser�r�rz"<span weight="bold" size="larger">z	</span>

z
printer-staterm� z*The printer called `%s' has been disabled.r�r�)=r/r�rerWrr&r'r�r
rrHr$rrP�IPP_JOB_COMPLETEDr[r:�
startswithrer2r�r(r0r1r�r�r�r�rr�r�r�r�r��STOCK_OKrr�r�r�rzr{r�r�r�r��STOCK_DIALOG_ERRORr�r�r�r�r�escape�IPP_PRINTER_STOPPEDr��set_use_markupr�r�r�r�rr�)r$rhrrkr�r$rrrA�canceledr��may_be_problemr;�notify_textr�r�r�r�r�r��markuprAr�s                       r%r�zJobViewer.job_event�s<���k�k�,�b�1��	��,�,�3�3�S�9�G����7�$�2E�2E�#E��&-��"�#����w�'���� � �%�(�
�d�&�&�
&����#�#�U�+������(�������	�	�!���)�)�E�"���;�;�I��8�&�*=�=�"�;�/�4�3I�3I�I��/�0�G��W�~��%�"�)���H�!�
���$�$�n�5�#�H��
�
��)�)�5�1�
�K�K�
�-�
'��.�.��K� �T�%9�%9�%)�%9�%9�%;�;���1�1�1�"�N��[�)�F��$�1�1�1��4�,�,�,��)�*�.B�B�!&��.$�M�2��"�:�.���#�#�%5�6�"�<� �"<� =� (�%�0� 1�G�!�%�%��7�2�=��!,�-�08�%�/@�A�G�!�&�&��7�2�=��� 4� 4�4�%*�N� !�"3� 4� (�%��=� >�G���.�/��*�*�D�T�*�B����1�]�+;�37�?�?�D���"�"�A�k�N�C�4D�4D�4G�4G�$'�L�L�#�2B�2B�2E�2E�G��+�+�S�-=�-=�-@�-@�A��'�'��+��$�$�e�,��$�$�d�+��x�x�|�|�U�B�/���%�%�q�)��	�	����$�$�c�&<�&<�&)�l�l�&9�&9�;������u�a�8��x�x�|�|�U�B�/��>��M�*�+�-:�;�"�/�/�7�3�4����_�-��1I�1I�I�$�^�4���#�
���1�&6�$7�9=�$>�?��
�	�	��/���$�$�d�+��#�#�T�*��#�#�Q��*������u�a�8�����u�e�Q�7����&�&��e�U�A�>����
� $� @� @�%�I��(�(�,�,�e�4����"�S�m2�;�/�
��Y�	��G�	��F ����s#�U�1U0�U-�,U-�0	U<�;U<c�P�|jrv|dk(s|dk(rl|dtjk(rV|d}t|�t	|�t
k7r|g}d}|D]}|j
d�s�d}n|s|j|�||jvrB|jj|j|�|j|=|j|=||jvr|jj|�||jvr
|j|=|j�y)Nrnror�rpFrqT)rrPrtr�r[r:rurer%rlr
r$r'r&rH)r$rhrrkr�rAr{r�s        r%r�zJobViewer.job_removedos���;�;�I��8�&�*=�=�"�;�/�4�3I�3I�I��/�0�G��� ��W�~��%�"�)���H�!�
���$�$�n�5�#�H��
�
��)�)�5�1��D�M�M�!��J�J���t�}�}�U�3�4��
�
�e�$��	�	�%� ��D�$�$�$����#�#�U�+��D�O�O�#�����&����r'c���|j�\}}|j�}	|j|}d|_|j|�|j
�|jj�|jsy|jj�D]2\}}|j|�s�|d|k(s�!|j|�yy#t$rg}||j|<Y��wxYw)NFr;)r>r+r)rWrXr]rHr�r6rr$r6r&rP)	r$rhr�r|rrr�r�r�s	         r%r�zJobViewer.state_reason_added�s����.�.�1�
����$�$�'��	4��*�*�7�3�A�
 %���	���&�������
�
� � �#��{�{�������+�	�I�C���%�%�t�,���&�'�7�2��=�=�v�F��
	���	4��A�23�D�&�&�w�/�	4�s�C�C0�/C0c�P�|j�}	|j|}	|j	|�}||=|j
�|jj�|jsy|j�}	|j|}t|dd�dk7r	|j�|j|=|j!�y#t$rtd�YywxYw#t
$rtd�YywxYw#tj$rY�gwxYw#t$rYywxYw)NzPrinter not foundzReason not foundr�T)r+r)rWr�rOr�rHr�r6rrRr,r�r�rr
r�)r$rhr�rrAr�r]r�s        r%r�zJobViewer.state_reason_removed�s-���$�$�'��	��0�0��9�G�
	��
�
�v�&�A�

�A�J������
�
� � �#��{�{��� � �#��
	��:�:�5�A�L���h��5��=�� �&�&�)��/�/��6��*�*�-��=�	��+�,��	���	��*�+��	��$�{�{������	��	�sX�C�C&�>D�D�.D�C#�"C#�&C=�<C=�D�D�D�D�	D%�$D%c�@�|jsy|j|�yr))rrN)r$rhr�s   r%r�zJobViewer.still_connecting�s���{�{���(�(�&�1r'c�f�|jsy	|j|}d}|D]}|j�dk(s�|}n�|j�}n[t	d�d}|jj�D]#\}}}||k(s�
|dk(s�t	d�|||f}n|�t	d�y	|j|}	t|	dd�dk7r	|	j�d|	_yy#t$rt	d�Y��wxYw#t$rt	d�YywxYw#tj$rY�RwxYw)	NrKz(Couldn't find state reason (no reasons)!z#Couldn't find state reason in list!zFound from notifications listzBUnexpected now_connected signal (reason not in notifications list)zUnexpected now_connected signalr�T)
rr)rMrWr�rRr,rbr�r�rr
r�)
r$rhrrAr�rsr]r0r�r�s
          r%r�zJobViewer.now_connected�sr���{�{��	D��0�0��9�G��F��
���<�<�?�&<�<��F��
����$�$�'�E��=�>��E��6�6�;�;�>�
�������<�A�)?�$?�� ?�@�"�A�q�M�E��

��}��A�B��	��:�:�5�A�L�
�L�(�D�1�T�9�
��"�"�%�#'�L��
:��7�	D��B�C�	D��.�	��9�:��	���;�;�
��
�s:�)C&�C&�-D�
D�&C=�<C=�D�D�D0�/D0c�:�|jj|�yr))r�rS�r$rhrs   r%r�zJobViewer.printer_added	s�����*�*�G�4r'c�<�|jj||�yr))r�r`)r$rhrrkr�s     r%r�zJobViewer.printer_event	s�����0�0�'�5�Ar'c�:�|jj|�yr))r�rcr�s   r%r�zJobViewer.printer_removed	s�����-�-�w�7r'c	�Z�|jdt|j|d���y)Nrr)rarkr�)r$r�r�r�rr�s      r%r[z"JobViewer._set_job_job_number_text	s"�����&�#�u����a�'@�"A�Br'c	��|j|d�}	|j|}|jd|j	dtd���y#t$rYywxYw)Nrrr�r��r�r$rWrar/r��r$r�r�r�rr�rr�s        r%r\zJobViewer._set_job_user_text	s`������q�)��	��)�)�E�"�C�	
���&�#�'�'�+F�+,�Y�<�#9�	:���	��	���A�	A�Ac	��|j|d�}	|j|}|jd|j	dtd���y#t$rYywxYw)Nrrr�r�r�r�s        r%r]z JobViewer._set_job_document_text	sZ������q�)��	��)�)�E�"�C�	
���&�#�'�'�*�a�	�l�"C�D���	��	�r�c��|j|d�}	|j|jd�}|dk(rdt	d�z}nd}|jd|j|d|z�y#t$rYywxYw)	Nrrpzprinter-stopped� - �disabledrArr;)r�r$r/rWr�ra)	r$r�r�r�rr�rrAr�s	         r%r^zJobViewer._set_job_printer_text%	s�������q�)��	��i�i��&�*�*�+>�?�G��'�'��Q�z�]�*�F��F����&�$�)�)�E�"2�3E�"F�v�"M�N���	��	�s�A.�.	A:�9A:c���|j|d�}	|j|}td�}d|vrt	|d�dz}|jd|�y#t$rYywxYw)Nrr�r��kr)r�r$rWr�rkra)	r$r�r�r�rr�rr��sizes	         r%r_zJobViewer._set_job_size_text2	sp������q�)��	��)�)�E�"�C���|���S� ���N�+�,�s�2�D����&�$�'��
�	��	�s�A�	A"�!A"c�:�	|j|}|jdtj�}t|�}|tjk(xr|jdd�dk(}d}|r
td�}�n�|tjk(�r9td�}|jd�}|���	|jd�}|dk7�r�tj�}	t|d|�}
||d	zdjd�}|dk7r+||d	zz
}t||d	z|�}t||d	zd�}
nt||d	zd�}d
}
|	j}|
|	jks<|
|	jk(r2||	jks||	jk(r|
|	jkr|d	z
}|	j|	j ||
||
d
d
df	}t"j$jd�}dt"j$d<tj&|�}|�t"j$d=n|t"j$d<tj(|�}td
�tj*d|�z}|dk(rtd�}n�|dk(rtd�}n�|dk(rtd�}n�|dk(rtd�}n�|dk(rtd�}n�|dk(r�td�}n�	tj.td�tjtd�tj0td�tj2td�tj4td�tj6td �i|}|�td!�}|S#t$rYywxYw#t,$rY��,wxYw#t$rY�9wxYw)"Nr�r$r*r�zHeld for authentication�Heldr�r�r{r�TZ�UTCz
Held until %sz%Xzday-timezHeld until day-time�eveningzHeld until evening�nightzHeld until night-timezsecond-shiftzHeld until second shiftzthird-shiftzHeld until third shift�weekendzHeld until weekend�Pending�
Processing�Stopped�Canceled�Aborted�	Completedr�)r$rWr/rPr0r�r1r�r�r��gmtime�tm_mday�tm_hour�tm_min�tm_sec�tm_year�tm_monrWr��mktimer�r�r5r�r2r��IPP_JOB_ABORTEDrt)r$r�r�r;r�r:r%�until�colon1r��hh�colon2�mm�ss�dayr��old_tz�
simpletime�locals                   r%�_find_job_state_textzJobViewer._find_job_state_text>	sm��	��9�9�S�>�D����;��(?�(?�@����L���$�"3�"3�3�2�!�X�X�'7��@�1�2�	�����/�0�E�
�$�#�#�
#��f�I�E��H�H�.�/�E�� �$�"�Z�Z��-�F���|�"�k�k�n�� �%���.�1��!&�v��z�{�!3�!8�!8�#�!>��!�R�<�"�f�q�j�0�F�!$�e�F�Q�J�v�&>�!?�B�!$�e�F�Q�J�K�&8�!9�B�!$�e�F�Q�J�K�&8�!9�B�!"�B�!�k�k������,��3�;�;�.� �3�:�:�o�!�S�Z�Z�/�B����O��1�H�C� #���S�Z�Z�� "�B��A�q�"� 6��!#������!5��+0��
�
�4�(�%)�[�[�$�%7�
�!�>� "�
�
�4� 0�/5�B�J�J�t�,� $���
� ;��!"�?�!3�!%����e�!<�"=���
�"��/�0���)�#��.�/���'�!��1�2���.�(��3�4���-�'��2�3���)�#��.�/��
��.�.��)���1�1�1�\�?��.�.��)���/�/��:���.�.��)���0�0�!�K�.�C�
DE�F���=��i�L�E����]�	��	��d"�����,�
��
�s7�M/�+F3M>�BN�/	M;�:M;�>	N�
N�	N�Nc
��|j|d�}	|j|}|jdtj
�}t
|�}|tj
k(r
|j}	n|j}	|tjk(r�	tjj�}
|
jtjdd�}|	j�}|j!|dd|j#�|j%�|j#�dzdz
|j%�dzdz
ddt&j(j*d�|}	n|d	}
|j3|	|
�
�}	|j5d|	�y#t$rYywxYw#t,j.$rt1dtjz�Y�SwxYw)Nrr�g&@r(r{rr)r	r;)rr)r�r$rWr/rPr0r�r�r�r1rrr�rr<r�r�r�r�rr�r�rr
r�r2ra)r$r�r�r�rr�rr;r�rrr1r�rs              r%rhzJobViewer._set_job_status_icon�	s�������q�)��	��9�9�U�#�D����;��(?�(?�@����L����'�'�'��,�,�D��>�>�D���!�!�!�

L��
�
�1�1�4�����#�*?�*?���K���y�y�|��� � �$��1�"&�.�.�"3�"&�/�/�"4�"&�.�.�"3�a�"7�!�";�"&�/�/�"4�q�"8�1�"<�"%�s�"+�"6�"6�"?�"?��
F���
�-�.�G��/�/��w�/�G�D����8�T�*��=�	��	��.�>�>�
L��2�S�5J�5J�J�K�
L�s$�F�CF�	F�
F�/G�Gc��|j|d�}	|j|}	|d}|d}|jj|g�}	t
|	�dkDr2|	d}
|	ddD]
}||
kDs�	|}
�|
j�\}}
|d|zz
}|jd|�y#t$rYywxYw#t$r|j|�}||d<Y��wxYw)Nrr)r;r{r�r)	r�r$rWr�r)r/r�r>ra)r$r�r�r�rr�rrrrAr*r�r|rGs              r%rizJobViewer._set_job_status_text�	s������q�)��	��9�9�U�#�D�	(���'�D�
�)�*���,�,�0�0�'�2�>����=�1��"�1�:�L�!�!�"�+�
*���L�(�#)�L�
*�+�:�:�=�O�U�F��E�E�M�!�D����6�4�(��'�	��	��
�	(��,�,�e�4�D�#'�D�� �	(�s"�B�B,�	B)�(B)�,C�
C)NNFFTNNr))F)Rr+r,r-rgr+rr�r�r�r&r�r�rGr�r�r�r�r�rrrr!rr7rYrurtr�ryrxr9rwr�r�r�r�r�r�r9r;r�r�r�r=r?rArCr�r�rDrrEr,r&r2r5r9rHrPrNr\rerdr�r�r�r�r�r�r�r�r�r�r�r[r\r]r^r_r�rhrir.r'r%r�r�ss���!�#4�5��	��+�+�4�4�d�B�?�
�L�'+�27�.2��e7�N	�@.�	��Q�.�@N�8�t	5� � F�D&�
d#�LeC�N+�ZI�>�@""�H;�J�]'�~,�8�
O�*�?�"��
,�+�?��
��4�4�&D�L9��&D�8*�.�@6�>�)�V�0
5�=�@%2�N!�8�0!�d*�4�'K�RT#�l�@�6$�L2�-'�^5�B�8�C�:�E�O�
(�Q�f"+�H)r'r�)Br�r3rPr��	dbus.glib�dbus.servicer�gi�require_version�
gi.repositoryrrrrrr�guir	r�rWr�r
rUrIr��sysr��urllib.parserF�xml.saxr�debugr4�statereasonr��	functoolsr
rCrrDr5�gettext�installr5rr�
pkgdatadir�pkgdatar{r�SEARCHING_ICON�init�Schemar��SchemaFlagsr�SchemaAttributeType�STRING�INTEGERr3rr0r<rIrur�r.r'r%�<module>r�s���*�������	�����8�U�#� ��!��#������
�
��
�����
��������X����B���x��%�$��J������v�~�~��1A�1A�B�#�
�
�
����
�	�'������0�1�
��}�}�(�(�)J�F�L^�L^�Lc�Lc�5;�5O�5O�5V�5V�7=�7Q�7Q�7X�7X�7=�7Q�7Q�7X�7X�9?�9S�9S�9Z�9Z�5;�5O�5O�5W�5W�7=�7Q�7Q�7X�7X�9?�9S�9S�9Z�9Z�4:�4N�4N�4U�4U�	*+�+�� � ���1�1�_�_�DMF�'�/�/�MF�^Y!)��Y!)��o	���J��s�8I�I�I

Zerion Mini Shell 1.0