%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/LanguageSelector/gtk/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/LanguageSelector/gtk/__pycache__/GtkLanguageSelector.cpython-312.pyc

�

k�!f�����ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddlZejdd�ejdd�ddlmZmZmZddlZddlZddlmZdd	l�dd
lmZdd	l�ddlmZdd	l�ddlmZdd
l m!Z!e"d�\Z#Z$e"d�\Z%Z&e"d�\Z'Z(d�Z)d�Z*d�Z+d�Z,gd�Z-Gd�dej\j^j`�Z1Gd�de2�Z3y)�)�print_functionN)�gettext�Gdkz3.0�Gtk)�GObjectrr)�inline_callbacks)�*)�AptProgressDialog)�ImConfig)�language2locale)�ExceptionPkgCacheBroken�c��||zS)z  helper to simplify the reading �)�a�bs  �J/usr/lib/python3/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py�xorr1s���q�5�L�c����fd�}|S)�2 decorator to ensure that the signals are blocked c�@��d|d_�|i|��}d|d_|S)NTrF��
_blockSignals��args�kwargs�res�fs   �r�wrapperzblockSignals.<locals>.wrapper7s/��� $��Q����� �� �� %��Q����
rr�rr s` r�blockSignalsr"5�����
�Nrc����fd�}|S)rc�8��|djry�|i|��}|S�Nrrrs   �rr z$honorBlockedSignals.<locals>.wrapper@s'�����7� � ���� �� ���
rrr!s` r�honorBlockedSignalsr'>r#rc����fd�}|S)z�
    decorator to ensure that a given function is run insensitive
    warning: this will not stack well so don't use it for nested
    stuff (a @insensitive func calling a @insensitve one)
    c�h��|djd��|i|��}|djd�|S)NrFT)�setSensitivers   �rr zinsensitive.<locals>.wrapperMs;����Q����U�#��� �� ���Q����T�"��
rrr!s` r�insensitiver+Gs����
�Nr)�!�B�dc�*�eZdZefd�Zdd�Zd�Zd�Zy)�GtkProgressc��|dd|_d|_d|_t|jj	d��|_||_||_||_|jj�|j�jtjj�|jj|�yr&)�steps�base�old�int�pop�next�_parent�_window�_progressbar�realize�
get_window�
set_functionsr�
WMFunction�MOVE�set_transient_for)�self�host_window�progressbar�parentr2s     r�__init__zGtkProgress.__init__[s����1�X��
���	������
�
���q�)�*��	����"���'������������ �.�.�s�~�~�/B�/B�C����&�&�v�.rNc�v�|jj�|jjd�|�"d|_|j
j
�n�|j|kDr;|j|_	t|jjd��|_|j|dz|j|jz
zz}||_|j
j|dz�tj�r*tj�tj�r�)yy#Y��xYw)NFrr.gY@)r9�showr8�
set_sensitiver4r:�pulser7r3r5r2r6�set_fractionr�events_pending�main_iteration)rA�percent�progresss   r�updatezGtkProgress.updatejs���	
���������"�"�5�)��?��D�H����#�#�%��x�x�'�!� �I�I��	�� #�D�J�J�N�N�1�$5� 6�D�I��y�y�7�3�;�$�)�)�d�i�i�2G�#H�H�H��D�H����*�*�8�E�>�:�� � �"���� �� � �"����s�;)D4�4D8c�:�|jjd�y�NT)r8rH�rAs r�donezGtkProgress.done�s�����"�"�4�(rc�8�|jj�y�N)r9�hiderRs rrVzGtkProgress.hide�s�������rrU)�__name__�
__module__�__qualname__�STEPS_UPDATE_CACHErErOrSrVrrrr0r0Zs��)�
/�!�.)�rr0c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ed	��Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zed��Zd�Zed��ZeZeZd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#ed��Z$d/d �Z%d!�Z&d"�Z'd#�Z(d$�Z)d%�Z*d&�Z+d'�Z,e-d(��Z.e-d)��Z/e-e0d*���Z1d+�Z2e-d,��Z3e-e0d-���Z4e-e0d.���Z5y)0�GtkLanguageSelectorc�J�tj||�||_tj�|_|j
j
d�|j
j|dz�|j
j|�	tjd�dtj�v}	tjd�dtj�v}tj�dk(xs|xs||_d|_d}t#j$�D]3}|j&dk\r|j&d	kr|d
z
}|dk\s�,d|_n|j(}tj*t,j.t,j.�}tj0�}	|j3|	d�|j5|	dt6�|j9|�||_t<j>jA�|_!|jD}tj*t,j.t,j.�}tj0�}	|j3|	d�|j5|	dtF�|j9|�tI�|_$d|_%|jM�|jO�|jQ�|jS�|jU�|jVjYd�|jZjYd�|j\jYd�|j^jYd�|j`jc�|jed�|j�r�|jfjh�sUtjjtjljntjpjr�
�}
|
jud�|
jw|j`�|
jydt{d��dt{d����d|
_>|
jt{d�tj�j��|
j��}|
j��|tj�j�k(rB|jed�|j��|jQ�|jed�|j:j�r|j��|jHj��s|jDjYd�|jed�y#t$rd}Y���wxYw#t$rd}Y���wxYw)Nzlanguage-selectorz/data/LanguageSelector.ui�adminrF�sudori�i���T�text��message_type�buttons�<big><b>z!No language information available�</b></big>

z�The system does not have information about the available languages yet. Do you want to perform a network update to get them now? ��_Update)H�LanguageSelectorBaserE�_datadirr�Builder�widgets�set_translation_domain�
add_from_file�connect_signals�grp�getgrnam�os�	getgroups�KeyError�getuid�is_admin�has_other_users�pwd�getpwall�pw_uid�combobox_locale_chooser�	ListStorer�TYPE_STRING�CellRendererText�
pack_start�
add_attribute�LANGTREEVIEW_LANGUAGE�	set_model�options�	aptdaemon�client�	AptClient�ac�combobox_input_method�IM_NAMErr�setupLanguageTreeView�setupInstallerTreeView�updateLanguageView�updateLocaleChooserCombo�check_input_methods�button_applyrH�"button_apply_system_wide_languages�button_install_remove_languages�button_apply_system_wide_locale�window_mainrGr*�_cache�havePackageLists�
MessageDialog�MessageType�INFO�ButtonsType�CANCEL�	set_modalr@�
set_markup�_�	set_title�
add_button�ResponseType�YES�run�destroyrO�verify_installed�verifyInstalledLangPacks�	available)rA�datadirr��in_grp_admin�in_grp_sudo�num�l�combo�model�cell�drs            rrEzGtkLanguageSelector.__init__�sI���%�%�d�G�4���
��{�{�}������+�+�,?�@����"�"�7�+F�#F�G����$�$�T�*�	!��<�<��0��3�r�|�|�~�E�L�	 ��,�,�v�.�q�1�R�\�\�^�C�K������)�H�[�H�L��
� %���������	�A��x�x�3��1�8�8�e�#3��q����a�x�'+��$��	��,�,���
�
�g�1�1�7�3F�3F�G���#�#�%��
����t�$�
���D�&�*?�@�
���������"�"�,�,�.����*�*���
�
�g�1�1�7�3F�3F�G���#�#�%��
����t�$�
���D�&�'�2�
����� �
��
�"���	
�"�"�$��#�#�%����!��%�%�'�� � �"�	
���'�'��.�	
�/�/�=�=�d�C��,�,�:�:�4�@��,�,�:�:�4�@�	
���������%� ��=�=��;�;�/�/��%�%�3�?�?�3G�3G�.1�o�o�.D�.D�F�����D�!��#�#�D�$4�$4�5�����9�:��;�<�=�>�
 ������Q�y�\�3�+;�+;�+?�+?�@��e�e�g���	�	���#�*�*�.�.�.��%�%�e�,��K�K�M��+�+�-��%�%�d�+��|�|�,�,��-�-�/��}�}�&�&�(��&�&�4�4�U�;����$���U�	!� �L�	!���	 ��K�	 �s$�,V�9,V�V�V�V"�!V"c�\�|jj|�}|�td|z��|S)z'Convenient access to GtkBuilder objectszNo such widget: )rl�
get_object�AttributeError)rA�name�os   r�__getattr__zGtkLanguageSelector.__getattr__�s3��
�L�L�#�#�D�)���9� �!3�d�!:�;�;��rc���|jj�}|r/|jjd�|rk|jd�nY|jjd�|r<|jt	j
tjj��tj�r*tj�tj�r�)yy)NTF)r�r<rH�
set_cursorr�Cursor�
CursorType�WATCHrrKrL)rA�value�wins   rr*z GtkLanguageSelector.setSensitives������)�)�+������*�*�4�0�����t�$����*�*�5�1�����s�z�z�#�.�.�*>�*>�?�@�� � �"���� �� � �"rc��d�}d�}tj�}tjtd�|t��}|jdd�|j
||d�|jj|�tj�}|jd|j�tjtd	�|�}|j
||d�|jj|�tjttj�|_|jj#|j �y)
�  do all the treeview setup here c��|j|t�}|j}|jd|j�|jd|�y)N�active�inconsistent)�	get_value�LIST_LANG_INFOr��set_property�
fullInstalled)�columnr�r��iter�data�langInfor�s       r�toggle_cell_funczDGtkLanguageSelector.setupInstallerTreeView.<locals>.toggle_cell_func-sG�����t�^�<�H�$�0�0�L�
���h��(>�(>�?����n�l�;rc��|j|t�}|j|t�}|jrd|z}nd|z}|j	d|�y)Nz	<b>%s</b>�%s�markup)r�r��	LIST_LANG�changesr�)�cell_layout�rendererr�r�r�r��langNamer�s        r�lang_view_funczBGtkLanguageSelector.setupInstallerTreeView.<locals>.lang_view_func8sN�����t�^�<�H����t�Y�7�H�� � �$�x�/�������!�!�(�F�3r�Language�ra�expandTN�toggled�	Installed)rr~�TreeViewColumnr�r�r��set_cell_data_func�treeview_languages�
append_column�CellRendererToggle�connect�
on_toggledr|�strr�
TYPE_PYOBJECT�	_langlistr�)rAr�r�r�r�s     rr�z*GtkLanguageSelector.setupInstallerTreeView+s���		<�	4��'�'�)���#�#�A�j�M�8�)�L�����H�d�+��!�!�8�^�T�B����-�-�f�5��(�(�*������D�O�O�4��#�#�A�k�N�H�=���!�!�8�-=�t�D����-�-�f�5����s�G�,A�,A�B������)�)�$�.�.�9rc����fd�}tj�}tjtd�|t��}|jdd�|j
||d��jj|�tjtjtj��_�jj�j�y)r�c�|��|j|t�}d}|j�}|r:|j|t�}||k(rd}n|dk(rd}n|j|�}|r�:|r"d�
jj|dd��z}	n!d�
jj|dd��z}	|j
d|	�y)NF�enTz!<span foreground="grey">%s</span>)�native�allCountriesr�r�)r��LANGTREEVIEW_CODE�get_iter_first�	iter_next�_localeinfo�	translater�)r�r�r�r�r�r��greyFlag�myiterr�r�rAs          �rr�zAGtkLanguageSelector.setupLanguageTreeView.<locals>.lang_view_funcRs�������t�->�?�H��H��)�)�+�F���o�o�f�->�?���(�?�$�H���$�;�#�H������0����>��)�)�3�3�H�T�X\�3�]�^���� 0� 0� :� :�8�D�_c� :� d�d���!�!�(�F�3rr�r�r�TN)rr~r�r�r�r�r��treeview_localesr�r|rr}�_language_optionsr�)rAr�r�r�s`   rr�z)GtkLanguageSelector.setupLanguageTreeViewPs����	4�(�'�'�)���#�#�A�j�M�8�BW�X�����H�d�+��!�!�8�^�T�B����+�+�F�3�"%���w�/B�/B�G�DW�DW�!X������'�'��(>�(>�?rc��|jj�\}}|sy|jj|�}|jj	|t
�}|SrU)r��
get_cursorr��get_iterr�r�)rA�pathr�r�r�s     r�_get_langinfo_on_cursorz+GtkLanguageSelector._get_langinfo_on_cursorpsO���0�0�;�;�=���v����~�~�&�&�t�,���>�>�+�+�D�.�A���rc��|j�}|jj�D]B}t|d�d|dj�d|dj
�d|dj����Dtd|jz�y)Nrz
, available: r`z
, installed: z, doChange: zinconsistent? : %s)r��languagePkgList�items�printr��	installed�doChanger�)rAr��pkgs   r�debug_pkg_statusz$GtkLanguageSelector.debug_pkg_statusxs����/�/�1���+�+�1�1�3�	D�C��c�!�f�c�RS�f�N^�N^�`c�de�`f�`p�`p�ru�vw�rx�sB�sB�C�
D�	D�
�"�X�%:�%:�:�;rc���d}d}d}|jD]W\}}|js�d}|jj�D]&}|js�|j
r|dz}�"|dz}�(�Yt
jdd|�d|iz}t
jdd|�d|iz}|dk(r!|dk(r|jjd	�nk|dk(r|jj|�nJ|dk(r|jj|�n)|jjtd
�||fz�|r|jjd�y|jjd�y)NFrTr`z%(INSTALL)d to install�INSTALLz%(REMOVE)d to remove�REMOVErgz%s, %s)
r�r�r��valuesr�r�r�ngettext�label_install_remove�set_textr�r�rH)	rA�changed�countInstall�countRemove�langr��item�textInstall�
textRemoves	         r�check_statusz GtkLanguageSelector.check_status~ss�������� $���	<��T�8������$�4�4�;�;�=�<�D��}�}��>�>�*5��/�K�+7�!�+;�L�<�	<��&�&�'?�AY�[g�h�lu�xD�lE�E���%�%�&<�>T�Va�b�fn�p{�e|�|�
��!���� 1��%�%�.�.�r�2�
�A�
��%�%�.�.�{�;�
�Q�
��%�%�.�.�z�:�
�%�%�.�.�q��{�k�:�=V�/V�W�����+�+�D�1����+�+�E�2rc	��|jj�sy|j}|j�}|sy|j	�|jj�}t
td�dddddd��}t|jj��D]e\}}||vr||n|}|j�}|j|t|�|j|t|�||k(s�U|j|��gy)	N�none�XIM�IBus�SCIM�ThaizFcitx 4zFcitx 5)r�xim�ibus�scim�thai�fcitx�fcitx5)rr�r��	get_model�clear�getCurrentInputMethod�dictr��	enumerate�getAvailableInputMethods�append�	set_value�	IM_CHOICEr��
set_active)	rAr�r��	currentIM�names�i�IMr�r�s	         rr�z'GtkLanguageSelector.check_input_methods�s����}�}�&�&�(���*�*�����!����
���
��M�M�7�7�9�	��!�F�)��V�&�v�]f�ox�y�� ����!G�!G�!I�J�	$�G�Q�� "�e��5��9��D��<�<�>�D��O�O�D�)�R�0��O�O�D�'�4�0��Y��� � ��#�
	$rc���t|jj��	|jD] \}}|jj	|��"	|jj�\}}t|jj��||fS#t
$r<|j
td�td��tjd�Y��wxYw)N�Software database is broken��It is impossible to install or remove any software. Please use the package manager "Synaptic" or run "sudo apt-get install -f" in a terminal to fix this issue at first.r`)r�r��get_changesr��tryChangeDetailsr
�errorr��sys�exit�getChangesList)rArr��to_inst�to_rms     r�build_commit_listsz&GtkLanguageSelector.build_commit_lists�s���
�d�k�k�%�%�'�(�
	�$(�N�N�
7� ��x����,�,�X�6�
7� �;�;�5�5�7���%�	�d�k�k�%�%�'�(������'�	��J�J��/�0��)�*�
+�
�H�H�Q�K�	�s�/B�AC�Cc�f�tjtjjtjj
��}|j
d�|j|j�|jd|�d|���d|_
|j�|j�y)NrbTrerfrg)
rr�r��ERRORr��CLOSEr�r@r�r�r�r�r�)rA�summary�msgr�s    rr,zGtkLanguageSelector.error	su�����3�?�?�+@�+@�&)�o�o�&;�&;�
=��	���D��	���D�,�,�-�	���W�c�B�C����	����	�	�	�rc�>�t|�}|j|d�y)Nrg)r�r,)rAr,r7s   r�_show_error_dialogz&GtkLanguageSelector._show_error_dialogs���%�j���
�
�3��rc��d}	|D].}||jvs�|j|j��0|D].}||jvs�|j|j��0	|jj	�|jj
jdk7r�|jtd�td��t|j|j|j�}tj|j|�|_|j!�d}|S#t$rd}Y��wxYw)z: verify if the selected package can actually be installed TFrz/Could not install the selected language supportz�This is perhaps a bug of this application. Please file a bug report at https://bugs.launchpad.net/ubuntu/+source/language-selector/+filebug)r��mark_install�mark_delete�SystemErrorr�	_depcache�broken_countr,r�r0�dialog_progress�progressbar_cacher��apt�Cacher�rV)rA�	inst_list�rm_listrr�rNs      r�verify_commit_listsz'GtkLanguageSelector.verify_commit_listss%����	� �
4���$�+�+�%��K�K��$�1�1�3�
4��
3���$�+�+�%��K�K��$�0�0�2�
3�	
�������;�;� � �-�-��2��J�J�q�J�K��`�a�
b�#�4�#7�#7�#'�#9�#9�#'�#3�#3�5�H��)�)�D�$4�$4�h�?�D�K��M�M�O��C��
��%�	��C�	�s�D0�2D0�D0�0D>�=D>c�N�|jd�|j�\}}|j||�s6|jt	d�t	d��|jd�y|j||�|jd�t
|�t
|�zS)z� 
        commit helper, builds the commit lists, verifies it
        
        returns the number of install/removed packages
        F�+Could not install the full language supportz�Usually this is related to an error in your software archive or software manager. Check your preferences in Software Sources (click the icon at the very right of the top bar and select "System Settings... -> Software Sources").Tr)r*r2rFr,r��commit�len)rArDrEs   r�commitAllChangesz$GtkLanguageSelector.commitAllChanges5s���	
���%� �#�6�6�8���G��'�'�	�7�;��J�J��?�@��A�B�
C�
���d�#��	
���I�w�'����$���9�~�c�'�l�*�*rc��t|�}|j|j�|jd|j�|j|j��y)N�finished)�
error_handler)r
r@r�r��_on_finishedr��	_on_error)rA�transaction�dias   r�_run_transactionz$GtkLanguageSelector._run_transactionPsF����,�����d�.�.�/����J�� 1� 1�2����d�n�n��-rc���|js`tj�r)tj�tj�r�)t	j
d�|js�_yy)Ng{�G�z�?)�_transaction_finishedrrKrL�time�sleeprRs r�_wait_for_aptdaemon_finishz.GtkLanguageSelector._wait_for_aptdaemon_finishVsH���,�,��$�$�&��"�"�$��$�$�&��J�J�t���,�,rc�2�|j�d|_yrQ)rVrU)rA�dialogs  rrOz GtkLanguageSelector._on_finished\s�����
�%)��"rc���t|d�r?|j�dk(r,|jtd�td��d|_y|jtd�t	|��d|_y)N�
get_dbus_namez-org.freedesktop.PolicyKit.Error.NotAuthorizedrHz(Failed to authorize to install packages.T)�hasattrr\r,r�r�rU)rAr,s  rrPzGtkLanguageSelector._on_error`sq���5�/�*�u�/B�/B�/D�C�0D��
�
��G�H��D�E�G�&*��"�
�J�J��C�D���J�
 �&*��"rc�R�d|_|j�|j�y�NF)rU�_update_aptdaemonrXrRs r�update_aptdaemonz$GtkLanguageSelector.update_aptdaemonls"��%*��"���� ��'�'�)rc#�K�	|jjd����}|j|�y#t$r}|j	|�Yd}~yd}~wwxYw�w)NT)�defer)r��update_cacherS�	Exceptionr9)rA�trans�es   rr`z%GtkLanguageSelector._update_aptdaemonqsS����	'��'�'�.�.�T�.�:�:�E��!�!�%�(���	'��#�#�A�&�&��	'�s*�A�/4�A�	A�A�A�A�Ac�V�d|_|j||�|j�yr_)rU�_commit_aptdaemonrX)rA�inst�rms   r�commit_aptdaemonz$GtkLanguageSelector.commit_aptdaemonys&��%*��"����t�R�(��'�'�)rc	#�K�t|�dk(rt|�dk(ry	|jj|g|gggd����}|j|�y#t$r}|j|�Yd}~yd}~wwxYw�w)NrT)�install�	reinstall�remove�purge�upgrade�	downgraderc)rJr��commit_packagesrSrer9)rArjrkrfrgs     rriz%GtkLanguageSelector._commit_aptdaemon~s������t�9��>�c�"�g��l��	'��'�'�1�1���2�R���D�2�*�*�E�
�!�!�%�(���	'��#�#�A�&�&��	'�s.�A>�5A�A>�	A;� A6�1A>�6A;�;A>c�@�tjj|�SrU)r�Widget�hide_on_delete)rA�widget�events   rrwz"GtkLanguageSelector.hide_on_delete�s���z�z�(�(��0�0rc�D�|j�}t|�dkD�rtjtjj
��}|j
d�|j|j�|jdtd��dtd����|jtd�tjjtd	�tjj�|jtjj�|j!d
�tj"j%td��}tj&�}|j)tj*j,tj*j,�|j/d�tj0�}|j3d
�|j5d
�|j7�}d
}|D]
}|d|zz
}�|j9|d�|j;|j=��|j?|�|j?|�|jA�jC|ddd�|jE�|jG�}	|jI�|	tjjk(rE|jKd
�|jM|g�|jO�|jKd�yyy)zy called at the start to inform about possible missing
            langpacks (e.g. gnome/kde langpack transition)
        r)rcTrez0The language support is not installed completelyrfz}Some translations or writing aids available for your chosen languages are not installed yet. Do you want to install them now?z_Remind Me Later�_Installrg�Details�Fz%s
���N)(�getMissingLangPacksrJrr�r��QUESTIONr�r@r�r�r��add_buttonsr��NOr��set_default_responser��Expander�new�ScrolledWindow�
set_policy�
PolicyType�	AUTOMATIC�set_min_content_height�TextView�set_cursor_visible�set_editable�
get_bufferr�place_cursor�get_start_iter�add�get_message_arear�show_allr�r�r*rIr�)
rA�missingr��expander�scroll�textview�buf�pkgsr�rs
          rr�z,GtkLanguageSelector.verifyInstalledLangPacks�s]��
�*�*�,���w�<�!���!�!�s���/G�/G�H�A�
�K�K���
���� 0� 0�1�
�L�L��D�E��)�*�+�
,�

�M�M�!�.�/��1A�1A�1D�1D��J�-��)9�)9�)=�)=�
?�
�"�"�3�#3�#3�#7�#7�8�
�K�K��O��|�|�'�'��)��5�H��'�'�)�F����c�n�n�6�6����8P�8P�Q��)�)�#�.��|�|�~�H��'�'��.��!�!�%�(��%�%�'�C��D��
%������$��
%��L�L��r�"����S�/�/�1�2��L�L�� ��J�J�x� �
��� �+�+�H�d�D�!�D������%�%�'�C�
�I�I�K��c�&�&�*�*�*��!�!�%�(����G�R�(��'�'�)��!�!�$�'�	+�Crc��|jj�t|j|j|j
�}	|jr"|j|�|j�n|jd�|jj�}|D]�}d}dt j"vrPt j"d}t%j&d|�r'|j(j+|j,d��}|s%|j(j+|j,�}|jj/||g���|jj1t2t4j6j8�y#t$r=|jtd�td��tjd�Y��GwxYw)Nr(r)r`�LANGUAGEzvi[^a-z]T�r�)r�rr0r@rAr�rv�	openCacherVr
r,r�r-r.r��getLanguageInformationrr�environ�re�matchr�r��languageCoder�set_sort_column_idr�r�SortType�	ASCENDING)rArN�languageListr�	lang_name�current_languages      rr�z&GtkLanguageSelector.updateLanguageView�sp���������t�3�3�T�5K�5K�#�/�/�1��
	��}�}����x�(��
�
�����t�$��{�{�9�9�;��!�	5�D��I��R�Z�Z�'�#%�:�:�j�#9� ��8�8�J�(8�9� $� 0� 0� :� :�4�;L�;L�UY� :� Z�I�� �,�,�6�6�t�7H�7H�I�	��N�N�!�!�9�d�"3�4�#	5�$	
���)�)�)�S�\�\�5K�5K�L��='�	��J�J��/�0��)�*�
+�
�H�H�Q�K�	�s�?F�AG�
Gc�@�|j}|j�}|j�dkry||j�\}}|jj	�d}t
j
|j|�}|d|k(ry|j|��y)NrF�LOCALE��
sysFormatsT)	r{r�
get_activer��getSystemDefaultLanguage�macros�LangpackMacrosrj�writeSysFormatsSetting)rAr�r�r�code�old_code�macrs       r�writeSystemFormatsz&GtkLanguageSelector.writeSystemFormats�s����,�,�����!�������!���U�-�-�/�0���t��#�#�<�<�>�q�A���$�$�T�]�]�H�=����>�T�!���#�#�t�#�4�rc��|j}|j�}|j�dkry||j�\}}|jj	�d}|dk(r|jj�d}n|}tj|j|�}|d|k(ry|j|��y)Nrr�F)�userFormatsT)
r{rr�r��getUserDefaultLanguager�r�r�rj�writeUserFormatsSetting)rAr�r�rr��tempr�r�s        r�writeUserFormatsz$GtkLanguageSelector.writeUserFormats�s����,�,�����!�������!���U�-�-�/�0���t����6�6�8��;���4�<��'�'�@�@�B�1�E�H��H��$�$�T�]�]�H�=����>�T�!���$�$��$�6�rc���|jj�\}}||k(ry|j|��|jj�ry|j	|��y)NF)�sysLanguageTr�)r�r��writeSysLanguageSetting�isSetSystemFormatsr�)rA�languageString�formats_locale�
old_strings    r�writeSystemLanguagez'GtkLanguageSelector.writeSystemLanguagesb��'+�'7�'7�'P�'P�'R�$�����'���$�$��$�@����.�.�0��	
�#�#�~�#�>�rc���|jj�d}t|�dk(r|jj�d}n|}||k(ry|j	|��y)Nr`rF)�userLanguageT)r�r�rJr��writeUserLanguageSetting)rAr�r�r�s    r�writeUserLanguagez%GtkLanguageSelector.writeUserLanguagesc�����6�6�8��;���t�9��>��)�)�B�B�D�Q�G�J��J���'���%�%�>�%�B�rc	��|j}|j�}|sy|j�d}|jj	�\}}t|�dk(r|jj
�d}t|�dkDrBtj|j|�}|d}|jj|d��}	|jj�tjdgd��}g}t|jd��D]3\}	}
|j!|jj|
d��|
g��5t|�dkDr||_|jd�}n�d	t$j&vr@t$j&j)d	�|_|j"jd�}n;|jj+|�|_|j"jd�}|j-||�}|D]}	|jj!|	��	t|jj/��D]�\}	}
|j!�}|j1|t2|jj|
d���|j1|t4|
�|s�b|jj|
d��|k(s��|j7|	���|j9�y)
Nrr�Tr�z*/usr/share/language-tools/language-options)�universal_newlines�
�:r�)r{rrr�r�rJr�r�r�rjr�r��
subprocess�check_outputr�splitr�userEnvLanguagerrr��get�
makeEnvString�
bubbleSort�generated_localesr r�r�r"�updateExampleBox)rAr�r��defaultLangName�defaultLangCoder�r�r��mylistr%�option�	languages�
mylist_sorted�locr�s               rr�z,GtkLanguageSelector.updateLocaleChooserCombo%s����,�,�����!����
���
���,0�,<�,<�,S�,S�,U�)��.����1�$�"�.�.�G�G�I�!�L�O����!�#��(�(�����H�D�"�8�n�O�"�.�.�8�8��QU�8�V�O�	2����$�$�&��)�)�
9�:�#�%����$�g�m�m�D�&9�;�	U�K�Q���M�M�4�+�+�5�5�f�T�5�J�F�S�T�	U��~���"�#1�D� �&�,�,�S�1�I��R�Z�Z�'�')�z�z�~�~�j�'A��$� �0�0�6�6�s�;�	�'+�'7�'7�'E�'E�o�'V��$� �0�0�6�6�s�;�	�����	�:�
��	-�A��"�"�)�)�!�,�	-�	5�!�4�#3�#3�#E�#E�#G�I�	$�H�Q���<�<�>�D��O�O�D�"7��$�$�.�.�s�4�.�@�
B��O�O�D�"3�S�9���#�#�-�-�c�$�-�?�?�R�� � ��#�	$�	
���rNc��tdt|�dz
�D]�}tdt|�dz
�D]}||d}||dzd}	|j|�}	|j|�}||kDr||dz||c||<||dz<�W|dk\s�]|dk\s�c||kDs�i||dz||c||<||dz<����|S#d}Y�dxYw#d}Y�[xYw)z�
        Sort the list 'sortlist' using bubble sort.
        Optionally, if a list 'presort' is given, put this list first and bubble sort the rest.
        rr`i��)�rangerJ�index)	rA�sortlist�presortr%�j�data1�data2�v1�v2s	         rr�zGtkLanguageSelector.bubbleSortbs��
�q��X��q��)�	K�A��1�S��]�1�_�-�
K�� ���A��� ��1��
�a�(�� � ���u�-�B� � ���u�-�B��r�E�08��1��
�x��{�-�H�Q�K���1��
��F�l�r�V�|���
�08��1��
�x��{�-�H�Q�K���1��
�
K�	K� ��� ��B�� ��B�s�B:�C�:C�C	c��|j}|j�}|j�dkry|jj	d�|j
j	d�|jj	d�||j�\}}tj|j|�}|d}	tjtj|�|jj	tjdd�	��|j
j	tj d
dd�	��|jj	t#j$tj&tj(���y#tj$r0|jj	dtd�|zzdz�YywxYw)Nrrg�	SYSLOCALEz[ zkFailed to apply the '%s' format
choice. The examples may show up if you
close and re-open Language Support.z ]g�(\��@T)�groupingz%.2fg=
���2A)r{rr��label_example_currencyr�label_example_number�label_example_dater�r�rj�locale�	setlocale�LC_ALL�Errorr��currency�
format_stringrV�strftime�nl_langinfo�D_T_FMT)rAr�r�rr�r��mylocales       rr�z$GtkLanguageSelector.updateExampleBox�s����,�,�����!�������!���#�#�,�,�R�0��!�!�*�*�2�.����(�(��,��U�-�-�/�0���t��$�$�T�]�]�D�9����$��	����V�]�]�H�5�	
�#�#�,�,�V�_�_�X�PT�-U�V��!�!�*�*�6�+?�+?��
�]a�+b�c����(�(����v�7I�7I�&�.�.�7Y�)Z�[���|�|�	��#�#�,�,�T��6�7�9A�B�.B�EI�.I�
J�
�	�s�>$F�AG�Gc�D�|jd|j��yrU)r��	to_string)rA�treeviewr��view_columns    r�#on_treeview_languages_row_activatedz7GtkLanguageSelector.on_treeview_languages_row_activated�s������d�n�n�.�/rc�6�|jj|�}|jj|t�}|jrA|j
j
�D]#}|js�|jr�d|_	�%n�|jrn|j
j
�D]P}|js�|js|jrd|_	�0|js�=|jr�Jd|_	�Rnm|j
j
�D]P}|js�|jr|jrd|_	�0|jr�=|jr�Jd|_	�R|j�|jj�y)z called when on install toggle TFN)r��get_iter_from_stringr�r�r�r�rr�r�r�r�rr��
queue_draw)rAr��path_stringr�r�r�s      rr�zGtkLanguageSelector.on_toggled�s0���~�~�2�2�;�?���>�>�+�+�D�.�A��� � ��/�/�6�6�8�
(���M�M�#�-�-�#'�C�L�
(��
#�
#��/�/�6�6�8�
,���M�M��M�M�c�l�l�',����-�-����'+���
,� �/�/�6�6�8�
,���M�M��
�
�#�,�,�',���!�m�m�C�L�L�'+���
,�	
�������*�*�,rc�8�|jj�yrU)�window_installerrV�rArxs  r�on_button_cancel_clickedz,GtkLanguageSelector.on_button_cancel_clicked�s�����"�"�$rc��|jj�|j�dkDr|j�|j	�yr&)rrVrKr�r�rs  r�on_button_apply_clickedz+GtkLanguageSelector.on_button_apply_clicked�s=�����"�"�$�� � �"�Q�&��#�#�%��%�%�'rc�t�|jj�}|r|j|j�yyrU�r��get_application�
remove_window)rAryr��apps    r�on_delete_eventz#GtkLanguageSelector.on_delete_event��2�����.�.�0������d�.�.�/�rc�t�|jj�}|r|j|j�yyrUr)rArxr	s   r�on_button_quit_clickedz*GtkLanguageSelector.on_button_quit_clicked�rrc��tj|j�}|j�tjj
zr<|dk(r7|jj�}|r|j|j�|j�tjjztjjk(r<|dk(r7|jj�}|r|j|j�y)N�w�Escape)
r�keyval_name�keyval�	get_state�ModifierType�CONTROL_MASKr�rr�	MOD2_MASK)rArxry�keynamer	s     r�on_window_main_key_press_eventz2GtkLanguageSelector.on_window_main_key_press_event�s����/�/�%�,�,�/���?�?��s�/�/�<�<�<��C���"�"�2�2�4�C���!�!�$�"2�"2�3��O�O��� 0� 0� :� :�:�s�?O�?O�?Y�?Y�Y�^e�iq�^q��"�"�2�2�4�C���!�!�$�"2�"2�3�rc�:�|j�}|j�}d}|r?|j|t�}|dk7r|dz}||z}|dk(rn|j	|�}|r�?|j|�||_|j�|j�y)Nrgr�r�)	rr�r�r�r�r�r�r�r�)rArx�drag_contentr�r��envLanguager�s       r�on_treeview_locales_drag_endz0GtkLanguageSelector.on_treeview_locales_drag_ends���� � �"���%�%�'������/�/�&�):�;�C��r�!�)�C�/��%��+�K��d�{���_�_�V�,�F��	
���{�+�*���� � �"��%�%�'rc�:�|j|j�yrU)r�r�rs  r�-on_button_apply_system_wide_languages_clickedzAGtkLanguageSelector.on_button_apply_system_wide_languages_clicked.s��	
� � ��!5�!5�6�rc�8�|jj�yrU)rrGrs  r�*on_button_install_remove_languages_clickedz>GtkLanguageSelector.on_button_install_remove_languages_clicked4s�����"�"�$rc���|j}|j�}|j�dkry||j�\}}|jj	|�yr&)r�rr�r�setInputMethod)rArxr�r��	IM_choice�IM_names      r� on_combobox_input_method_changedz4GtkLanguageSelector.on_combobox_input_method_changed7sW���*�*�����!�������!��$�U�%5�%5�%7�8���G��
�
�$�$�Y�/rc��|j�|j�|j�|j�yrU)r�r�r�r�rs  r�"on_combobox_locale_chooser_changedz6GtkLanguageSelector.on_combobox_locale_chooser_changedDs4��	
� � �"������%�%�'����rc�$�|j�yrU)r�rs  r�*on_button_apply_system_wide_locale_clickedz>GtkLanguageSelector.on_button_apply_system_wide_locale_clickedLs��	
���!�rrU)6rWrXrYrEr�r*r�r�r�r�rr"r�r2r,r9rFrKrSrXrOrPrarr`rlrirOrIrwr�r�r�r�r�r�r�r�r�r�r�rrr
r
r'rrr+rr r%r'r)rrrr\r\�s���u �n�!�H#:�J@�@�<�3�v�$��$�v �(���<+�6.��*�
*�*�
�'��'�*�
�	'��	'��F�
�F�1�-(�^*M�X��$�
��: ��: �x�|\�80�-�:%�(�0�
0�
�
��
�6�(��(�8������%��0��0��� ��� ������rr\)4�
__future__rrrpr�rrrxr�r�r-rVr��gi�require_version�
gi.repositoryrrrrB�aptdaemon.clientr�rcr�aptdaemon.enums�aptdaemon.gtk3widgetsr
�!LanguageSelector.LanguageSelector�LanguageSelector.ImConfigr�LanguageSelector.macros�LanguageSelector.utilsr�LanguageSelector.LangCacher
r�r�r�r�r�r!r�rr"r'r+rZrNr3�
OpProgressr0rir\rrr�<module>r7s���&��
�
�	�
�	��
�� �	�����5�%� �����5�%� �+�+�
��"��3�/�.�%�2�>��1�X�����A�h����
�!�H�
�������"#��*�#�,�,�#�#�.�.�*�XJ�.�Jr

Zerion Mini Shell 1.0