403Webshell
Server IP : 39.108.156.168  /  Your IP : 216.73.216.104
Web Server : nginx/1.24.0
System : Linux e2.ksyuki.com 6.11.0-25-generic #25~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:20:50 UTC 2 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/softwareproperties/gtk/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/softwareproperties/gtk/__pycache__/SoftwarePropertiesGtk.cpython-312.pyc
�

��[i���F�ddlZddlZddlZddlZddlZddlmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
e
jdd�e
jdd�e
jdd�e
jdd	�dd
lmZddlmZmZmZmZmZmZddlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dlmZd
dl m Z d
dl!m!Z!ddl"Z"ddl#Z"ddl$m%Z%ddl$Z"ddl&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,ejZj\j_d��ej`dkrejb�e2d�\Z3Z4Z5e6e2d��\Z7Z8d
Z9dZ:e6e2d��\Z;Z<Z=Z>Z?e2d�\Z@ZAZBZCd ZDd!ZEd"ZFGd#�d$eG�ZHd%�ZId&�ZJGd'�d(e%e�ZKy))�N)�gettext�Gdkz3.0�Gtk�Handy�1�PackageKitGlibz1.0)r)�GObjectrr�Gio�GLibr)�Deb822SourceEntry�)�SimpleGtkbuilderApp)�	DialogAdd)�DialogMirror)�
DialogEdit)�DialogEditDeb822)�DialogCacheOutdated)�DialogAddSourcesList)�
UbuntuProPage)�SoftwareProperties)�
get_ua_status�get_ua_service_status�current_distro�is_current_distro_lts)�detectT)�set_as_default)��	r
r����security�updates�	backportsc�&�eZdZdZdZdZdZdZd�Zy)�UpdateSubscriptionsFc�.�|jrtS|jr|jr|jrt
S|jr|jr|jstS|jr|js|jstStS�N)�other�UPDATES_CUSTOMr"r#r$�UPDATES_ALL�UPDATES_RECOMMENDED�UPDATES_SECURITY��selfs �N/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py�
get_statuszUpdateSubscriptions.get_statusvs`���:�:�!�!��=�=�T�\�\�d�n�n���
�]�]�t�|�|�D�N�N�&�&�
�]�]�4�<�<����#�#���N)	�__name__�
__module__�__qualname__r"r#r$r)�inconsistentr1�r2r0r&r&os ���H��G��I��E��L�	r2r&c�N�|jdk(rtjd�yy)z�Log an error if the DBus exception was raised because the user canceled
    the authentication prompt shown when changing apt sources/configuration.

    Return True if it is, so that calling code can do further processing,
    False otherwise.
    z6com.ubuntu.SoftwareProperties.PermissionDeniedByPolicyz4Authentication canceled, changes have not been savedTF)�_dbus_error_name�logging�error)�dbus_exceptions r0�'maybe_log_authentication_canceled_errorr=�s(���&�&�>�?��
�
�L�M��r2c�6�tj|tjjtjj
tjjd��}|jd|�d|���|j�|j�y)z show a error dialog N)�parent�flags�type�buttons�message_formatz<big><b>z</b></big>

F)r�
MessageDialog�DialogFlags�MODAL�MessageType�ERROR�ButtonsType�OK�
set_markup�run�destroy)�
parent_window�summary�msg�dialogs    r0r;r;�si��
�
�
�m�%(�_�_�%:�%:�$'�O�O�$9�$9�'*���'9�'9�.2�	4�F�
���g�s�C�D�
�J�J�L�
�N�N��r2c���eZdZdJd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�ZdKd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdLd�Zd�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/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6d6�Z7d7�Z8d8�Z9d9�Z:d:�Z;dLd;�Z<d<�Z=d=�Z>dLd>�Z?d?�Z@d@�ZAdA�ZBdB�ZCdC�ZDdLdD�ZEdE�ZFdF�ZGdG�ZHdH�ZIdI�ZJy)M�SoftwarePropertiesGtkNc�H�tj|||d��tjj	d�tj�t
jj�}|jt
jj�tj|tjj|dd�d��|ri|j j#t$j&j(�|j j+�	|j j-|�||_|r�|j0dk7r�|j j#t$j&j(�|j j+�	t%j2t5|j0��}|r	|j j-|�t8j:j=�}d|vrEt8j:j?d�|_ |j@jCd	�|_"n)d|_ d
|_"|jFjId�tKjL�}|jOdd
�}	tKjP|	d�|_)|jRjUd|jV�|jRjUd|jX�|jRjUd|jZ�|jRjUd|j\�|jRjUd|j^�|jRja�|j j+�i|_1|je�d|_3|ji�|jk�|jm�|jo�|jq�|js�|ju�|jw�|jy�|j{�|j}�t�r|j��|j�j�d|j��|r:|j�r.|j�j�t5|j���|dk7rqtjj�|�t�j�j�d��t�j�j�d���k7r|j�|�|j j�dd�y#Y��QxYw#t6$rd}Y���wxYw#Y���xYw)z� Provide a GTK based graphical user interface to configure
            the used software repositories, corresponding authentication keys
            and update automation T)�options�datadir�deb822zsoftware-properties�
gtkbuilderzmain.ui)�domainNzcom.ubuntu.update-notifier�regular-auto-launch-intervalrFzcom.ubuntu.SoftwareProperties�/�SourcesListModified�ConfigModified�KeysModified�
AuthFailed�CdromScanFailedzswitch-pagezDir::EtczDir::Etc::sourcelistr
)Mr�__init__r�Window�set_default_icon_namer�init�StyleManager�get_default�set_color_scheme�ColorScheme�PREFER_LIGHTr�os�path�join�window_main�
set_type_hintr�WindowTypeHint�DIALOG�show�set_transient_forrU�toplevel�window_foreign_new�int�AttributeErrorr
�Settings�list_schemas�new�settings�get_int�initial_auto_launch�combobox_other_updates�
set_sensitive�dbus�	SystemBus�
get_object�	Interface�backend�connect_to_signal�on_sources_list_modified�on_config_modified�on_keys_modified�on_auth_failed�on_cdrom_scan_failed�Reload�handlers�init_apt_cache�pk_task�init_auto_update�init_release_upgrades�show_auto_update_level�	init_keys�	show_keys�init_isv_sources�show_isv_sources�show_cdrom_sources�init_distro�show_distro�init_driversr�init_ubuntu_pro�
notebook_main�connect�on_main_notebook_page_switched�open_tab�set_current_page�abspath�apt_pkg�config�find_dir�find�	open_file�resize)
r/rVrU�filer?�
style_managerrs�all_schemas�bus�proxys
          r0razSoftwarePropertiesGtk.__init__�sP��	�#�#�D�'�7�+/�	1��
�
�(�(�)>�?�	�
�
���*�*�6�6�8�
��&�&�u�'8�'8�'E�'E�F��$�$�T�%'�W�W�\�\�'�<��%S�,A�	C�����*�*�3�+=�+=�+D�+D�E����!�!�#�
�� � �2�2�6�:�
����w�'�'�4�/����*�*�3�+=�+=�+D�+D�E����!�!�#�
 ��1�1�#�g�6F�6F�2G�H�����$�$�6�6�x�@�
�l�l�/�/�1��'�;�6��L�L�,�,�-I�J�D�M�'+�}�}�'<�'<�=[�'\�D�$� �D�M�'(�D�$��'�'�5�5�e�<��n�n������>��D���~�~�e�-L�M������&�&�!�4�#@�#@�	B����&�&��d�5�5�	7����&�&��D�1�1�	3����&�&��$�-�-�	/����&�&��t�8�8�	:�	
������	
��������
�	
�������	
�����"�"�$��#�#�%��������������������!������������� �"�� � �"�	
���"�"�=�$�2U�2U�V��w�'�'����/�/��G�4D�4D�0E�F�
�D�L��G�G�O�O�D�!�w�~�~�/F�/F�z�/R�/6�~�~�/B�/B�CY�/Z�&\�
\��N�N�4� �	
������1�%��E
���"�
 ���
 ��
��s*�V�(V
�V�V�
V�V�V!c����|�jk(rA�jjd��jst	j
�fd��yy�jjd�y)NFc�`��tj�j��j�S)N)�target)�	threading�Thread�detect_drivers�startr.s�r0�<lambda>zFSoftwarePropertiesGtk.on_main_notebook_page_switched.<locals>.<lambda>s!���i�&6�&6�d�>Q�>Q�&R�&X�&X�&Z�r2T)�vbox_drivers�
button_revert�set_visible�
detect_calledr�idle_add)r/�notebook�page�page_nums`   r0r�z4SoftwarePropertiesGtk.on_main_notebook_page_switchedsV����4�$�$�$����*�*�5�1��%�%��
�
�Z�[�&�
���*�*�4�0r2c��tj�r*tj�tj�r�)yy)z) abstract interface to keep the UI alive N)r�events_pending�main_iterationr.s r0�update_interfacez&SoftwarePropertiesGtk.update_interface"s(��� � �"���� �� � �"r2c���|j�}|jj|�|jjd|j�|j
|j<y)z? setup the widgets that allow configuring the release upgrades �changedN)�get_release_upgrades_policy�combobox_release_upgrades�
set_activer��$on_combobox_release_upgrades_changedr�)r/�is  r0r�z+SoftwarePropertiesGtk.init_release_upgrades'sX���,�,�.���&�&�1�1�!�4�
�
+�
+�
3�
3�I�48�4]�4]�_�	
�
�
�d�4�4�5r2c��tj�tj�tjd�|_tj
|j�|_tj|j�|_yr()	r��init_config�init_system�Cache�	apt_cache�DepCache�depcache�PackageRecords�recordsr.s r0r�z$SoftwarePropertiesGtk.init_apt_cache.sV���������� ���t�,����(�(����8��
��-�-�d�n�n�=��r2c���tjd�|_tj|j�|_tj
|j�|_yr()r�r�r�r�r�r�r�r.s r0�update_apt_cachez&SoftwarePropertiesGtk.update_apt_cache5s>�� ���t�,����(�(����8��
��-�-�d�n�n�=��r2c��|jj�|jj�}i|_t	|�D]0\}}|j|jd�}||j|<�2|j�}||jj�vr;|dkDr6|jjtd�|z�||jd<|jD]1}|j||k(s�|jj|�n|jjd|j�|j|j<y)zB Set up the widgets that allow to configure the update automation r
rz
Every %s days���r�N)�combobox_update_intervalrq�	get_model�combobox_interval_mapping�	enumerate�	get_value�iter�get_update_interval�values�append_text�_r�r��#on_combobox_update_interval_changedr�)r/�modelr��row�value�update_days�keys       r0r�z&SoftwarePropertiesGtk.init_auto_update:sH���%�%�*�*�,�
�-�-�7�7�9��)+��&�!�%�(�	6�H�Q���O�O�C�H�H�a�0�E�05�D�*�*�1�-�	6��.�.�0���d�<�<�C�C�E�E��Q���-�-�9�9�!�O�:L�<G�;H�I�5@��.�.�r�2��1�1�	�C��-�-�c�2�k�A��-�-�8�8��=��	��
*�
*�
2�
2�9�37�3[�3[�]�	
�
�
�d�3�3�4r2c�<�|j�|jr�|jjd�}|jj	�}t|�D]C\}}|j
|jd�}||k(s�(|jj|�n|jjd|j�|j|j<|jjd|j�|j|j<y)z>Represent the level of update automation in the user interfacerZr
r�N)�set_security_update_levelrzr{r}r�r�r�r�r��combobox_security_updatesr��set_sec_update_automation_levelr��!set_other_update_automation_level)r/�level_otherr�r�r��levels      r0r�z,SoftwarePropertiesGtk.show_auto_update_level[s���	
�&�&�(��=�=��-�-�/�/�0N�O�K��/�/�9�9�;�E�%�e�,�
���C�������!�4���%�'��/�/�:�:�1�=��	
��
+�
+�
3�
3�I�48�4X�4X�Z�	
�
�
�d�4�4�5�
�
(�
(�
0�
0��15�1W�1W�Y�	
�
�
�d�1�1�2r2c���|j�}|dk(r|jjd�n|jjd�|tjk(s|tj
k(r|jj
d�y|tjk(r|jj
d�y|tjk(r|jj
d�yy)zHFetch the security level, Enable/Disable and set the value appropriatelyNFTrr
r)	�get_update_automation_levelr�r~�softwareproperties�
UPDATE_MANUAL�
UPDATE_NOTIFYr��UPDATE_DOWNLOAD�UPDATE_INST_SEC)r/�	level_secs  r0r�z/SoftwarePropertiesGtk.set_security_update_levelss����4�4�6�	�����*�*�8�8��?��*�*�8�8��>��+�9�9�9��/�=�=�=��*�*�5�5�a�8�
�,�<�<�
<��*�*�5�5�a�8�
�,�<�<�
<��*�*�5�5�a�8�=r2c�r�|jjtd�|jjz�|j
j
d|j�|j|j
<|jj�D]}|jj|��|jjjD]�}td�|j�|jfz}t!j"|��}||_|j
d|j&|j�|j|<|jj)|�|j+���|j,j�D]}|j,j|��|jjj.D]�}|j0dk(r�d|jvs�"t!j"|j2�d|j�d���}||_|j
d|j6|�|j|<|j,j)|�|j+���t9�}t;�sd	}d	}n5t=d
|��\}	}
t=d|��\}}t?|	xs|�}d
|
|fv}tA�}
|r`td�}	|jCdd�jEd�\}}}tFjFjI|d�jK�}ntd�}|
jP}|jRjU|�d}tFjFjW�jK�}||k\rQ|r1|
jXj[dd�}d|j[dd�z}td�|j]d�z}nW||tGj^d��z
k\rtd�|j]d�z}ntd�|j]d�z}|j`j|�|jbjUd |�d!td"��d#��|jbje|xr|�td$�|j]d�z}|jf}|j
d%|jh�|j|<t!jj�}|jljo|d&�|jljq|d'd(�|jlj
d%|jr�|j|jl<t!jttvjxtvjxtvjz�}|jlj}|�|jlj|j�d)�y*#tL$rtOd�|
jP}Y���wxYw)+z9Setup the user interface elements to represent the distroz%s Software�toggledz%s (%s)��label�deb-src�proposedz (�)Fz	esm-infra)�statuszesm-apps�enabledzExtended Security Maintenance�expires��+z%Y-%m-%dT%H:%M:%Sz&Unable to determine UA contract expiryzBasic Security Maintenancezhttps://ubuntu.com/esmz LTSzhttps://ubuntu.com/%s�.�-z Ended %s - extend or upgrade nowz%x�<)�daysz Ends %s - extend or upgrade soonzActive until %sz	<a href="z">u	Extend…z</a>zEnded %sr�T�textrrN)A�label_dist_name�	set_labelr��distro�id�checkbutton_source_coder��"on_checkbutton_source_code_toggledr��vbox_dist_comps�get_children�remove�source_template�
components�get_description�namer�CheckButton�comp�on_component_toggled�addrq�dev_box�childrenrA�description�template�on_checkbutton_child_toggledrrr�boolr�get�	partition�datetime�strptime�date�
ValueError�print�eol�label_esm_statusrK�now�version�replace�strftime�	timedelta�	label_eol�label_esm_subscriber��combobox_updates_subscription�(on_combobox_updates_subscription_changed�CellRendererText�combobox_server�
pack_start�
add_attribute�on_combobox_server_changed�	ListStorer	�TYPE_STRING�TYPE_BOOLEAN�	set_model�set_row_separator_func�is_row_separator)r/�checkbuttonrr��checkboxrr��
esm_available�esm_enabled�infra_available�infra_status�apps_available�apps_statusr�eol_text�dt�_sep�_tz�eol_date�esm_url�today�
distro_ver�eol_expiry_text�combobox�cell�server_stores                          r0r�z!SoftwarePropertiesGtk.init_distro�sL��	
���&�&�q��'7�$�+�+�.�.�'H�I�#�:�:�B�B�9�CG�Cj�Cj�l�	
�
�
�d�2�2�3�
 �/�/�<�<�>�	5�K�� � �'�'��4�	5��K�K�/�/�:�:�
	�D��i�L�D�$8�$8�$:�D�I�I�#F�F�E����U�3�H� �H�M�&.�&6�&6�y�37�3L�3L�37�9�9�'>�D�M�M�(�#�
� � �$�$�X�.��M�M�O�
	�  �<�<�4�4�6�	-�K��L�L����,�	-����3�3�<�<�
	 �H��}�}�	�)���X�]�]�*��?�?�h�>R�>R�>F�m�m�2M�N��$,��!��$�$�Y�%)�%F�%F�%-�/��
�
�h�'���� � ��*��
�
��
	 ����$�&� %�
�#��2G��\b�2c�/��,�0E�j�Y_�0`�-��� $�_�%F�� G�
�'�L�+�+F�F���!����<�=��
	.�)/�
�
�9�b�(A�(K�(K�C�(P�
��D�#�#+�#4�#4�#=�#=�� 3�$��$�&�!��9�:��!�:�:�����(�(��2�*���!�!�%�%�'�,�,�.���H�� �%+�^�^�%;�%;�F�B�%G�
�"9�J�<N�<N�s�TW�<X�"X��"#�$F�"G�(�J[�J[�\`�Ja�"a��
�h��!3�!3��!<�<�
<�"#�$F�"G�(�J[�J[�\`�Ja�"a��"#�$5�"6��9J�9J�4�9P�"P����� � ��1�� � �+�+�+2�A�k�N�C�	
�	
� � �,�,��1�k�/�	
��J�-�(�*;�*;�D�*A�A���5�5��"*�"2�"2��t�D�D�#F��
�
�h���#�#�%�����'�'��d�3����*�*�4���;�.2�.B�.B�.J�.J�9�;?�;Z�;Z�/\��
�
�d�*�*�+��}�}�W�%8�%8�%,�%8�%8�%,�%9�%9�;��	
���&�&�|�4����3�3�D�4I�4I�1�M��W"�.��F�G�#)�:�:��.�s�,AX� X6�5X6c��|jD]?}|j|j|�s�"|j|j|��Ayr()r��handler_is_connected�
handler_block�r/�widgets  r0�block_handlersz$SoftwarePropertiesGtk.block_handlers�sC���m�m�	<�F��*�*�4�=�=��+@�A��$�$�T�]�]�6�%:�;�	<r2c��|jD]?}|j|j|�s�"|j|j|��Ayr()r�rL�handler_unblockrNs  r0�unblock_handlersz&SoftwarePropertiesGtk.unblock_handlers�sC���m�m�	>�F��*�*�4�=�=��+@�A��&�&�t�}�}�V�'<�=�	>r2c��|j�|jj�D]B}|j|j�\}}|j|�|j
|��D|jj�D]B}|j|j�\}}|j
|�|j|��Dt�}|jjjD]�}|jdk(r�|jj!d�d}|j|�\}}|xj"|zc_|s�]|t$k(rd|_�n|t(k(rd|_�|t,k(rd|_��d|_��|j3�}|j4}|j7�}	|t8k(r 	|	j;t=t8��n.	|	jE|	j;t=t8���|j|�|jG|j"�tI|jjJ�dkrR|j4jGd�|jjGd�|jLjGd�n6|jjGd�|jLjGd�|jO�}
|
dk(r|jLj
d�nr|
dk(r7|jLjd�|jLj
d�n6|jLjd�|jLj
d�tI|jQ��d	k(r5|jRjU�|jVjY�n4|jRjY�|jVjU�|jZj7�}|j]�g}|jj_�D]�\}
}}|jA|
|dg�|
|g|j`vr|j`jE|
|g�n|dk7r|jA|
|g�|dk(s�gtI|�dz
|_1|jZj|jb���|j`D]\}
}|jA|
|dg��||_0|jjjdr0|jAgd
��|jAtCd�ddg�|jg�|jhjjdk(s|jhjldk(�r�tod|jjJz�tod
|jjpz�tod�|jjrD]}|ju|��tod�|jjvD]}|ju|��tod�|jjxD]}|ju|��tod�|jjzD]}|ju|��tod�|jj|D]}|ju|��tod�|j~D]}|ju|��yy#t>$r|	jAtCd�g�Y��UwxYw#t>$rY��ewxYw)z(Fill the distro user interface with lifer�r�r�T�Customr
FNr)�sepNT�Other...zENABLED COMPS: %szINTERNET COMPS: %szMAIN SOURCESz
CHILD SOURCESz
CDROM SOURCESzSOURCE CODE SOURCESzDISABLED SOURCES�ISV)@rPrr
�get_comp_child_staterr��set_inconsistentr	�get_comp_download_staterr&rrrrAr�splitr6�POCKET_SECURITYr"�POCKET_UPDATESr#�POCKET_BACKPORTSr$r)r1r*r�r*�get_iter_from_string�strr�appendr�rr~�len�
enabled_compsr�get_source_code_state�get_cdrom_sources�scrolledwindow_cd�hide�scrolledwindow_no_cdrqr-�clear�get_server_list�seen_server�
active_server�
mirror_setrSrU�debug�
massive_debugr �download_comps�main_sources�print_source_entry�
child_sources�
cdrom_sources�source_code_sources�disabled_sources�sourceslist_visible)r/r8�activer6�
subscriptionsr�pocketr�rHr��source_code_staterJ�seen_server_newr�uri�sources                r0r�z!SoftwarePropertiesGtk.show_distros]���������1�1�3�	4�H�%)�%>�%>�x�?P�?P�%Q�"�V�\�����'��%�%�l�3�	4��,�,�9�9�;�	(�H�%)�%A�%A�(�-�-�%P�"�V�\��%�%�l�3�����'�		(�,�-�
����3�3�<�<�	/�H��}�}�	�)���]�]�(�(��-�b�1�F�%)�%>�%>�x�%H�"�V�\��&�&�,�6�&���_�,�-1�M�*��~�-�,0�M�)��/�/�.2�M�+�*.�M�'�	/�"�)�)�+���5�5���"�"�$���^�#�
,��*�*�3�~�+>�?�
����U�7�7��N�8K�L�M�	���F�#����=�#=�#=�=�>��t�{�{�(�(�)�A�-��.�.�<�<�U�C��L�L�&�&�u�-��(�(�6�6�u�=��L�L�&�&�t�,��(�(�6�6�t�<�!�6�6�8����$��(�(�9�9�$�?�
�$�
&��(�(�3�3�D�9��(�(�9�9�%�@��(�(�3�3�E�:��(�(�9�9�%�@��t�%�%�'�(�A�-��"�"�'�'�)��%�%�*�*�,��"�"�'�'�)��%�%�*�*�,��+�+�5�5�7��������#'�;�;�#>�#>�#@�	D��T�3������s�E� 2�3��c�{�d�.�.�.�� � �'�'��s��4�����&�&��c�{�3���~�%(��%6��%:��"��$�$�/�/��0B�0B�C�	D� �+�+�	4�K�T�3�����s�E� 2�3�	4�*����;�;�&�&�1�1���� 3�4�����:���e� <�=�	
�����<�<����%����)C�)C�t�)K��%����(A�(A�A�B��&����)C�)C�C�D��.�!��+�+�2�2�
0���'�'��/�
0��/�"��+�+�3�3�
0���'�'��/�
0��/�"��+�+�3�3�
0���'�'��/�
0��'�(��+�+�9�9�
0���'�'��/�
0��$�%��+�+�6�6�
0���'�'��/�
0��%�L��2�2�
0���'�'��/�
0�'*L��C�
,����a��k�]�+�
,��
�
��
�s$�]�(-].�$]+�*]+�.	];�:];c�(�|j�}d}|dk(rtj}n+|dk(rtj}n|dk(rtj}	||j�k7r|jj|�yy#tj$ry}t|�rd|j|j}|jj|�|j�|jj|�Yd}~yYd}~yd}~wwxYw)zZCall the backend to set the security update automation level to the given
           valuer�rr
rN)�
get_activer�r�r�r�r�r��SetUpdateAutomationLevelr�
DBusExceptionr=r�r�rMr�rR)r/rO�index�state�e�
combo_handlers      r0r�z5SoftwarePropertiesGtk.set_sec_update_automation_level�s����!�!�#�����A�:�&�4�4�E�
�a�Z�&�6�6�E�
�a�Z�&�6�6�E�	N���8�8�:�:����5�5�e�<�;���!�!�	N�6�q�9� $�
�
�d�.L�.L� M�
��.�.�<�<�]�K��.�.�0��.�.�>�>�}�M�M�	:��	N�s�.B�D�A*D�Dc��|j�}|jj�}||d}|jj	d|�y)zBSet the other update automation level to the given value via gconfr
rZN)r�r}r�rz�set_int)r/rOr�r�rs     r0r�z7SoftwarePropertiesGtk.set_other_update_automation_level�sF���!�!�#���+�+�5�5�7���U�|�A����
�
���<�d�Cr2c�&�|j||�S)z% Check if a given row is a separator )r�)r/r�r��columns    r0r6z&SoftwarePropertiesGtk.is_row_separator�s�����t�V�,�,r2c��|j�}	|jj|�y#tj$r�}t|�r|j|j}|jj|�|j�}|jj|�|jj|�Yd}~yYd}~yd}~wwxYw)z! set the release upgrades policy N)r�r��SetReleaseUpgradesPolicyrr�r=r�r�rMr�r�rR)r/rHr�r�r�s     r0r�z:SoftwarePropertiesGtk.on_combobox_release_upgrades_changed�s���
���!��	N��L�L�1�1�!�4���!�!�	N�6�q�9� $�
�
�d�.L�.L� M�
��.�.�<�<�]�K��4�4�6���.�.�9�9�!�<��.�.�>�>�}�M�M�:��	N�s�.�C�BC�Cc�:��|j�}|tk7r>|j�}	|j|j	tt����fd�}	|tk(r(|td�|td�|td�na|tk(r(|td�|td�|td�n0|tk(r'|td�|td�|td��jjjD]M}|j dk(r�|j"j%d�d}|tttfvs�E||d��Oy#t$rY��wxYw#t&j($r}t+|�Yd}~yd}~wwxYw)Nc�T��dj�jj|�}|r@tjdj|���j
j
|�ytjdj|���j
j|�y)Nz{}-{}zenabling {}zdisabling {})�formatr�codenamer:�infor��EnableChildSource�DisableChildSource)r{r�rr/s   �r0�_toggle_child_sourcez\SoftwarePropertiesGtk.on_combobox_updates_subscription_changed.<locals>._toggle_child_source�sr����^�^�D�K�K�$8�$8�&�A�F�����]�1�1�&�9�:����.�.�v�6����^�2�2�6�:�;����/�/��7r2TFr�r�r�)r�r*r�rr`rarr+r]r^r_r,r-rrrrArr\rr�r=)r/rHr�r�r�rr{r�s`       r0r+z>SoftwarePropertiesGtk.on_combobox_updates_subscription_changed�s`����#�#�%���N�"��&�&�(�E�
����U�7�7��N�8K�L�M�	8�	7���#�$�_�d�;�$�^�T�:�$�%5�t�<��-�-�$�_�d�;�$�^�T�:�$�%5�u�=��*�*�$�_�d�;�$�^�U�;�$�%5�u�=� �K�K�7�7�@�@�
8���=�=�I�-��!���,�,�S�1�"�5���/�>�CS�!T�T�(���7�
8��3�
��
��>�!�!�	7�3�A�6�6��	7�s0�-E"�C6E2�E2�"	E/�.E/�2F�F�Fc���|j�|jk(ry|j�}|j�}|j	|d�}|j	|d�}	|td�k(r�t
|j|j|j|j�}|j�}|dk7r|jj|�y|j|j�y|dk7rTt|jj �dkDr1|j�|_|jj|�yyy#t"j$$r}t'|�Yd}~yd}~wwxYw)zg
        Replace the servers used by the main and update sources with
        the selected one
        Nr
rrW)r�rmr��get_active_iterr�r�rrmrVr�custom_mirrorsrLr��ChangeMainDownloadServerr�rc�used_serversrr�r=)	r/rHrJr�r~rrQ�resr�s	         r0r0z0SoftwarePropertiesGtk.on_combobox_server_changed�s=��
��� �D�$6�$6�6���)�)�+���'�'�)���$�$�T�1�-���%�%�d�A�.��	7��q��}�$�%�d�&6�&6�&*�l�l�&*�k�k�&*�&9�&9�;���j�j�l���$�;��L�L�9�9�#�>��'�'��(:�(:�;�����T�[�[�%=�%=�!>��!B�%-�%8�%8�%:��"����5�5�c�:�"C����!�!�	7�3�A�6�6��	7�s&�$A4E�E�5AE�E7�"E2�2E7c���	|j�dk(r|jj|�y|jj|�y#tj
$r}t
|�Yd}~yd}~wwxYw)z{
        Sync the components of all main sources (excluding cdroms),
        child sources and source code sources
        TN)r�r��EnableComponent�DisableComponentrr�r=)r/r7rr�s    r0rz*SoftwarePropertiesGtk.on_component_toggled�s]��
	7��%�%�'�4�/����,�,�T�2����-�-�d�3���!�!�	7�3�A�6�6��	7�s�.A
�A
�
A5� A0�0A5c��	|j�dk(r&|jj|j�y|jj	|j�y#t
j$r}t|�Yd}~yd}~wwxYw)zT
        Enable or disable a child repo of the distribution main repository
        FN)r�r�r�rr�rr�r=)r/r7rr�s    r0rz2SoftwarePropertiesGtk.on_checkbutton_child_toggledse��	7��%�%�'�5�0����/�/��
�
�>����.�.�x�}�}�=���!�!�	7�3�A�6�6��	7�s�8A!�%A!�!B	�4B�B	c���	|j�dk(r|jj�y|jj�y#tj
$r}t
|�Yd}~yd}~wwxYw)z3 Disable or enable the source code for all sources TN)r�r��EnableSourceCodeSources�DisableSourceCodeSourcesrr�r=)r/r7r�s   r0rz8SoftwarePropertiesGtk.on_checkbutton_source_code_toggledsY��	7��%�%�'�4�/����4�4�6����5�5�7���!�!�	7�3�A�6�6��	7�s�-A�A�A3�A.�.A3c��|j�}|j�|k7r+	|jj|j��yy#tj
$r}t
|�Yd}~yd}~wwxYw)z5 The user clicked on the popcon paritipcation button N)�get_popcon_participationr�r��SetPopconPariticipationrr�r=)r/rO�	do_popconr�s    r0�on_checkbutton_popcon_toggledz3SoftwarePropertiesGtk.on_checkbutton_popcon_toggledsk���1�1�3�	�����)�+�
;����4�4�V�5F�5F�5H�I�,���%�%�
;�7��:�:��
;�s�)A�A8�#A3�3A8c��	t|j|j|j|j|j
|�}|j
�\}}|tk(rLg|j_|ttfvr,|D]&}|jjt|���(yyy#tj$r}t|�Yd}~yd}~wwxYw)zAShow a confirmation for adding the channels of the specified fileN)rrm�sourceslist�
render_source�get_comparablerVrL�RESPONSE_REPLACE�list�RESPONSE_ADDr��AddSourceFromLinerarr�r=)r/r�rQr��new_sourcesrr�s       r0r�zSoftwarePropertiesGtk.open_file(s���	7�)�$�*:�*:�*.�*:�*:�*.�*<�*<�*.�*=�*=�*.�,�,�*.�0�F�"(�����S�+��&�&�(*�� � �%��<�)9�:�:�"-�D�����6�6�s�6�{�C�D�;�'��
�!�!�	7�3�A�6�6��	7�s�B(B-�-C�C�Cc��|jj�}|j�}	t|	�dkDr|j	|	d�yy)z=Extract the dropped file pathes and open the first file, onlyrN)�data�stripr\rcr�)
r/rO�context�x�y�	selection�target_type�	timestampr~�uri_splitteds
          r0�on_sources_drag_data_receivedz3SoftwarePropertiesGtk.on_sources_drag_data_received:sC���n�n�"�"�$���y�y�{���|��q� ��N�N�<��?�+�!r2c�8�|jj�yr()rmrhr.s r0rhzSoftwarePropertiesGtk.hideBs�������r2c��|j|t�j�j|j��dk(S)Nr�)r��COLUMN_DESC�lowerr�)r/�storer�r�r�r�s      r0�source_search_functionz,SoftwarePropertiesGtk.source_search_functionEs2�����t�[�1�7�7�9�>�>�s�y�y�{�K�r�Q�Qr2c	�*	�tjtjtjtj
tjtj�|_|jj|j�tjtjtjtj
tjtj�|_	|jj|j�|jj|jt�tj�}|jdd�|jdd�tj t#d�|t$��}|j'd�tj(�}|jdd�|jdd�|j+d|j,|j�|j.|<tj t#d�|t0�	�}|jj3|�|jj3|�tj�}|jdd�|jdd�tj t#d�|t$��}|j'd�tj(�}|jdd�|jdd�|j+d|j,|j�|j.|<tj t#d�|t0�	�}|jj3|�|jj3|�|jj5t$�|jj7|j8d
�	tj:|jtj<j>tj@jCddd�gtDjFjH�|jj+d
|jJ�y
#tL$rYy
wxYw)z;
        Read all valid sources into our ListStore
        �xpadr�ypadzSoftware Sources)�markupi�r��Active)ryNz
text/uri-listr�drag_data_received)'rr1r	r3r2�
TYPE_PYOBJECT�cdrom_store�treeview_cdromsr4�source_store�treeview_sourcesr5�is_separator�STORE_SEPARATORr,�set_property�TreeViewColumnr�r��
set_max_width�CellRendererToggler��on_isv_source_toggledr��
COLUMN_ACTIVE�
append_column�set_search_column�set_search_equal_funcr��
drag_dest_set�DestDefaults�ALL�TargetEntryryr�
DragAction�COPYr�rv)r/�	cell_desc�col_desc�cell_toggle�
col_actives     r0r�z&SoftwarePropertiesGtk.init_isv_sourcesIs����=�=��)=�)=�)0�)<�)<�)0�)>�)>�)0�)=�)=�)0�)=�)=�	?���
	
���&�&�t�'7�'7�8��M�M�'�*>�*>�*1�*=�*=�*1�*?�*?�*1�*>�*>�*1�*>�*>�	@���
	
���'�'��(9�(9�:����4�4�T�5F�5F�5D�	F��(�(�*�	����v�q�)����v�q�)��%�%�a�(:�&;�Y�-8�:�����t�$��,�,�.��� � ���+�� � ���+�%0�%8�%8��26�2L�2L�26�2B�2B�&D��
�
�k�"��'�'��(��[�/<�>�
�	
���*�*�:�6����*�*�8�4��(�(�*�	����v�q�)����v�q�)��%�%�a�(:�&;�Y�-8�:�����t�$��,�,�.��� � ���+�� � ���+�%0�%8�%8��26�2L�2L�26�2C�2C�&E��
�
�k�"��'�'��(��[�/<�>�
�	
���+�+�J�7����+�+�H�5����/�/��<����3�3�D�4O�4O�QU�V�	����d�3�3�S�5E�5E�5I�5I�"���2�2�?�A�q�I�J�!�n�n�1�1�
3�
�!�!�)�)�*>�*.�*L�*L�
N���	��	�s�-BR�	R�Rc�&�|j|�y)�4Open the edit dialog if a channel was double clickedN)�on_edit_clicked�r/�treeviewrkr�s    r0�on_isv_source_activatez,SoftwarePropertiesGtk.on_isv_source_activate�s�����X�&r2c�0�tjd�|jt|�f�}|j	|t
�}	|jjt|��y#tj$r}t|�Yd}~yd}~wwxYw)z&Enable or disable the selected channelg333333�?N)�time�sleep�get_iterrur��STORE_SOURCEr��ToggleSourceUserarr�r=)r/r�rkr�r��source_entryr�s       r0r�z+SoftwarePropertiesGtk.on_isv_source_toggled�sp��	
�
�
�3���~�~�s�4�y�l�+�����t�\�:��	7��L�L�(�(��\�):�;���!�!�	7�3�A�6�6��	7�s�$A-�-B�B�Bc�L�tjt�|_|jj|j�tj�}tjtd�|d��}|jj|�	|jjdgtjj�|jjd|j�|jjd|j"�y#t $rY�2wxYw)z:Setup the user interface parts needed for the key handling�Keyr)r)z
text/plainrrr�zbutton-press-eventN)rr1ra�
keys_store�
treeview_authr4r,r�r�r��enable_model_drag_destrr�r�r��on_auth_drag_data_receivedrv�show_auth_context_menu)r/�tr�keys_cols   r0r�zSoftwarePropertiesGtk.init_keys�s����-�-��,������$�$�T�_�_�5�
�
!�
!�
#���%�%�a��h���;�����(�(��2�	����5�5�%�&����(;�(;�
=����&�&�';�'+�'F�'F�
H�	
���"�"�#7�#'�#>�#>�	@��	�	��	�s�AD�	D#�"D#c��|jtjjk(r�|jdk(r�tj�}tjtd���}|jd|j�|j|�|j�|jdddd|j|j�yyy)Nrz_Add key from paste datar��activateT)rAr�	EventType�BUTTON_PRESS�buttonr�Menu�MenuItemr�r��on_auth_add_key_from_pasterb�show_all�popupr�)r/rO�event�menu�
item_pastes     r0r�z,SoftwarePropertiesGtk.show_auth_context_menu�s����:�:����3�3�3�����8I��8�8�:�D����A�.H�,I�J�J����z�4�+J�+J�K��K�K�
�#��M�M�O��J�J�t�T�4��u�|�|�U�Z�Z�H��9J�3r2c���tj�j�}|sy|j|�s)t	|j
t
d�t
d��|j�y)N�Error importing key�CThe selected data may not be a GPG key file or it might be corrupt.)r�	Clipboard�
wait_for_text�add_key_from_datar;rmr�r�)r/rO�keydatas   r0r�z0SoftwarePropertiesGtk.on_auth_add_key_from_paste�s\���-�-�/�/�/�1�����%�%�g�.��$�"�"��)�*��.�/�
0�	
���r2c���|j�j�}|j|�s)t|jtd�td��|j
�y)z1Extract the dropped key and add it to the keyringrrN)�get_datar�r
r;rmr�r�)	r/rOr�r�r�r�r�r�rs	         r0r�z0SoftwarePropertiesGtk.on_auth_drag_data_received�s[���$�$�&�,�,�.���%�%�g�.��$�"�"��)�*��.�/�
0�	
���r2c�8�|jj|�Sr()r��AddKeyFromData)r/rs  r0r
z'SoftwarePropertiesGtk.add_key_from_data�s���|�|�*�*�7�3�3r2c�X�	|jj�|j
r&|j
j
d|j�|j�|jjd�d|_y#tj$r}t	|�Yd}~��d}~wwxYw)z6Restore the source list from the startup of the dialogNrZF)r��Revertrr�r=rzr�r|r�r�r~�modified_sourceslist)r/r�r�s   r0�on_button_revert_clickedz.SoftwarePropertiesGtk.on_button_revert_clicked�s���	7��L�L���!��=�=��M�M�!�!�"@�$�BZ�BZ�[��#�#�%����(�(��/�$)��!��
�!�!�	7�3�A�6�6��	7�s�B�B)�B$�$B)c�b�tj�|jjd�y)z=The config was changed and now needs to be saved and reloadedTN)r�r�r�r~r.s r0r�z(SoftwarePropertiesGtk.on_config_modified�s"���������(�(��.r2c�$�|j�y)z6 The apt keys have changed and need to be redisplayed N)r�r.s r0r�z&SoftwarePropertiesGtk.on_keys_modified�s�����r2c���|j�|j�|j�|j�|jjd�d|_y)zCThe sources list was changed and now needs to be saved and reloadedTN)�reload_sourceslistr�r�r�r�r~rr.s r0r�z.SoftwarePropertiesGtk.on_sources_list_modified�sN�����!������������!����(�(��.�$(��!r2c�d�|j�|j�|j�y)z% send when the authentication failed N)r�r�r�r.s r0r�z$SoftwarePropertiesGtk.on_auth_failed�s(��	
�%�%�'����!����r2c�V�t|jtd�td��y)NzError scanning the CDzCould not find a suitable CD.)r;rmr�r.s r0r�z*SoftwarePropertiesGtk.on_cdrom_scan_faileds$��
�d����'�(��/�0�	2r2c��|jj�|j�D]>}|j|�}|jj	|j
||ddg��@|jj�\}}t|j�dks|�7|jjd�|jjd�yy)zi Show the repositories of independent software vendors in the
            third-party software tree view FTr
N)r�rj�get_isv_sourcesr�rb�disabledr��
get_cursorrc�
button_remover~�button_edit)r/r�contents�path_x�path_ys     r0r�z&SoftwarePropertiesGtk.show_isv_sourcess���	
�����!��*�*�,�	<�F��)�)�&�1�H����$�$�&�/�/�&9�8�&,�e�T�&;�
<�	<�
 �0�0�;�;�=�����t� � �!�A�%������,�,�U�3����*�*�5�1�*8r2c���|jj�|j�D]>}|j|�}|jj	|j
||ddg��@y)zm Show CD-ROM/DVD based repositories of the currently used distro in
            the CDROM based sources list FTN)r�rjrfr�rbr)r/rr s   r0r�z(SoftwarePropertiesGtk.show_cdrom_sourcessi��	
����� ��,�,�.�	:�F��)�)�&�1�H����#�#����%8�(�$*�E�4�%9�
:�	:r2c�p�	|j||�S#t$r}td|z�Yd}~yd}~wwxYw)z0 Return true if the selected row is a separator zis_seperator returned '%s' NF)r��	Exceptionr )r/r�r�r�r�s     r0r�z"SoftwarePropertiesGtk.is_separator#s9��	��?�?�4��0�0���	��/�!�3�4���	�s��	5�0�5c��|jj�|jj�D]}|jj	|g�� yr()r�rj�apt_keyr�rb)r/r�s  r0r�zSoftwarePropertiesGtk.show_keys+sB���������<�<�$�$�&�	*�C��O�O�"�"�C�5�)�	*r2c�B�|jj�}|dk7r,|j|}	|jj	|�yy#t
j$r�}t|�r�|j�}|j|j}|jD]g}|j||k(s�|jj|�|jj|�|jj|�nYd}~yYd}~yYd}~yd}~wwxYw)z4Set the update automation interval to the chosen oner�N)
r�r�r�r��SetUpdateIntervalrr�r=r�r�rMr�rR)r/rOr�r�r�r�r�r�s        r0r�z9SoftwarePropertiesGtk.on_combobox_update_interval_changed0s����)�)�4�4�6����7��2�2�1�5�E�
����.�.�u�5����%�%�	
�:�1�=�"&�":�":�"<�K�$(�M�M�$�2O�2O�$P�M�#�=�=����6�6�s�;�{�J��6�6�D�D�]�S��6�6�A�A�#�F��6�6�F�F�}�U���
�>��	
�s�A
�
D� AD�6AD�Dc�*�t|j|j|j|j�}|j�}|dk7r	|jj|�yy#tj$r}t|�Yd}~yd}~wwxYw)zDShow a dialog that allows to enter the apt line of a to be used repoN)rrmr�rVrrLr�r�rr�r=)r/rOrQ�liner�s     r0�on_add_clickedz$SoftwarePropertiesGtk.on_add_clickedBsz���4�+�+�T�-=�-=��<�<����6���z�z�|���4�<�
;����.�.�t�4����%�%�
;�7��:�:��
;�s�
A*�*B�=B
�
Bc��|jj�}|j�\}}|sy|j|t�}t|t�r-t|j|j||j�}n,t|j|j||j�}|j�tjjk(r:	|j j#t%|�t%|j&��yy#t(j*$r}t-|�Yd}~yd}~wwxYw)z#Show a dialog to edit an ISV sourceN)r��
get_selection�get_selectedr��LIST_ENTRY_OBJ�
isinstancerrrmr�rVrrLr�ResponseTyperJr��ReplaceSourceEntryra�new_source_entryrr�r=)r/rO�selr�r��old_source_entryrQr�s        r0r�z%SoftwarePropertiesGtk.on_edit_clickedMs���#�#�1�1�3���(�(�*�
����� �?�?�4��@���&�(9�:�%�d�&6�&6��8H�8H�&6����F�F� �� 0� 0�$�2B�2B� 0�$�,�,�@�F��:�:�<�3�+�+�.�.�.�
;����/�/��4D�0E�03�F�4K�4K�0L�N�/���%�%�
;�7��:�:��
;�s�8D�D>�)D9�9D>c�d�|jjd�dk(r|j|�yy)r��	sensitiveTN)r�get_propertyr�r�s    r0�on_isv_source_activatedz-SoftwarePropertiesGtk.on_isv_source_activatedcs0�����(�(��5��=�� � ��*�>r2c���|jj�}|sy|j�\}}|s7|jj	d�|j
j	d�y|j
j	d�|j
|t�}|jjd�r|jj	d�y|jj	d�y)zdset the sensitiveness of the edit and remove button
           corresponding to the selected channelNFTzcdrom:)
r�r.r/rr~rr�r0r~�
startswith)r/r�r5r�r�r�s      r0�"on_treeview_sources_cursor_changedz8SoftwarePropertiesGtk.on_treeview_sources_cursor_changedis����#�#�1�1�3�����(�(�*�
�������*�*�5�1����,�,�U�3�����(�(��.����t�^�<�����&�&�x�0����*�*�5�1����*�*�4�0r2c�f�|jj�}|jj�\}}|j|�}|r<|j	|t
�}	|jjt|��yy#tj$r}t|�Yd}~yd}~wwxYw)zRemove the selected sourceN)r�r�rr�r�r0r��RemoveSourcerarr�r=)r/rOr�rkr�r�r�r�s        r0�on_remove_clickedz'SoftwarePropertiesGtk.on_remove_clicked~s����%�%�/�/�1���.�.�9�9�;���v��~�~�d�#��� �?�?�4��@�L�
;����)�)�#�l�*;�<����%�%�
;�7��:�:��
;�s�"$B�B0�B+�+B0c� �tjtd�|jtjtj
jtjtj
jf��}dtjvrDtjjdtjdz�}|j|�|j�}|j�|tj
jk(rU	|j j#|j%��s*t'|jtd�td��yyy#t(j*$r}t-|�Yd}~yd}~wwxYw)z[Provide a file chooser that allows to add the gnupg of a trusted
           software vendorz
Import key)�titler?rB�	SUDO_USERz~%szError importing selected filezCThe selected file may not be a GPG key file or it might be corrupt.N)r�FileChooserDialogr�rm�STOCK_CANCELr2�REJECT�STOCK_OK�ACCEPTrj�environrk�
expanduser�set_current_folderrLrhr��AddKey�get_filenamer;rr�r=)r/rO�chooser�homer�r�s      r0�add_key_clickedz%SoftwarePropertiesGtk.add_key_clicked�s1���'�'�a��o�/3�/?�/?�14�1A�1A�14�1A�1A�1H�1H�14���s�?O�?O�?V�?V�1X�Y��
�"�*�*�$��7�7�%�%�e�b�j�j��.E�&E�F�D��&�&�t�,��k�k�m�������#�"�"�)�)�)�
;��|�|�*�*�7�+?�+?�+A�B��$�*�*��;�<��6�7�8�C�*���%�%�
;�7��:�:��
;�s�AE%�%F
�8F�F
c�v�|jj�}|j�\}}|dk(ry|j|d�}	|jj|dd�s*t
|jtd�td��yy#tj$r}t|�Yd}~yd}~wwxYw)z$Remove a trusted software vendor keyNr�zError removing the keyzGThe key you selected could not be removed. Please report this as a bug.)r�r.r/r�r��	RemoveKeyr;�mainr�rr�r=)r/rOr�r��a_iterr�r�s       r0�remove_key_clickedz(SoftwarePropertiesGtk.remove_key_clicked�s����&�&�4�4�6�	�#�0�0�2�����T�>���o�o�f�a�(��	7��<�<�)�)�#�c�r�(�3��d�i�i��0�1��7�8�9�4��
�!�!�	7�3�A�6�6��	7�s�AB�B8�#B3�3B8c��	|jj�y#tj$r}t	|�Yd}~yd}~wwxYw)zRestore the original keysN)r��
UpdateKeysrr�r=�r/rOr�s   r0�on_restore_clickedz(SoftwarePropertiesGtk.on_restore_clicked�s8��	7��L�L�#�#�%���!�!�	7�3�A�6�6��	7����A�A�Ac�&�|j|�y)zClose the window if requestedF)�on_close_button)r/rO�argss   r0�on_delete_eventz%SoftwarePropertiesGtk.on_delete_event�s�����V�$�r2c���|jdk(rI|jjdk(r0t|j|j
�}|j
�|j�y)zpShow a dialog that a reload of the channel information is required
           only if there is no parent definedTFN)rrU�	no_updaterrmrVrL�quit)r/rO�ds   r0r]z%SoftwarePropertiesGtk.on_close_button�sO��
�%�%��-����&�&�%�/�#�D�$4�$4�$(�L�L�2�A�
�E�E�G��	�	�r2c��	|jj�y#tj$r}t	|�Yd}~yd}~wwxYw)z& when a cdrom is requested for adding N)r��AddCdromSourcerr�r=rYs   r0�on_button_add_cdrom_clickedz1SoftwarePropertiesGtk.on_button_add_cdrom_clicked�s8��	7��L�L�'�'�)���!�!�	7�3�A�6�6��	7�r[c�*�|jjd�|jjd�|jjd�|jjd�|j
jd�|j
jd�|jjtd��|tjjk(r0|jd�}|j
j|dz�yy)NFTzApplying changes...�
percentagegY@)�button_driver_revertr��button_driver_apply�button_driver_restart�button_driver_cancel�progress_bar�label_driver_actionrr��
packagekit�ProgressType�
PERCENTAGEr9�set_fraction)r/�progress�ptyper��
prog_values     r0�on_driver_changes_progressz0SoftwarePropertiesGtk.on_driver_changes_progress�s����!�!�-�-�e�4�� � �,�,�U�3��"�"�.�.�u�5��!�!�-�-�d�3����%�%�d�+����%�%�d�+�� � �*�*�1�-B�+C�D��J�+�+�6�6�6�!�.�.�|�<�J����*�*�:��+=�>�7r2c�p�	|jj|�|s�|jjd�|j�|j�|j�|j�|jjd�|jjd�|j jd�|j"j%d�yy#t$rD}|j�t	|j
t
d�t|��Yd}~��d}~wwxYw)NzError while applying changesFT)r��generic_finishr%�on_driver_changes_revertr;rmr�rarmr��
clear_changesr��set_driver_action_status�"update_label_and_icons_from_statusrirjrl�scrolled_window_driversr~)r/r�result�installs_pendingr�s     r0�on_driver_changes_finishz.SoftwarePropertiesGtk.on_driver_changes_finish�s���	O��L�L�'�'��/� ����)�)�%�0���� ��!�!�#��)�)�+��3�3�5��%�%�1�1�$�7��$�$�0�0��6��%�%�1�1�%�8��(�(�6�6�t�<� ���	O��)�)�+��$�"�"�A�&D�$E�s�1�v�N�N��	O�s�C(�(	D5�19D0�0D5c
��tj�|_g}g}d}|jD]�}|jr�|j|j
|j|��d|jvs�Id}|j|j|d�D]:}|js�|j|j
|j|���<��|j|j
|j|����tj�|_	|rFd}|rd}|jj|dd|j|jd|j|�|rn|r.g}|D]'}	|	j!d�d}
|j|
��)|jj#||j|jd|jd�|j$j'd�|j(j'd�|j*j'd�y#t,$r$}t/dj1|��Yd}~yd}~wwxYw)NF�nvidiaTr(�;rz;Warning: install transaction not completed successfully: {})ro�Taskr��driver_changes�current_verrb�get_package_idr�r�get_dependenciesr
�Cancellable�cancellable�remove_packages_asyncrvr�r\�install_packages_asyncrir~rjr}r%r r�)r/r��installs�removals�
has_nvidia�pkg�depr�
to_install�itemrr�s            r0�on_driver_changes_applyz-SoftwarePropertiesGtk.on_driver_changes_apply�s��!���(��������
��&�&�	J�C�������� 3� 3�D�N�N�C� H�I��s�x�x�'�!%�J�#�4�4�T�^�^�S�(�S�V���?�?�$�O�O�D�,?�,?����PS�,T�U�V����� 3� 3�D�N�N�C� H�I�	J��?�?�,��� 	[��#(� ��'+�$����2�2�8�!� � �,�,� �;�;�$� �9�9�,����!#�J� (�0��#�z�z�#��q�1��"�)�)�$�/�0����3�3�H��(�(��7�7� ��5�5���
�%�%�3�3�E�:��$�$�2�2�5�9��(�(�6�6�u�=���	[��O�V�V�WX�Y�Z�Z��	[�s�D	H#�#	I�,I�Ic�6�|jD]}|jd��|jD]"}|j|}|jd��$|j�|jjd�|jjd�y)NTF)�no_drvr��orig_selectionrzrir~rj)r/r�r��aliass    r0ryz.SoftwarePropertiesGtk.on_driver_changes_revert%s����k�k�	$�F����d�#�	$��(�(�	$�E��(�(��/�F����d�#�	$�	
�����!�!�/�/��6�� � �.�.�u�5r2c�X�|jj�|j�yr()r��cancelrz)r/�
button_cancels  r0�on_driver_changes_cancelz.SoftwarePropertiesGtk.on_driver_changes_cancel5s �������!����r2c�0�dtjvrtjd}nd}|dk(r7tjjd�rt	j
ddg�y|dk(r6tjjd�rt	j
d	g�y|d
k(r6tjjd�rt	j
dg�y|d
k(r7tjjd�rt	j
dg�yyy)N�XDG_CURRENT_DESKTOP�Unknownzubuntu:GNOMEz/usr/bin/gnome-session-quitzgnome-session-quitz--reboot�XFCEz/usr/bin/xfce4-session-logoutzxfce4-session-logout�LXDEz/usr/bin/lubuntu-logoutzlubuntu-logout�LXQtz/usr/bin/lxqt-leavez
lxqt-leave)rjrIrk�exists�
subprocess�call)r/�button_restart�desktops   r0�on_driver_restart_clickedz/SoftwarePropertiesGtk.on_driver_restart_clicked9s��� �B�J�J�.��j�j�!6�7�G��G��~�%������<�=��O�O�1�:�>�?�����g�g�n�n�<�=��O�O�3�4�5�����g�g�n�n�6�7��O�O�-�.�/�����g�g�n�n�2�3��O�O�\�N�+�4� r2c� �i|_g|_yr()r�r�r.s r0rzz#SoftwarePropertiesGtk.clear_changesMs�� ��� ��r2c��tjtd�d��|_|jj	d|j
�tjtd�d��|_|jj	d|j�tjtd�d��|_|jj	d|j�tjtd�d��|_
|jj	d|j�|jjd�|jjd�|jjd�|jjd�|jjd�|jjd�|jj|jddd	�|jj|jddd	�|jj|jddd	�|jj|jddd	�tj j"tj j"ddd
�}tj$ddtd�i|��|_|j(j+|j&�tj,�|_|jj|j.ddd	�|j.jd�i|_d|_g|_i|_g|_d	|_d|_y
)zAdditional Drivers tab�Re_vertT)r��
use_underline�clickedz_Apply Changes�_Cancelz_Restart...Fr)�halign�valign�vexpand�visibler�z"Searching for available drivers...Nr7)r�Buttonr�rir�ryrjr�rlr�rkr�r~r��box_driver_action�pack_end�Align�CENTER�Label�label_driver_detail�box_driver_detailr�ProgressBarrm�devicesr�r�r�r��nonfree_drivers�ui_building)r/�propss  r0r�z"SoftwarePropertiesGtk.init_driversQs���%(�J�J�Q�y�\�QU�$V��!��!�!�)�)�)�T�5R�5R�S�#&�:�:�A�6F�4G�W[�#\�� �� � �(�(��D�4P�4P�Q�$'�J�J�Q�y�\�QU�$V��!��!�!�)�)�)�T�5R�5R�S�%(�Z�Z�a�
�6F�VZ�%[��"��"�"�*�*�9�d�6T�6T�U��!�!�/�/��6��!�!�-�-�d�3�� � �.�.�u�5�� � �,�,�T�2��!�!�-�-�e�4��"�"�.�.�u�5����'�'��(@�(@�%��PQ�R����'�'��(A�(A�5�%�QR�S����'�'��(B�(B�E�5�RS�T����'�'��(A�(A�5�%�QR�S��)�)�*�*�S�Y�Y�5E�5E��4�1��#&�9�9�$M�1�6B�4C�$M�FK�$M�� ����"�"�4�#;�#;�<��O�O�-������'�'��(9�(9�5�%��K����%�%�e�,����"��� ��� ������ ��� ��r2c�V�d|_	tj|j�|_tj|j�y#tj|jjtd��tjtj��YyxYw)NTz.An error occurred while searching for drivers.)r�r�system_device_driversr�r�rr�r��set_textr��sys�
excepthook�exc_info�show_driversr.s r0r�z$SoftwarePropertiesGtk.detect_drivers~s{��!���
	�!�7�7����G�D�L�	
�
�
�d�'�'�(��	��M�M�$�2�2�;�;��L�M�
O�

�N�N�C�L�L�N�+��s�$A
�
AB(c��|jryd}|rh|j|}	tj|j|�}|j|}|r'|js|j
j
|�|j�rf||j
vr|j
j|�|��||jvr�||j|ur�|j
j
|�n}||j
vr|j
j|�||jvr||j|<|�5||j
vr'|jr|j
j
|�|jjt|j
��|jjt|j
��y#ttf$rY��bwxYwr()r�r�r�get_linux_modules_metapackager�r�rb�KeyError�	TypeErrorr�rr�rir~rrj)r/r��modalias�pkg_namer��modules_package�modules_package_objs       r0�on_driver_selection_changedz1SoftwarePropertiesGtk.on_driver_selection_changed�s�����������.�.��*�C�
�"(�"F�"F�t�~�~�W_�"`��&*�n�n�_�&E�#�"�+>�+J�+J��'�'�.�.�/B�C������d�)�)�)��#�#�*�*�3�/����� 3� 3�3��d�&9�&9�(�&C�C��#�#�*�*�3�/��d�)�)�)��#�#�*�*�3�/��t�2�2�2�06��#�#�H�-����t�2�2�2�����#�#�*�*�3�/��!�!�/�/��T�5H�5H�0I�J�� � �.�.�t�D�4G�4G�/H�I��3�i�(�
��
�s�AG
�
G�Gc���td�dftd�dftd�dftd�dfd�}iiiid�}d	}d	}	|d
rddtd�d
�i|d<|dD�]F}|d|}d}	|dr|drd}d	}		|drd}	d}	|j|}
|
j}|jj|
�}|�X|jj|jd�td�j|jj|�}
ntd�j|�}
|drtd�}ntd�}|dk(rtd�}ntd�}|j|
|��}
d	}|	s
|ds|}|rd}d}||j|||
|	d����I|sd	}|sd}d|td�d
�i|d <n*|s(d!D]#}||D]}|||ds�d|||d"<��%|D] }||D]}|||d"s�||\}}��"|fS#t$rY���wxYw#t$rY���wxYw#t$rY���wxYw#t$rtdj||��Y��wxYw)#a�Get various device data used to build the GUI.

          return a tuple of (overall_status string, icon, drivers dict).
          the drivers dict is using this form:
            {"recommended/alternative": {pkg_name: {
                                                      'selected': True/False
                                                      'description': 'description'
                                                      'builtin': True/False
                                                    }
                                         }}
             "manually_installed": {"manual": {'selected': True, 'description': description_string}}
             "no_driver": {"no_driver": {'selected': True/False, 'description': description_string}}

             Please note that either manually_installed and no_driver are set to None if not applicable
             (no_driver isn't present if there are builtins)
        z,This device is using the recommended driver.zrecommended-driverz+This device is using an alternative driver.zother-driverz1This device is using a manually-installed driver.zThis device is not working.zdisable-device��recommended�alternative�manually_installed�	no_driverF�manual_installTz*Continue using a manually installed driver)�selectedrr��driversr�r��from_distro�builtinrzUsing {} from {}zUsing {}zHWARNING: a driver ({}) doesn't have any available package associated: {}�freezopen source�proprietaryz&{base_description} ({licence}, tested)z{base_description} ({licence}))�base_description�licence)r�rr�zDo not use the devicer�)r�r�r�)
r�r�r�r�r��get_candidate_verr��lookup�	file_listr��
short_descr �
setdefault)r/�device�possible_overall_status�returned_drivers�have_builtin�one_selected�pkg_driver_name�current_driver�
driver_statusr�r��	installed�	candidaterr��base_stringr��sectionr��keys�overall_status�icons                      r0�gather_device_dataz(SoftwarePropertiesGtk.gather_device_data�ss��&�L�M�Oc�d��K�L�n�]�#$�%X�#Y�[i�"j��9�:�<L�M�	#
��,.�b�XZ�ik�l������	��&�'�:>�T�IJ�Kw�Ix�Az�:{� �!5�6�
 &�i�0�6	^�O�#�I�.��?�N�*�M�
�!�-�0�^�M�5R�$1�M��G�
�!�)�,�"�G�#'�L�
��n�n�_�5���O�O�	� �M�M�;�;�C�@�	��(��L�L�'�'�	�(;�(;�A�(>�?�"#�$6�"7�">�">�t�|�|�?V�?V�Xg�"h�K�"#�J�-�"6�"6��"G�K��f�%��M�*���M�*���
�-�� H�I��� @�A��%�,�,�k�SZ�,�[�K��H��#3�4H�#I�$���#�H�#'�L��]�+�6�6��U]�Xc�T[�I]�
^�i6	^�r��H����-1��CD�E\�C]�4_�-`��[�)� �=�S�G�$4�W�$=�S��+�G�4�X�>�y�I�NR�,�W�5�h�?�
�K�S�S�(�	N�G�(��1�
N��#�G�,�T�2�:�>�-D�W�-M�*�^�T�
N�	N�
��&6�7�7��a�	��	���
��
���
��
���
��`�g�g�hw�zH�I�J��
�sI�H�,H'�;	H7�B*I�	H$�#H$�'	H4�3H4�7	I�I�$I/�.I/c���|js%|jjtd��y|jj|j�d|_i|_t|jj��D�]�}|j|j|�\}}}tj�}|jtjj�|j!tjj"�|j%|tj&j(�tj*dtj,j.��}|j1|ddd�tj*dtj,j2��}|j1|ddd�tj4j7dj9|j|j;dtd	��|j|j;d
td	����}|j!tjj�|j1|ddd�tj4j7dj9|��}|j!tjj�|j=d�|j1|ddd�||f|j|<d}	dD�]}
||
D�]}tj>jAd||
|d
�}|	r|jC|	�n|}	|j1|ddd�|jE||
|d�|
dk(r|jFjI|�|
dvsd||
|vr)||
|dr|jKd|jL|�n|jKd|jL||�|ds��|
dk7s��|jOd�����|jj1|ddd����d|_|jjQ�|jS�y)Nz No additional drivers available.T�)�spacing�orientationFrz{}: {}�vendorr�r��<small>{}</small>r�rr�r�)�manually_installr�r�r�r�)*r�r�r�r�r�rr��dynamic_device_status�sortedr�r�r�Image�
set_valignr��START�
set_halignr��set_from_icon_name�IconSize�MENU�Box�Orientation�
HORIZONTALr.�VERTICALr�ryr�r�set_use_markup�RadioButton�new_with_label�
join_groupr�r�rbr�r�r~rr{)
r/r�r�r�r�r��
device_box�
device_detailrO�option_groupr��driver�radio_buttons
             r0r�z"SoftwarePropertiesGtk.show_drivers)s����|�|��$�$�-�-�a�0R�.S�T���"�"�)�)�$�*B�*B�C����%'��"��T�\�\�.�.�0�1�*	K�F�.2�.E�.E�d�l�l�SY�FZ�.[�+�^�T�7��I�I�K�M��$�$�S�Y�Y�_�_�5��$�$�S�Y�Y�%5�%5�6��,�,�T�3�<�<�3D�3D�E��������8R�8R�S�J��!�!�-���q�A��G�G�A�3�?�?�;S�;S�T�M��!�!�-��t�Q�?��Y�Y�]�]�8�?�?�4�<�<��3G�3K�3K�H�VW�Xa�Vb�3c�ei�eq�eq�rx�ey�e}�e}�F�HI�JS�HT�fU�$V�W�F����c�i�i�o�o�.��$�$�V�T�5�!�<��Y�Y�]�]�#6�#=�#=�n�#M�N�F����c�i�i�o�o�.��!�!�$�'��$�$�V�T�5�!�<�2?��1H�D�&�&�v�.��L�\�
:��%�g�.�:�F�#&�?�?�#A�#A�$��PW�HX�Y_�H`�an�Ho�#p�L�#�$�/�/��=�'3��!�,�,�\�4���J� �+�+�G�G�,<�V�,D�Z�,P�Q��+�-����*�*�<�8��"C�C�	�U\�]d�Ue�fl�Um�Hm�ry�{B�sC�DJ�sK�LU�sV�$�,�,�Y��8X�8X�Z`�a�$�,�,�Y��8X�8X�Z`�bh�i��3�4��DX�9X�$�2�2�5�9�!:�
:�&
�"�"�-�-�j�%���J�U*	K�X!������'�'�)��%�%�'r2c�"�|jD]�}|j|j|�\}}}|j|\}}|j|tj
j�|jdj|����y)zBUpdate the current label and icon, computing the new device statusr�N)	r�r�r�rrrrrr�)r/r�r�r�r�r�rOs       r0r|z8SoftwarePropertiesGtk.update_label_and_icons_from_statusbs����l�l�	I�F�.2�.E�.E�d�l�l�SY�FZ�.[�+�^�T�7�&*�&@�&@��&H�#�]�F��,�,�T�3�<�<�3D�3D�E����0�7�7��G�H�	Ir2c���tjjd�r[|jj	td��|jjd�|jjd�yd|_
|jD]b}|j|dD]K}|j|}|j|d|dr�+|js�8|jdz|_
�M�d|jdkDrJ|jj	tjdd	|j�d
|jiz�y|jj	td��y)Nz/var/run/reboot-requiredz@You need to restart the computer to complete the driver changes.Trr�r�r
z$%(count)d proprietary driver in use.z%%(count)d proprietary drivers in use.�countz"No proprietary drivers are in use.)rjrkr�rnrr�rkr�rm�set_urgency_hintr�r�r�r�r�ngettext)r/r�r�r�s    r0r{z.SoftwarePropertiesGtk.set_driver_action_statuslsJ���G�G�N�N�5�6��$�$�.�.�q�1s�/t�u��&�&�2�2�4�8����-�-�d�3�� ����l�l�	D�F� �L�L��0��;�
D���n�n�X�.���|�|�F�+�I�6�x�@��H�S�_�_�+/�+?�+?�!�+C�D�(�
D�	D����!�#��$�$�.�.�w�/?�/?�/U�/V�/3�/C�/C�0E�3:�4�;O�;O�1P�	0Q�
R�
�$�$�.�.�q�1U�/V�Wr2c�$�t|�|_yr()r�ubuntu_pro_pager.s r0r�z%SoftwarePropertiesGtk.init_ubuntu_pro�s��,�T�2��r2)NNNN)rr()Kr3r4r5rar�r�r�r�r�r�r�r�r�rPrSr�r�r�r6r�r+r0rrrr�r�r�rhr�r�r�r�r�r�r�r�r
rr�r�r�r�r�r�r�r�r�r�r,r�r:r=r@rPrVrZr_r]rfrvr�r�ryr�r�rzr�r�r�r�r�r|r{r�r7r2r0rSrS�s���x&�t1�!�
_�>�>�
]�BY�09�&pN�d<�
>�
0�BN�,D�-�N�&7�P7�@7�
7�7�;�7�$,� �R�I�V'�7�"@�&�	�	�4�
*�/�
�)� �2�
2�:��*�
�$	;�;�,+�1�*
;�;�.7� 7��
	�7�?�=�"5[�n6� �,�(!�+!�Z)�"&J�Pp8�d7(�rI�X�03r2rS)Lr�rr�	dbus.glib�dbus.mainloop.glibrr�rjr�r:r�r�r��gi�require_version�
gi.repositoryrror	rrr
rr�aptsources.sourceslistrrrrrrrrrr��softwareproperties.distro�%softwareproperties.SoftwarePropertiesr�softwareproperties.gtk.utilsrrrr�
UbuntuDriversr�mainloop�glib�
DBusGMainLoop�pyglib_version�threads_init�range�LIST_MARKUP�LIST_ENABLEDr0r�r�r�r�r��STORE_ACTIVE�STORE_DESCRIPTIONr�r��
STORE_VISIBLEr+r,r-r*r]r^r_�objectr&r=r;rSr7r2r0�<module>r.s���6����� ��	����
��	�����5�%� �����5�%� �����7�C� �����#�U�+�6�=�=�4�4� �&�"�.�4�6�(�� �D�,���!��
�
��� � �� �5�����"��D����.3�A�h�+��l�N�
	��q��N��������	��q��N�
������
�!�H�������������&��&�
�h3�.�0C�h3r2

Youez - 2016 - github.com/yon3zu
LinuXploit