%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__/serversettings.cpython-312.pyc

�

HfRW��R�ddlZddlZejejej��ddlZddlZddlmZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddl�ddl�ddlZddlmZ	ej(ZGd�d	e	j.�ZGd
�de�Zedk(r|d
e
j6d<ej8�Zd�Zd�Ze d�e�Z!e!jEde�e!jEde�e!jEde�ejG�yy#e$rdZY��wxYw)�N)�domain�	localedir)�GObject)�Gtk)�*)�GtkGUI�_remote_anyc��eZdZd�Zy)�_UnobtrusiveButtonc�&�tjj|fi|��|jtjj
�|j
�}|j�}|jd�|jdd|zz�y)NTz&<span size="small" underline="single" zcolor="#0000ee">%s</span>)
r�Button�__init__�
set_relief�ReliefStyle�NONE�	get_child�get_text�set_use_markup�
set_markup)�self�args�label�texts    �2/usr/share/system-config-printer/serversettings.pyrz_UnobtrusiveButton.__init__1su���
�
���T�*�T�*�������-�-�.����!���~�~� ��
���d�#�
���0�5��<�=�	>�N)�__name__�
__module__�__qualname__r�rrrr0s��>rrc��eZdZejj
ddfejj
ddfejj
ddfd�ZdZdd�Zd�Z	d�Z
d�Zd	�Zd
�Z
dd�Zdd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�ServerSettingsNr)�settings-applied�dialog-canceled�problems-clicked�/admin/conf/cupsd.confc��tjj|�tj||��|_||_||_|jdgd�itj��ttd���}|jj|ddd�|jd	|j�|j!�|j"jd
|j$�i|_|j"|_|j*|_|j.|_|j2|_|j,j7�}|j9t:j<j>�|jA|d|jB�|j,jE�D]}|j,jG|��t;jHdt;jJ�d�
�}|j,jM|�|jO�|jQ�|r|j(jS|�|jU�|j(j!�y)N)�host�
encryption�ServerSettingsDialog)r)�chkServerBrowse�chkServerShare�chkServerShareAny�chkServerRemoteAdmin�chkServerAllowCancelAll�chkServerLogDebug�hboxServerBrowse�rbPreserveJobFiles�rbPreserveJobHistory�rbPreserveJobNone�tvBrowseServers�frameBrowseServers�btAdvServerAdd�btAdvServerRemove)rz	Problems?)rFr�clicked�response�changed�)r)+rr�authconn�
Connection�cupsconn�_host�_parent�
getWidgets�config�PACKAGEr�_r0�pack_end�connect�problems_clicked�showr)�on_response�handler_ids�dialogr4�browse_treeviewr6�addr7�remove�
get_selection�set_moder�
SelectionMode�MULTIPLE�_connect�on_treeview_selection_changed�get_columns�
remove_column�TreeViewColumn�CellRendererText�
append_column�
_fillAdvanced�
_fillBasic�set_transient_for�connect_signals)rr'r(�parent�problems�	selection�column�cols        rrzServerSettings.__init__Es������ � �$�'� �+�+�$�:�N��
���
�������/�3�4�" &�~�~�#	�	/�&&�Q�{�^�<�����&�&��%���B����)�T�%:�%:�;��
�
���!�!�)�)�:�t�7G�7G�H�����/�/���#�3�3����&�&����,�,����(�(�6�6�9�	����C�-�-�6�6�7��
�
�y�)�T�-O�-O�P��*�*�6�6�8�	7�F�� � �.�.�v�6�	7�� � �"�c�&:�&:�&=�A�F�����*�*�C�0�����������K�K�)�)�6�2����������rc��|jS�N)rK)rs r�
get_dialogzServerSettings.get_dialog~s���{�{�rc�&�|jd�y)Nr$)�emit)r�buttons  rrGzServerSettings.problems_clicked�s���	�	�%�&rc��tj�}	|jj|j|��d�}d}d}d}g|_
|jd�|D]�}|jd�}|j�j�}	|	jd�r
	||	�}�M|	jd�r
	||	�}�h|	jd�r
	||	�}��|	jd	�s��|jj!|t#d	�dj����|j$j'|�|r|j(j+d�n9|r|j,j+d�n|j.j+d�||_||_t5j6t8�}
|j:j=|
�|jD]}|
j!|g�
��y#t
j$r*}|j\}t||j��d}~wwxYw#Y���xYw#Y���xYw#Y���xYw)N��filec��|jd�dj�}|dvry|dvry	t|�dk7ry	t�#Yt�xYw)N� �)�true�on�enabled�yesT)�false�off�disabled�no�0Fr)�split�strip�int�RuntimeError)�line�arg1s  r�parse_yesnoz1ServerSettings._fillAdvanced.<locals>.parse_yesno�sf���:�:�s�#�A�&�,�,�/�D��7�7���>�>��
���:��?��#����
����s�A�A
Tr�UTF-8�preservejobhistory �preservejobfiles �	browsing �browsepoll ��row)�tempfile�
TemporaryFiler>�getFile�RESOURCE�cups�	HTTPErrorr�show_HTTP_Errorr@�browse_poll�seek�decode�lowerry�
startswith�append�lenr5�
set_sensitiver1�
set_activer2r3�preserve_job_history�preserve_job_filesr�	ListStore�strrL�	set_model)r�f�e�sr~r�r��browsingr|�l�model�servers            rrZzServerSettings._fillAdvanced�s���"�"�%��	��M�M�!�!�4�=�=�q�!�9�	� $��!�������	����
��	N�D��;�;��(�D��
�
�
�#�#�&�A��|�|�2�3��+6��?�(����2�3��)4�a��&����{�+��*�A��H����}�-�� � �'�'��c�=�.A�.B�)C�)I�)I�)L�M�'	N�*	
���-�-�x�8���#�#�.�.��5�
!��%�%�0�0�$�7��"�"�-�-�t�4�$8��!�"4����
�
�s�#�����&�&��.��&�&�	(�F��L�L�v�h�L�'�	(��u�~�~�	��6�6�D�Q��Q����-���	��:��������s;�'H�$I�?I
�I�I�%H=�=I�I
�
I�Ic�P�t�|_|jjt	d��	|jj�|_|jj�|jtjf|jtj f|j"t$f|j&tj(f|j*tj,f|j.tj0ffD]�\}}||_||jvrI|j5t7|j|��|j9d�|j;��d|j5d�|j9d�|j=���tj|jvr|j>j;�n|j>j=�	tj }t7|j|�}||_ |jE|j�y#tj$rF}|j\}}t|||j�|jj��d}~wwxYw#tB$rY��wxYw)Nzfetching server settingsTF)#�setr:r>�_begin_operationrD�adminGetServerSettings�server_settingsr��IPPErrorr�show_IPP_Errorr@�_end_operationr*�CUPS_SERVER_REMOTE_PRINTERSr+�CUPS_SERVER_SHARE_PRINTERSr,�try_CUPS_SERVER_REMOTE_ANYr-�CUPS_SERVER_REMOTE_ADMINr.�CUPS_SERVER_USER_CANCEL_ANYr/�CUPS_SERVER_DEBUG_LOGGING�settingr�rzr�rH�hider5�server_is_publishing�AttributeError�on_server_changed)rr��m�widgetr��flag�
publishings       rr[zServerSettings._fillBasic�s#���u����
�
�&�&��*D�(E�F�	�#'�=�=�#G�#G�#I�D� �	
�
�
�$�$�'��
!�
!�4�#C�#C�D�
�
 �
 �$�"A�"A�B�
�
#�
#�%?�@�
�
&�
&��(E�(E�F�
�
)�
)�4�+K�+K�L�
�
#�
#�T�%C�%C�D�
 G�	�O�F�G�%�F�N��$�.�.�.��!�!�#�d�&:�&:�7�&C�"D�E��$�$�T�*����
��!�!�%�(��$�$�U�+����
�	�"�+�+�t�/C�/C�C��#�#�(�(�*��#�#�(�(�*�	��2�2�D��d�2�2�4�8�9�J�(2�D�%�
	
���� 3� 3�4��M�}�}�	��V�V�F�Q���1�a����.��M�M�(�(�+���		��D�	��	�s*�H=�2/J�=J�AJ�J�	J%�$J%c��td|z�|j}||jvritt	|j���|j|k(r|jj|�n|jj|�|jj�}|jj|xrt|jv�y)Nzon_server_changed: %s)
�
debugprintr�r�r�rz�
get_activer:�discardrMr+r,r�r�)rr�r��sharings    rr�z ServerSettings.on_server_changed�s����+�f�4�5��.�.���d�*�*�*��3�v�(�(�*�+�,��0D�0D�W�0M�M����$�$�V�,���� � ��(��%�%�0�0�3�����,�,��J�2�d�6J�6J�J�	Lrc��|j||�}||jvrg|j|<|j|j||f�yrd)rFrJr�)rr��signal�handler�reason�ids      rrSzServerSettings._connectsM��
�^�^�V�W�
-����)�)�)�')�D���V�$����� �'�'�&�"��6rc��||jvr6|j|D]\}}|j|��|j|=yyrd)rJ�
disconnect)rr�r�r�s    r�_disconnectzServerSettings._disconnectsO���T�%�%�%� $� 0� 0�� 8�
'�����!�!�2�&�
'�� � ��(�&rc�\�|jj|j�dk7�y)Nr)rNr��count_selected_rows)rr`s  rrTz,ServerSettings.on_treeview_selection_changeds"�����!�!�9�#@�#@�#C�q�#H�Irc���|jj�}|jdtd�g��}|j	d�|jj�d}|j
�d}|jdd�|jjtj�|d�|j|d|jd�|j|d	|jd�y)
NrzEnter hostnamer�F�editableT�edited�editzediting-canceled)rL�	get_model�insertrDr�rU�	get_cells�set_property�
set_cursorr�TreePathrS�on_browse_poll_edited�on_browse_poll_edit_cancel)rrhr��iterrb�cells      r�on_add_clickedzServerSettings.on_add_clickeds����$�$�.�.�1���|�|�Q�Q�'7�%8�$9�|�:�����e�$��"�"�.�.�1�!�4���}�}���"�����:�t�,����'�'������d�C��
�
�t�X�t�'A�'A�6�J��
�
�t�/��6�6��	@rc���|jj�}|j|�}|j|d|�|j	d�|jdd�|jjd�|jd�d}	tj|dtjddtj�|rwd}|j%�}|rb|j'|d�|k(r8|d	z
}|d
k(r.d}|jj)�}
|
j+|�y|j-|�}|r�ayy|j/|�y#tj$r�|jd�}d}|D]i}	|	ddk(s|	jd�rd}nL|	D]A}
|s|
j!�rd}|
j!�r�(|
j#�r�9|
dk(r�?d}n|r�in|r|sd}Y��(wxYw)NrFr�Tr�rw�.�-rn�)rLr��get_iter�	set_value�stop_editingr�rMr�r��socket�getaddrinfo�	AF_UNSPEC�AI_NUMERICHOST�gaierrorrx�endswith�isalpha�isdigit�get_iter_first�	get_valuerO�select_iter�	iter_nextrN)rr��path�newvaluer�r��valid�labels�
seen_alphar�char�count�ir`s              rr�z$ServerSettings.on_browse_poll_editeds����$�$�.�.�1���~�~�t�$��
����q�(�+����5�!����:�u�-�������%����&�!���	�����#�v�/?�/?��A� &� 5� 5�
7�8��E��$�$�'�A���?�?�A�q�)�X�5��Q�J�E���z� %��$(�$8�$8�$F�$F�$I�	�!�-�-�q�1���O�O�Q�'���
�L�L�$���O���	��^�^�S�)�F��J��
���!�H��O��N�N�C�(�!�E��!�	�D�%��<�<�?�)-�J� �L�L�O� �L�L�O� �C�K� %���	���#
�&�Z����1	�s+�6E�A1G0�G0�G0�G0�#	G0�/G0c�t�|jd�|jdd�|jj�}|j	tj��}|j|�|jjd�|jjd�|jd�y)NTr�Fr�)r�r�rLr�r�rr�rNrMr�r�)rr�r�r�s    rr�z)ServerSettings.on_browse_poll_edit_cancelSs������4� ����:�u�-��$�$�.�.�1���~�~�s�|�|�~�.��
���d��������%����!�!�5�)����&�!rc�h�|jj�}|jj�}|j�}|dD�cgc]"}tj
j
||���$}}|D]4}|j�}|j|�}|j|��6ycc}w)Nrn)
rLr�rO�get_selected_rowsr�TreeRowReference�new�get_pathr�rN)	rrhr�r`�rowsr��refs�refr�s	         r�on_remove_clickedz ServerSettings.on_remove_clicked]s����$�$�.�.�1���(�(�6�6�9�	��*�*�-��CG��7�K�4��$�$�(�(�%��6�K��K��	 �C��<�<�?�D��>�>�4�(�D��L�L�$��	 ��Ls�'B/c�2�|tjjk(s|tjjk7r=|j	�|j
j
�|jd�~y|j�|j�y)Nr#)
r�ResponseType�CANCEL�OKr�rKr�rg�	saveBasic�saveAdvanced)rrKr9s   rrIzServerSettings.on_responsegso����(�(�/�/�/���(�(�+�+�+������K�K�����I�I�(�)����������rc���	d}|dkr	|jj�yyy#t$rtjd�|dz
}YnwxYw|dkr�M�2#t
$rYywxYw)Nrn�)r>rSr{�time�sleepr�)r�attempts  r�
_reconnectzServerSettings._reconnectssu��
	��G��Q�,�!��M�M�*�*�-�����$�!��J�J��N��q�L�G�!��	�Q�,���	�
�	�s,�A�'�#A
�
A�A
�
A�	A#�"A#c�
�|jj�}|xs|jj�}|jj	�}g}|j�}|r5|j
|j|d��|j|�}|r�5t|�t|j�k(r[||jk(rL||jk(r=|j�|jj�|j!d�~yt#j$�}	|j&j)|j*|��dx}	x}
}|sd}	|sd}
|D]
}|d|zz
}�|j5d�t#j$�}
dx}}d}d}|D]F}|j7d	�}|j9�j;�}|j=d
�s�Dd}n|j5d�|D�]}|j7d	�}|j9�j;�}|j=d�r|r�G|	}d}n�|j=d
�r|r�`|
}d}n�|r7|j=d
�r&|r�{|
j?|jAd	��d}��|sV|j=d�rE|sC|
j?|jAd	��|
j?|jAd	��d}��|
j?|jAd	����|s |
j?|	jAd	��|s |
j?|
jAd	��|s |
j?|jAd	��|
jC�|
jE�}tGjH|dtFjJ�	|j&jMd|��tSjTd�|jW�|j�|j!d�|jj�~y#t,j.$r.}|j0\}t3||j�Yd}~yd}~wwxYw#t,jN$r0}|j0\}}tQ|||j�Yd}~yd}~wt,j.$r.}|j0\}t3||j�Yd}~yd}~wwxYw)Nrr"rjr;zPreserveJobHistory No
zPreserveJobFiles No
zBrowsePoll %s
Frr�Tr�r�r�r%)�fdrn),r1r�r2rLr�r�r�r�r�r�r�r�r�r�rKr�rgr�r�r>r�r�r�r�rr�r�r�r�ryr��write�encode�flush�fileno�os�lseek�SEEK_SET�putFiler�r�rrr)rr�r�r�r�r�r�r�r��job_history_line�job_files_line�browsepoll_linesr��conf�wrote_preserve_history�wrote_preserve_files�wrote_browsepoll�has_browsepollr|r�r	r�s                      rrzServerSettings.saveAdvanced�s^��!�4�4�?�?�B�� 2�!H� $� 9� 9� D� D� G�	��$�$�.�.�1�����#�#�&����������q� 9�:��?�?�D�)�D��
����d�&6�&6�!7�7��$�"9�"9�9� �D�$=�$=�=������K�K�����I�I�)�*���
�"�"�%��	��M�M�!�!�4�=�=�q�!�9�@B�A��A�>�,<�$�8��"�4�N�!�	;�F�� 1�F� :�:��	;�	
����
��%�%�(��8=�=��!5� �����	�D��;�;�w�'�D��
�
�
�#�#�&�A��|�|�]�+�!%���	�	
���q�	��%	.�D��;�;�w�'�D��
�
�
�#�#�&�A��|�|�2�3�)��'��)-�&����2�3�'��%��'+�$� ��,�,�
�.�#���
�
�,�3�3�G�<�=�#'� ��$��,�,��,�'��J�J����G� 4�5��J�J� 0� 7� 7�� @�A�'+�$���J�J����G�,�-�K%	.�N&��J�J�(�/�/��8�9�#��J�J��-�-�g�6�7���J�J�(�/�/��8�9��
�
�
�
�[�[�^��
���"�a����%�		��M�M�!�!�#;��!�C�	
�
�
�A�����������	�	�%�&���������K�~�~�	��6�6�D�Q��Q����,���	��h�}�}�	��V�V�F�Q���A�q�$�+�+�.����~�~�	��6�6�D�Q��Q����,���	�s<�-'Q�R�R�$Q<�<R�T�&S�T�$T�Tc
�x�t�}|jtjf|jtj
f|jtf|jtjf|jtjf|jtjffD]9\}}||jvr�tt!|j#���||<�;|j$j't)d��	|j$j+|�|j$j5�t9�|_|jj=tj
d�}|j=tj
d�}|dk(�r�|dk7�r�	|j>dk(s|j>ddk(rEtAjB�}	|	jDstAjF�}	|	jI�}
nd}
|
�s?tKjL|jNddtJjPjRtJjTjVt)d���}|jYt)d	��|j[tJj\tJj^j`t)d�tJj^jb�|je�}|jg�|tJj^jbk(r/	jit@jj�|	jm�twjxd
�|j{�y#tj,$rJ}|j.\}}t1|||j2�|j$j5�Yd}~yd}~wt6$r;}t1d||j2�|j$j5�Yd}~yd}~wwxYw#tnjptrf$r
tu�Y��wxYw)Nzmodifying server settingsTrw�	localhostr�/zAdjust Firewall)r^�modal�destroy_with_parent�message_type�buttonsrz>Adjust the firewall now to allow all incoming IPP connections?rn)>�dictr*r�r�r+r�r,r�r-r�r.r�r/r�r�r�rzr�r>r�rD�adminSetServerSettingsr�rr�rKr�r{r�r:�getr?�firewallsettings�	FirewallD�running�SystemConfigFirewall�check_ipp_server_allowedr�
MessageDialogr)�MessageType�QUESTION�ButtonsTyper�format_secondary_text�add_buttons�STOCK_CANCELr��NO�YES�run�destroy�add_service�IPP_SERVER_SERVICEr
�dbus�
DBusException�	Exception�nonfatalExceptionrrr)
r�setting_dictr�r�r�r�r��old_setting�new_settingr��allowedrKr9s
             rrzServerSettings.saveBasicsE���v��
�
!�
!�4�#C�#C�D�
�
 �
 �$�"A�"A�B�
�
#�
#�%?�@�
�
&�
&��(E�(E�F�
�
)�
)�4�+K�+K�L�
�
#�
#�T�%C�%C�D�
 G�	B�O�F�G��d�2�2�2�H�$'��F�,=�,=�,?�(@�$A�L��!�	B�	
�
�
�&�&��*E�(F�G�
	��M�M�0�0��>�	
�
�
�$�$�'��u����*�*�.�.��0O�0O�03�5��"�&�&��(G�(G��M���3��;�#�#5�
%��J�J�+�-��J�J�q�M�S�(�(�2�2�5�A��9�9�,�A�A�D���8�8�;�G�#�G�� �.�.�t�7P�7P�6:�PT�=@�_�_�=U�=U�8;���8L�8L�56�7H�5I�	K�F�
�0�0�!�5C�3D�E��&�&��(8�(8�#�:J�:J�:M�:M�()�*;�(<�c�>N�>N�>R�>R�T�%�z�z�}�H��N�N�%��3�#3�#3�#7�#7�7��
�
�'7�'J�'J�K����
�	
�
�
�1�
�	
�����m�}�}�	��V�V�F�Q���1�a����-��M�M�(�(�+����	��4��D�K�K�0��M�M�(�(�+���	��V�&�&�	�2�
%�!�$�
%�s8�M1�!F*P�1P�AO	�	P�1P�P�#P9�8P9)NNNrd)rrrr�SignalFlags�RUN_LAST�__gsignals__r�rrerGrZr[r�rSr�rTr�r�r�r�rIrrrrrrr!r!;s���%�0�0�9�9�4��D�#�/�/�8�8�$��C�$�0�0�9�9�4��D�
�L�&�H�7�r�'�@(�D+5�ZL�7�)�J�
@�6 �p"� �
��"~�@Drr!�__main__�ui�SYSTEM_CONFIG_PRINTER_UIc�,�tj�yrd)�loop�quit)rs rrFrFNs���	�	�rc� �td|z�y)Nz%s: problems)�print)�objs rr_r_Qs��
�n�s�"�#rTr#r"r$)$rB�gettext�installrCrr�r6�
gi.repositoryrrrr�r�rr<�debug�errordialogsr$�guir�CUPS_SERVER_REMOTE_ANYr�r�r
rr!r�environ�MainLooprErFr_�
set_debuggingr�rFr2rrr�<module>rTs��.������v�~�~��1A�1A�B���!��	�
��������/�!%�!<�!<��	>����	>�M�V�M�^�z��-1�B�J�J�)�*��7����D��$��4����A��I�I� �$�'��I�I�!�4�(��I�I�!�8�,��H�H�K����/�!.��/�s�.D�D&�%D&

Zerion Mini Shell 1.0