%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/ibus-table/engine/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/ibus-table/engine/__pycache__/main.cpython-312.pyc

�

��Xe�6���ddlmZddlmZddlZddlZddlZddlZddlmZmZm	Z	ddl
Z
ddlZ
ddlm
Z
e
dd�ddlmZdd	lmZddlZddlZe
j&d
�Zed�Z	eeej0d���Zej6j9ej:�d�Zej6j9ej>�d
�Z ej6j9ej:�d�Z!ej6j9ejD�d�Z#ej6j9ejH�d�Z%defd�Z&e&�Z'e'jPrddl)Z)ddl*Z*ddl+Z+e)jX�Z-e'j\rddl/Z/ddl0m1Z1m2Z2m3Z3nddl4Z4Gd�d�Z5de5ddfd�Z6ddededdfd�Z7dd�Z8dd�Z9e:dk(re9�yy#eef$red�ZY��qwxYw) �)�Any)�UnionN)�signal�SIGTERM�SIGINT)�require_version�IBusz1.0)r	)�GLib�
ibus-table�IBUS_TABLE_DEBUG_LEVEL�tablesz
byo-tables�iconszibus-setup-tablez	debug.log�returnc	�|�tj�}|jdddtddd��|jdd	d
ddd
��|jddd
ddd��|jddd
ddd��|jddddddtzdz��|jddd
d dd!��|j�S)"z Parse the command line argumentsz--tablez-t�store�db�z,Set the IME table file, default: %(default)s)�action�type�dest�default�helpz--daemonz-d�
store_true�daemonFz#Run as daemon, default: %(default)s)rrrrz--ibusz-i�ibusz+Set the IME icon file, default: %(default)sz--xmlz-x�xmlz1output the engines xml part, default: %(default)sz
--no-debugz-n�store_false�debugTzWrite log file to z, default: %(default)sz	--profilez-p�profilezlPrint profiling information into the debug log. Works only when --no-debug is not used. default: %(default)s)�argparse�ArgumentParser�add_argument�str�LOGFILE�
parse_args)�parsers �$/usr/share/ibus-table/engine/main.pyr%r%6s��
�
$�
$�
&�F�
����4��
�
��
;�
�=�����D��
��
2��4�����$��
��
:��<�������
��
@��B�����d��
��
!�G�
+�.F�
F��H�����T��
��%��'������)�Element�
SubElement�tostringc�B�eZdZdededdfd�Zd
d�Zd
d�Zddeddfd	�Z	y)�IMApp�dbfile�exec_by_ibusrNc�6�tdkDrtjd|�tj�|_t
j�|_|jjd|j�tj|j|�|_
d|_|r|jjdd�yt
j dddd	d
dd�
�|_d}d}d}d}d}d}d}	d}
d}d}|jj$�r�t&j(j+|jj$j,�j/dd�}d|z}|jj$j0j3d�}|jj$j0j3d�}|jj$j0j3d�}|jj$j0j3d�}|jj$j0j3d�}	|jj$j0j3d�}
|jj$j0j3d�}|jj$j0j3d�}|
rJt&j(j5t6|
�}
t'j8|
t&j:�sd}
dj=t>|�}
t
j@||||||	|
|||
��
}|j"jC|�|jjE|j"�y)N�z IMApp.__init__(exec_by_ibus=%s)
�disconnectedFzorg.freedesktop.IBus.TablerzTable Componentz0.1.0�GPLzYuwei Yu <acevery@gmail.com>z(http://mike-fabian.github.io/ibus-table/r)�name�description�version�license�author�homepage�
textdomainr�en�us�.db�table:r4r5�	languages�creditr8�icon�layout�symbol�{} --engine-name {})
r4�longnamer5�languager7r8rArBrC�	setupdsis)#�DEBUG_LEVEL�LOGGERrr
�MainLoop�_IMApp__mainloopr	�Bus�_IMApp__bus�connect�_IMApp__bus_destroy_cb�factory�
EngineFactory�_IMApp__factory�	destroyed�request_name�	Component�_IMApp__componentr�os�path�basename�filename�replace�ime_properties�get�join�ICON_DIR�access�F_OK�format�	SETUP_CMD�
EngineDesc�
add_engine�register_component)�selfr.r/�engine_namer4rEr5rFr@r8rArBrC�	setup_arg�engines               r'�__init__zIMApp.__init__�s�����?��L�L�<�l�K��-�-�/���#�x�x�z��
��
�
���>�4�+@�+@�A� �.�.�t�z�z�6�B��������J�J�#�#�$@�!�D�#�~�~�1�-���5�C�'� )�D���K��D��H��K��H��F��F��D��F��F��~�~� � � �g�g�.�.��N�N�%�%�.�.�0�07���r�0B����+���>�>�,�,�;�;�?�?��G��"�n�n�/�/�>�>�B�B�!�#���>�>�,�,�;�;�?�?��L�����*�*�9�9�=�=�h�G�����*�*�9�9�=�=�h�G���~�~�(�(�7�7�;�;�F�C�����*�*�9�9�=�=�h�G�����*�*�9�9�=�=�h�G����w�w�|�|�H�d�3���y�y��r�w�w�/��D�-�4�4�Y��E�I��_�_�$�.6�1<�.6�-3�,2�*.�,2�,2�/8�	:�F�
���'�'��/��J�J�)�)�$�*:�*:�;r(c���tdkDrtjd�tjrt
j
�|jj�|j�y)Nr1zIMApp.run()
)
rHrIr�_ARGSr�_PROFILE�enablerK�runrO�rgs r'rpz	IMApp.run�sB����?��L�L��)��=�=��O�O�����������r(c�`�tdkDrtjd�|j�y)Nr1z
IMApp.quit()
)rHrIrrOrqs r'�quitz
IMApp.quit�s"����?��L�L�)�*����r(�busc��tdkDrtjd|�|jrytj	d�|j
j
�d|_|jj�tjr�tj�tj�}tj t|��}|j#�|j%d�|j'dd�|j'd	d�|j'd
d�|j'dd�tj	d|j)��yy)
Nr1zIMApp.__bus_destroy_cb(bus=%s)
zfinalizing:)T)�stream�
cumulative�main�rP�	tabsqlite�tablezProfiling info:
%s)rHrIrrS�inforR�
do_destroyrKrsrmrrn�disable�io�StringIO�pstats�Stats�
strip_dirs�
sort_stats�print_stats�getvalue)rgrt�stats_stream�statss    r'�__bus_destroy_cbzIMApp.__bus_destroy_cb�s�����?��L�L�;�S�A��>�>�����N�#����!�!�#�����������=�=������;�;�=�L��L�L��,�?�E��������\�*����f�b�)����i��,����k�2�.����g�r�*��K�K�-�|�/D�/D�/F�G�r(�rN�N)
�__name__�
__module__�__qualname__r#�boolrkrprsrrO�r(r'r-r-�s=��;<�s�;<�$�;<�4�;<�| � �
H�C�H�4�Hr(r-�ima_insc�L�|j�tj�yr�)rs�sys�exit)r�s r'�cleanupr��s���L�L�N��H�H�Jr(�element�levelc���d|dzz}|r�|jr|jj�s
|dz|_|D]B}t||dz�|jr|jj�r�9|dz|_�Djr|jj�s||_yy|r/|jr|jj�s||_yyy)z#Use to format xml Element pretty :)�
z    r1N)�text�strip�indent�tail)r�r��i�
subelements    r'r�r��s����u�V�|��A���|�|�7�<�<�#5�#5�#7��v�:�G�L�!�	-�J��:�u�Q�w�'��?�?�*�/�/�*?�*?�*A�"#�f�*�
��	-����j�o�o�&;�&;�&=��J�O�'>��'�,�,�g�l�l�.@�.@�.B��G�L�/C�5r(c	�<
�tjt�}tt	d�|��}g}|D]5}|jtjjt|���7	tjt�}tt	d�|��}|D]5}|jtjjt|���7	td�}|D�]�}tj|d��}t|d�}t|d�}tjj|�jdd�}d	|z|_d
j#t$|j �}	t|d�}
d|
_t'j(t&j*d�t'j,t&j.�d}|r|j1�}|sd
}|j2j5djd|g��|
_|
j sC|j2j5djd|j7d�dg��|
_|
j s |j2j5d�|
_|
j s||
_t|d�}|j2j5d�}
|
rb|
j7d�}t9|�dk(r|dj;�|_n*|dj;�j7d�d|_t|d�}|j2j5d�|_t|d�}|j2j5d�|_t|d�}|j2j5d�}|r)tjjt<|�|_t|d�}|j2j5d�|_t|d�}|j2j5d�|_t|d�}|j2j5d�|_t|d�}|	|_t|d�}d|_���t?|�tA|d��jCd�}tEjFd �}|jId|�}tJjLjNjQ|d!zjSd��y"#t$rY��CwxYw)#zF
    Writes the XML to describe the engine(s) to standard output.
    c�$�|jd�S�Nr=��endswith��xs r'�<lambda>zwrite_xml.<locals>.<lambda>�s���
�
�5� 1�r(c�$�|jd�Sr�r�r�s r'r�zwrite_xml.<locals>.<lambda>s���
�
�5�(9�r(�enginesr)�user_dbrjr4r=r>rDrErr;�.�_rFr?�,r1r7r8rArBrCr5�setup�
icon_prop_key�	InputMode�utf8)�encodingzutf-8z
<\?.*\?>\nr�N)*rW�listdir�DB_DIR�list�filter�appendrXr^�
BYO_DB_DIR�OSErrorr)�tabsqlitedb�TabSqliteDbr*rYr[r�rbrc�locale�	setlocale�LC_ALL�	getlocale�LC_MESSAGES�lowerr\r]�split�lenr�r_r�r+�decode�re�compile�subr��stdout�buffer�write�encode)�dbs�_all_dbs�_db�byo_dbs�egs�_sq_db�_engine�_namerhri�	_longname�_locale�	_language�
_languages�_langs�_license�_author�_icon�_icon_basename�_layout�_symbol�_desc�_setup�_icon_prop_key�egsout�patts                          r'�	write_xmlr��s#��
�*�*�V�
�C�
�v�1�3�7�
8�C��H��3����������V�S�1�2�3�
��*�*�Z�(���v�9�7�C�D���	;�C��O�O�B�G�G�L�L��S�9�:�	;��)�
�C��?*���(�(��b�9���S�(�+���7�F�+���g�g�&�&�s�+�3�3�E�2�>���k�)��
�)�0�0��E�J�J�G�	��w�
�3�	��	��	�������+��"�"�6�#5�#5�6�q�9����m�m�o�G���G��.�.�2�2��H�H�f�g�&�'�)�	���~�~�#�2�2�6�6����&�'�-�-��"4�Q�"7�8�9�;�I�N��~�~�#�2�2�6�6�v�>�I�N��~�~�(�I�N��w�
�3�	��*�*�.�.�{�;�
���%�%�c�*�F��6�{�a��!'�����!2�	��"(�����!2�!8�!8��!=�a�!@�	���g�y�1���-�-�1�1�)�<��
��W�h�/���,�,�0�0��:����7�F�+���.�.�2�2�6�:��������h��?�E�J��W�h�/���,�,�0�0��:����W�h�/���,�,�0�0��:����7�M�2���*�*�.�.�}�=��
��G�W�-�����#�G�_�=��)���?*�D�3�K�
�c�F�
+�
2�
2�7�
;�F�
�:�:�m�$�D�
�X�X�b�&�
!�F�
�J�J�����V�D�[�0�0��9�:��_�
��
�s�-A)T�	T�Tc
���tjrt�ytj�}tj
r+tjjtddddddd��}tjd�}|j|�tjtj�tj|�tjd	�t!j"�tj$r(t'j(�rt+j,�tj.r�t'j0tj.t&j2�rtj.}nRt4�t&j6j8�t&j6j;tj.���}nd
}t=|tj>��tAtB�fd��tAtD�fd��	�jG�y#tH$r�jK�YywxYw)
zMain programN�midnightr1�zUTF-8F)�when�interval�backupCountr��delay�utc�atTimezP%(asctime)s %(filename)s line %(lineno)d %(funcName)s %(levelname)s: %(message)sz********** STARTING **********rc���t��Sr��r���signum�stack_frame�imas  �r'r�zmain.<locals>.<lambda>�s������r(c���t��Sr�r�r�s  �r'r�zmain.<locals>.<lambda>�s���w�s�|�r()&rmrr��logging�NullHandlerr�handlers�TimedRotatingFileHandlerr$�	Formatter�setFormatterrI�setLevel�DEBUG�
addHandlerr|r	�initrrW�forkr�r�rr`rar�rX�seprYr-rrrrrp�KeyboardInterruptrs)�log_handler�
log_formatterrr�s   @r'rxrxWsz����y�y����
���!��
�{�{��&�&�?�?���������@����%�%�	��M����]�+�
�O�O�G�M�M�"�
���k�"�
�K�K�0�1��I�I�K��|�|�
�7�7�9��H�H�J��x�x�
�9�9�U�X�X�r�w�w�'����B�#��W�W�[�[��W�W�-�-�e�h�h�7�9�B���
��E�J�J�
�C�
�7�<�=�
�6�;�<�����	�������
��s�H"�"H>�=H>�__main__)rr�);�typingrrrWr�r�r rrrr��logging.handlers�gir�
gi.repositoryr	r
r��ibus_table_location�	getLoggerrI�intrHr#�getenv�	TypeError�
ValueErrorrXr^�datar��	data_homer�r_�librc�
cache_homer$r%rmr�cProfiler�r�Profilernrr��xml.etree.ElementTreer)r*r+rPr-r�r�r�rxr�r�r(r'�<module>rs���,��	�	�
��*�*������������	��	�	�<�	(���!�f����c�)�"�)�)�$<�=�>�?�K�
�����.�)�.�.�0�(�	;��
�W�W�\�\�7�-�7�7�9�<�
H�
�
�7�7�<�<�0�+�0�0�2�G�<���G�G�L�L�0�,�0�0�2�4F�G�	�
�'�'�,�,�5�*�5�5�7��
E��*�C�*�X	����=�=���
��x���!�H�	�I�I��C�C�$�_H�_H�B�U��t���C����D�� `;�D/�b�z���F���w
	�:����a�&�K��s�-G*�*G=�<G=

Zerion Mini Shell 1.0