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

�

��Xe���	�
�UdZddlmZddlmZddlmZddlmZddlmZddlmZm	Z	ddl
Z
ddlZddlZddl
Z
dd	lmZed
d�ddlmZed
d�ddlmZedd�ddlmZedd�ddlmZedd�ddlmZddlZddlZej0d�ZdZd�Zeegefed<d�Zeegefed<ej>j@ej>jBzej>jDzej>jFzZ$dejJdefd�Z&dede'fd �Z(d!ejRde'fd"�Z*d#ejVd!ejRdeeeeffd$�Z,d%eeefd&eeefddfd'�Z-Gd(�d)e	�Z.Gd*�d+e�Z/Gd,�d-e	�Z0Gd.�d/�Z1d0e1defd1�Z2d2ede1fd3�Z3Gd4�d5�Z4Gd6�d7ejj�Z6Gd8�d9ejn�Z8e9d:k(r�ejte
jv�;�Z<ej{ej|�eje<�ddl@Z@e@j��\ZBZCeBre
j�d<�ye
j�d�yy)=z&
Utility functions used in ibus-table
�)�Any)�List)�Tuple)�Dict)�Callable)�Enum�FlagN)�require_version�Gioz2.0)r�GLib)r�Gdkz3.0)r
�Gtk)r�IBusz1.0)rz
ibus-tablec�6�tjt|�S�N)�gettext�dgettext�
DOMAINNAME��as �'/usr/share/ibus-table/engine/it_util.py�<lambda>r6s��G�$4�$4�Z��$C���_c��|Sr�rs rrr7s��Q�r�N_�variant�returnc��t|�tjk7rtj	d�|S|j�}|dk(r|j
�S|dk(r|j�S|dk(r|j�S|dk(r|j�S|r|ddk(r|j�Stjd|�|S)	z+
    Convert a GLib variant to a value
    znot a GLib.Variant�s�i�b�vrrzunknown variant type: %s)�typer�Variant�LOGGER�info�get_type_string�
get_string�	get_int32�get_boolean�unpack�error)r�type_strings  r�variant_to_valuer0Bs���
�G�}����$����(�)����)�)�+�K��c���!�!�#�#��c��� � �"�"��c���"�"�$�$��c���~�~����{�1�~��,��~�~���
�L�L�+�[�9��Nr�color_stringc�<�tj�}|j|�t|jdz�dzdzt|j
dz�dzdzzt|jdz�dzdzzt|jdz�dzzS)u�
    Converts a color string to a 32bit  ARGB value

    :param color_string: The color to convert to 32bit ARGB
                         Can be expressed in the following ways:
                             - Standard name from the X11 rgb.txt
                             - Hex value: “#rgb”, “#rrggbb”, “#rrrgggbbb”
                                          or ”#rrrrggggbbbb”
                             - RGB color: “rgb(r,g,b)”
                             - RGBA color: “rgba(r,g,b,a)”

    Examples:

    >>> print('%x' %color_string_to_argb('rgb(0xff, 0x10, 0x25)'))
    ffff1025

    >>> print('%x' %color_string_to_argb('#108040'))
    ff108040

    >>> print('%x' %color_string_to_argb('#fff000888'))
    ffff0088

    >>> print('%x' %color_string_to_argb('#ffff00008888'))
    ffff0088

    >>> print('%x' %color_string_to_argb('rgba(0xff, 0x10, 0x25, 0.5)'))
    7fff1025
    ����)r
�RGBA�parse�int�alpha�red�green�blue)r1�gdk_rgbas  r�color_string_to_argbr?Xs���:�x�x�z�H��N�N�<� ��(�.�.�4�'�(�4�/�B�
6��H�L�L�4�'�(�4�/�B�6�
8��H�N�N�T�)�*�T�1�a�7�
9��H�M�M�D�(�)�D�0�
3�4r�databasec�4�|j�}|dk\rtjd|�|S	dtjvrJtjdjd�dj
�}tjd|�n�dtjvrJtjdjd�dj
�}tjd|�nItjdjd�dj
�}tjd	|�d
|vsd|vryd
|vsd|vsd|vry|jrtjd�ytjd�y#tjd�YyxYw)a�
    Use database value or LC_CTYPE in your box to determine the
    Chinese mode

    0 means to show simplified Chinese only
    1 means to show traditional Chinese only
    2 means to show all characters but show simplified Chinese first
    3 means to show all characters but show traditional Chinese first
    4 means to show all characters

    If nothing can be found return 4 to avoid any special
    Chinese filtering or sorting.

    rzKget_default_chinese_mode(): default Chinese mode found in database, mode=%s�LC_ALL�.z3get_default_chinese_mode(): __lc=%s found in LC_ALL�LC_CTYPEz5get_default_chinese_mode(): __lc=%s found in LC_CTYPE�LANGz2get_default_chinese_mode(): __lc=%s  found in LANG�_cn�_sg��_hk�_tw�_mo�unget_default_chinese_mode(): last fallback, database is Chinese but we don’t know which variant, returning 4.zPget_default_chinese_mode(): last fallback, database is not Chinese, returning 4.�z5Exception in get_default_chinese_mode(), returning 4.)	�get_chinese_moder'r(�os�environ�split�lower�_is_chinese�	exception)r@�database_chinese_mode�__lcs   r�get_default_chinese_moderW|s��� %�5�5�7����!����
>�!�	#�%�$�+��r�z�z�!��:�:�h�'�-�-�c�2�1�5�;�;�=�D��K�K�*��
��2�:�:�
%��:�:�j�)�/�/��4�Q�7�=�=�?�D��K�K�,��
�
�:�:�f�%�+�+�C�0��3�9�9�;�D��K�K�)��
�
�D�=�E�T�M���D�=�E�T�M�U�d�]�����

�K�K�.�
/��
�K�K�8�
9�������(�	)��s�D	E>�9E>�!E>�(E>�>F�	gsettingsc�V�i}t|jd��}|jjd�}|j	�}|�d}|jd�D�cgc]}|j
���c}dd}t|�dkr|dgdt|�z
zz
}|d}|jjd�}|r,|jd�D�cgc]}|j
���}}||d<|d	}	|jjd
�}
|
r,|
jd�D�cgc]}|j
���}	}|d}|jjd�}|r,|jd�D�cgc]}|j
���}}|D]-}||	vr|	j|�||vs�|j|��/d
|vr*d|vr|jd�d|	vr|	jd�d|vr*d|vr|jd�d|	vr|	jd�|	|d	<||d<t|�D]�\}
}t|�dk(r|t|�vr|dvrd|z}n|dk(rd}|g|d|
dzz<d|zg|d|
dzz<d|zg|d|
dzz<|dvs�a|d|
dzzjd|z�|d|
dzzjd|z�|d|
dzzjd|z���|D]%}||D]}d|vs�||j|���'|Scc}wcc}wcc}wcc}w)N�keybindings�valid_input_charsz1,2,3,4,5,6,7,8,9,0�,�
�
VoidSymbol�commit�commit_keys�lookup_table_page_down�page_down_keys�lookup_table_page_up�page_up_keys�-�minus�=�equal��	123456789�F�0�F10zcommit_candidate_%s�Control+zcommit_candidate_to_preedit_%s�Mod1+zremove_candidate_%s)
�1�2�3�4�5�6�7�8�9rl�KP_zControl+KP_zMod1+KP_)r0�get_default_value�ime_properties�get�get_select_keysrQ�strip�len�remove�	enumerate�list�append)rXr@�default_keybindingsr[�select_keys_csv�name�select_keybindings�commit_keybindings�commit_keys_csv�page_down_keybindings�page_down_keys_csv�page_up_keybindings�page_up_keys_csv�index�command�
keybindings                r�get_default_keybindingsr��s��13��*��#�#�M�2�4��!�/�/�3�3�4G�H���.�.�0�O���/��!0�!6�!6�s�!;�=���
�
��=�=@�b�B��
����#�����#�&8�"9�9�;�	;��,�X�6���-�-�1�1�-�@�O��%4�%:�%:�3�%?�A�!�D�J�J�L�A��A�$6���!�/�0H�I��!�0�0�4�4�5E�F���%7�%=�%=�c�%B�!D�!�D�J�J�L�!D��!D�-�.D�E���.�.�2�2�>�B���%5�%;�%;�C�%@�B�!�D�J�J�L�B��B�#�-���(�(�!�(�(��.��&�&��&�&�t�,�	-�����)�)��&�&�w�/��+�+�!�(�(��1�
����)�)��&�&�w�/��+�+�!�(�(��1�4I��0�1�2E��.�/� �!3�4�4(���t�:�t�9��>�d�d�+<�&=�=��{�"��T�z��������F�	�!�U�Q�Y�/�	
�
�$�
��	�,���	�:�	
�
�t�^��	�!�U�Q�Y�/�	
��E�E��%����3�
��f�U�T�\�"��0�E�A�I�>�
��f�]�T�)�*��%����3�
��f�Z�$�&�'�i4(�j'�@��-�g�6�	@�J��z�)�#�G�,�3�3�J�?�	@�@����Q=��A��!D��
Bs�L�L�'L!�5L&�pdict�other_pdictc�,�|D]}||vs�||||<�y)a�Update values of existing keys in a Python dict from another Python dict

    Using pdict.update(other_pdict) would add keys and values from other_pdict
    to pdict even for keys which do not exist in pdict. Sometimes I want
    to update only existing keys and ignore new keys.

    :param pdict: The Python dict to update
    :type pdict: Python dict
    :param other_pdict: The Python dict to get the updates from
    :type other_pdict: Python dict

    Examples:

    >>> old_pdict = {'a': 1, 'b': 2}
    >>> new_pdict = {'b': 3, 'c': 4}
    >>> dict_update_existing_keys(old_pdict, new_pdict)
    >>> old_pdict
    {'a': 1, 'b': 3}
    >>> old_pdict.update(new_pdict)
    >>> old_pdict
    {'a': 1, 'b': 3, 'c': 4}
    Nr)r�r��keys   r�dict_update_existing_keysr�7s(��0�*���%�<�$�S�)�E�#�J�*rc��eZdZdZdedefd�Zdefd�Zdede	fd�Z
dedefd�Zdedefd	�Zdedefd
�Z
dedefd�ZdZd
ZdZdZdZdZdZdZy)�
Capabilitea�Compatibility class to handle IBus.Capabilite the same way no matter
    what version of ibus is used.

    For example, older versions of ibus might not have IBus.Capabilite.SYNC_PROCESS_KEY
    (or maybe even do not have IBus.Capabilite at all). Then

        capabilities & IBus.Capabilite.SYNC_PROCESS_KEY

    will produce an exception. But when using this compatibility class

        capabilities & IBus.Capabilite.SYNC_PROCESS_KEY

    will just be False but not cause an exception.

    >>> int(Capabilite.PREEDIT_TEXT)
    1

    >>> Capabilite.PREEDIT_TEXT == 1
    True

    >>> Capabilite.PREEDIT_TEXT | 2
    3

    >>> 2 | Capabilite.PREEDIT_TEXT
    3

    >>> int(Capabilite.PREEDIT_TEXT | Capabilite.AUXILIARY_TEXT)
    3

    >>> 3 == Capabilite.AUXILIARY_TEXT | Capabilite.PREEDIT_TEXT
    True

    >>> 3 == Capabilite.AUXILIARY_TEXT | IBus.Capabilite.PREEDIT_TEXT
    True

    >>> Capabilite.PREEDIT_TEXT == IBus.Capabilite.PREEDIT_TEXT
    True
    �attrrc���tj|�}ttd�rDttj|�r*tt
tj|��|_|Sd|_|S)Nr�r)�object�__new__�hasattrrr�r9�getattr�_value_��clsr��objs   rr�zCapabilite.__new__zsS���n�n�S�!���4��&�7�4�?�?�D�+I��g�d�o�o�t�<�=�C�K��
��C�K��
rc�,�t|j�Sr�r9r���selfs r�__int__zCapabilite.__int__�����4�<�<� � r�otherc�,�|j|jus|jtjur tt	|�t	|�k(�S|jtus|jt
urtt	|�|k(�StSr)�	__class__rr��boolr9�float�NotImplemented�r�r�s  r�__eq__zCapabilite.__eq__�sk���N�N�e�o�o�-����$�/�/�1���D�	�S��Z�/�0�0��?�?�c�!�U�_�_��%=���D�	�U�*�+�+��rc��|j|jur|j|jzS|jtjurt	|�t	|�zS|jturt	|�|zSt
Sr�r��valuerr�r9r�r�s  r�__or__zCapabilite.__or__��i���>�>�U�_�_�,��:�:����+�+��O�O�t���.��t�9�s�5�z�)�)��?�?�c�!��t�9�u�$�$��rc�$�|j|�Sr�r�r�s  r�__ror__zCapabilite.__ror__�����{�{�5�!�!rc��|j|jur|j|jzS|jtjurt	|�t	|�zS|jturt	|�|zSt
Srr�r�s  r�__and__zCapabilite.__and__�r�rc�$�|j|�Sr�r�r�s  r�__rand__zCapabilite.__rand__�����|�|�E�"�"r�PREEDIT_TEXT�AUXILIARY_TEXT�LOOKUP_TABLE�FOCUS�PROPERTY�SURROUNDING_TEXT�OSK�SYNC_PROCESS_KEYN)�__name__�
__module__�__qualname__�__doc__�strrr�r9r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r�Ss���%�L�3��3��!��!��C��D���C��C��"�S�"�S�"��S��S��#�c�#�c�#�#�L�&�N�"�L�
�E��H�*���C�*�rr�c��eZdZdZdedefd�Zdefd�Zdede	fd�Z
dede	fd�Zdede	fd	�Zdede	fd
�Z
dede	fd�ZdZd
ZdZdZdZdZdZdZdZdZdZy)�InputPurposeauCompatibility class to handle InputPurpose the same way no matter
    what version of ibus is used.

    For example, older versions of ibus might not have
    IBus.InputPurpose.TERMINAL and then

        input_purpose == IBus.InputPurpose.TERMINAL

    will produce an exception. But when using this compatibility class

        input_purpose == InputPurpose.TERMINAL

    will just be False but not cause an exception.

    See also:

    https://docs.gtk.org/gtk3/enum.InputPurpose.html
    https://docs.gtk.org/gtk4/enum.InputPurpose.html

    Examples:

    >>> int(InputPurpose.PASSWORD)
    8

    >>> 8 == InputPurpose.PASSWORD
    True

    >>> int(InputPurpose.PIN)
    9

    >>> InputPurpose.PASSWORD <= InputPurpose.PIN
    True

    >>> InputPurpose.PASSWORD == Gtk.InputPurpose.PASSWORD
    True

    >>> InputPurpose.PASSWORD == IBus.InputPurpose.PASSWORD
    True
    r�rc���tj|�}ttd�rDttj|�r*tt
tj|��|_|Sd|_|S)Nr����)r�r�r�rr�r9r�r�r�s   rr�zInputPurpose.__new__�sW���n�n�S�!���3��'�G�C�4D�4D�d�,K��g�c�&6�&6��=�>�C�K��
��C�K��
rc�,�t|j�Srr�r�s rr�zInputPurpose.__int__�r�rr�c�R�|j|jus8|jtjus|jtjurt	|�t	|�k(S|jtus|jt
urt
t	|�|k(�StSr�r�rr�rr9r�r�r�r�s  rr�zInputPurpose.__eq__�sz���N�N�e�o�o�-����#�"2�"2�2����$�"3�"3�3��t�9��E�
�*�*��?�?�c�!�U�_�_��%=���D�	�U�*�+�+��rc�R�|j|jus8|jtjus|jtjurt	|�t	|�kDS|jtus|jt
urt
t	|�|kD�StSrr�r�s  r�__gt__zInputPurpose.__gt__�sz���N�N�e�o�o�-����#�"2�"2�2����$�"3�"3�3��t�9�s�5�z�)�)��?�?�c�!�U�_�_��%=���D�	�E�)�*�*��rc�d�|j|jus8|jtjus|jtjur t	t|�t|�k�S|jt
us|jturt	t|�|k�StSr�r�rr�rr�r9r�r�r�s  r�__lt__zInputPurpose.__lt__�s���N�N�e�o�o�-����#�"2�"2�2����$�"3�"3�3���D�	�C��J�.�/�/��?�?�c�!�U�_�_��%=���D�	�E�)�*�*��rc�d�|j|jus8|jtjus|jtjur t	t|�t|�k\�S|jt
us|jturt	t|�|k\�StSrr�r�s  r�__ge__zInputPurpose.__ge__�����N�N�e�o�o�-����#�"2�"2�2����$�"3�"3�3���D�	�S��Z�/�0�0��?�?�c�!�U�_�_��%=���D�	�U�*�+�+��rc�d�|j|jus8|jtjus|jtjur t	t|�t|�k�S|jt
us|jturt	t|�|k�StSrr�r�s  r�__le__zInputPurpose.__le__r�r�	FREE_FORM�ALPHA�DIGITS�NUMBER�PHONE�URL�EMAIL�NAME�PASSWORD�PIN�TERMINALN)r�r�r�r�r�rr�r9r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r��s���&�N�3��3��!��!��C��D���C��D���C��D���C��D���C��D���I�
�E��F��F�
�E��C�
�E��D��H��C��Hrr�c��eZdZdZdedefd�Zdefd�Zdede	fd�Z
dedefd�Zdedefd	�Zdedefd
�Z
dedefd�ZdZd
ZdZdZdZdZdZdZdZdZdZdZdZy)�
InputHintsa�Compatibility class to handle InputHints the same way no matter
    what version of ibus is used.

    For example, older versions of ibus might not have IBus.InputHints.PRIVATE
    (or maybe even do not have IBus.InputHints at all). Then

        input_hints & IBus.InputHints.PRIVATE

    will produce an exception. But when using this compatibility class

        input_hints & InputHints.PRIVATE

    will just be False but not cause an exception.

    See also:

    https://docs.gtk.org/gtk3/flags.InputHints.html
    https://docs.gtk.org/gtk4/flags.InputHints.html

    Examples:

    >>> int(InputHints.SPELLCHECK)
    1

    >>> InputHints.SPELLCHECK == 1
    True

    >>> InputHints.SPELLCHECK | 2
    3

    >>> 2 | InputHints.SPELLCHECK
    3

    >>> int(InputHints.NO_SPELLCHECK | InputHints.SPELLCHECK)
    3

    >>> 3 == InputHints.NO_SPELLCHECK | InputHints.SPELLCHECK
    True

    >>> 3 == InputHints.NO_SPELLCHECK | Gtk.InputHints.SPELLCHECK
    True

    >>> 3 == InputHints.NO_SPELLCHECK | IBus.InputHints.SPELLCHECK
    True

    >>> InputHints.SPELLCHECK == IBus.InputHints.SPELLCHECK
    True

    >>> InputHints.SPELLCHECK == Gtk.InputHints.SPELLCHECK
    True
    r�rc���tj|�}ttd�rDttj|�r*tt
tj|��|_|Sd|_|S)Nr�r)r�r�r�rr�r9r�r�r�s   rr�zInputHints.__new__NsS���n�n�S�!���3��%�'�#�.�.�$�*G��g�c�n�n�d�;�<�C�K��
��C�K��
rc�,�t|j�Srr�r�s rr�zInputHints.__int__Vr�rr�c�d�|j|jus8|jtjus|jtjur t	t|�t|�k(�S|jt
us|jturt	t|�|k(�StSr)r�rr�rr�r9r�r�r�s  rr�zInputHints.__eq__Ys{���N�N�e�o�o�-����#�.�.�0����$�/�/�1���D�	�S��Z�/�0�0��?�?�c�!�U�_�_��%=���D�	�U�*�+�+��rc�N�|j|jur|j|jzS|jtjus|jtjurt|�t|�zS|jt
urt|�|zStSr�r�r�rr�rr9r�r�s  rr�zInputHints.__or__b�y���>�>�U�_�_�,��:�:����+�+��O�O�s�~�~�-����$�/�/�1��t�9�s�5�z�)�)��?�?�c�!��t�9�u�$�$��rc�$�|j|�Srr�r�s  rr�zInputHints.__ror__lr�rc�N�|j|jur|j|jzS|jtjus|jtjurt|�t|�zS|jt
urt|�|zStSrr�r�s  rr�zInputHints.__and__or�rc�$�|j|�Srr�r�s  rr�zInputHints.__rand__yr�r�NONE�
SPELLCHECK�
NO_SPELLCHECK�WORD_COMPLETION�	LOWERCASE�UPPERCASE_CHARS�UPPERCASE_WORDS�UPPERCASE_SENTENCES�INHIBIT_OSK�VERTICAL_WRITING�EMOJI�NO_EMOJI�PRIVATEN)r�r�r�r�r�rr�r9r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�r�s���2�f�3��3��!��!��C��D���C��C��"�S�"�S�"��S��S��#�c�#�c�#�
�D��J�$�M�(�O��I�(�O�(�O�0�� �K�*��
�E��H��Grr�c�T�eZdZdZdedededdfd�Zdedefd	�Zdedefd
�Z	de
fd�Zy)�KeyEventzSKey event class used to make the checking of details of the key
    event easy
    �keyval�keycode�staterNc�Z�||_||_||_tj|j�|_tj|j�|_|jtjjzdk7|_
|jtjjzdk7|_|jtjjzdk7|_|jtjjzdk7|_|jtjj"zdk7|_|jtjj&zdk7|_|jtjj*zdk7|_|jtjj.zdk7|_|jtjj2zdk7|_|jtjj6zdk7|_|jtjj:zdk7|_|jtjj>zdk7|_ |jtjjBzdk7|_"|jtjjFzdk7|_$|jtjjJzdk7|_&|jtjjNzdk7|_(|jtjjRzdk7|_*|jtjjVzdk7|_,y)Nr)-�val�coderr�keyval_namer��keyval_to_unicode�unicode�ModifierType�
SHIFT_MASK�shift�	LOCK_MASK�lock�CONTROL_MASK�control�
SUPER_MASK�super�
HYPER_MASK�hyper�	META_MASK�meta�	MOD1_MASK�mod1�	MOD2_MASK�mod2�	MOD3_MASK�mod3�	MOD4_MASK�mod4�	MOD5_MASK�mod5�BUTTON1_MASK�button1�BUTTON2_MASK�button2�BUTTON3_MASK�button3�BUTTON4_MASK�button4�BUTTON5_MASK�button5�RELEASE_MASK�release�
MODIFIER_MASK�modifier)r�rrrs    r�__init__zKeyEvent.__init__�s��������	���
��$�$�T�X�X�.��	��-�-�d�h�h�7����Z�Z�$�"3�"3�">�">�>�!�C��
��J�J��!2�!2�!<�!<�<��A��	��z�z�D�$5�$5�$B�$B�B�a�G����Z�Z�$�"3�"3�">�">�>�!�C��
��Z�Z�$�"3�"3�">�">�>�!�C��
��J�J��!2�!2�!<�!<�<��A��	��J�J��!2�!2�!<�!<�<��A��	��J�J��!2�!2�!<�!<�<��A��	��J�J��!2�!2�!<�!<�<��A��	��J�J��!2�!2�!<�!<�<��A��	��J�J��!2�!2�!<�!<�<��A��	��z�z�D�$5�$5�$B�$B�B�a�G����z�z�D�$5�$5�$B�$B�B�a�G����z�z�D�$5�$5�$B�$B�B�a�G����z�z�D�$5�$5�$B�$B�B�a�G����z�z�D�$5�$5�$B�$B�B�a�G����z�z�D�$5�$5�$B�$B�B�a�G����
�
�T�%6�%6�%D�%D�D��I��
rr�c���t|t�stS|j|jk(r3|j|jk(r|j
|j
k(ryy�NTF��
isinstancerr�rrrr�s  rr�zKeyEvent.__eq__�sH���%��*�!�!��H�H��	�	�!��I�I����+��J�J�%�+�+�-��rc���t|t�stS|j|jk7s2|j|jk7s|j
|j
k7ryyr3r4r�s  r�__ne__zKeyEvent.__ne__�sH���%��*�!�!��H�H��	�	�!��9�9��
�
�*��:�:����,��rc���tdjgd�|j��d�|j��d�|jd��d�|j
��d�|j��d�|j��d	�|j��d
�|j��d�|j��d�|j��d
�|j��d�|j��d�|j��d�|j��d�|j ��d�|j"��d�|j$��d�|j&��d�|j(��d�|j*��d�|j,��d�|j.��d�|j0����S)N�zval=z code=z	 state=0x�08xu	 name=“u” unicode=“u
” shift=z lock=z	 control=z super=z hyper=z meta=z mod1=z mod2=z mod3=z mod4=z mod5=z	 button1=z	 button2=z	 button3=z	 button4=z	 button5=z	 release=z
 modifier=)�repr�joinrrrr�rrrrrrrrrrr r"r$r&r(r*r,r.r0r�s r�__str__zKeyEvent.__str__�sh���
(�
(�d�
(�4�8�8�*�
(��
(��I�I�;�
(��
(��z�z�#�&�
(�'�
(��y�y�k�
(�"�
(��,�,��	
(�(�	
(�
�Z�Z�L�
(�
!�
(��I�I�;�

(��

(��|�|�n�
(�%�
(��Z�Z�L�
(�!�
(��Z�Z�L�
(�!�
(��I�I�;�
(��
(��I�I�;�
(��
(��I�I�;�
(��
(��I�I�;�
(��
(��I�I�;�
(��
(��I�I�;�
(��
(� �|�|�n�!
(� %�!
(�"�|�|�n�#
(�"%�#
(�$�|�|�n�%
(�$%�%
(�&�|�|�n�'
(�&%�'
(�(�|�|�n�)
(�(%�)
(�*�|�|�n�+
(�*%�+
(�,�
�
��-
(�)�	)r)r�r�r�r�r9r1r�r�r�r7r�r=rrrrr�s_���J�s�J�S�J��J��J�>�F��t���F��t��)��)rr�keyeventc��d}|jr|dz
}|jr|dz
}|jr|dz
}|jr|dz
}|jr|dz
}|j
r|dz
}|jr|dz
}|jr|d	z
}|jr|d
z
}|jr|dz
}|jr|dz
}||jz
}|S)
Nr9�Shift+�Lock+rn�Super+�Hyper+�Meta+ro�Mod2+�Mod3+�Mod4+�Mod5+)rrrrrrrrrr r"r�)r>r�s  r�keyevent_to_keybindingrI�s����J��~�~��h��
��}�}��g��
�����j� �
��~�~��h��
��~�~��h��
��}�}��g��
��}�}��g��
��}�}��g��
��}�}��g��
��}�}��g��
��}�}��g��
��(�-�-��J��rr�c�H�|jd�d}tj|�}d}d|vr|tjjz}d|vr|tjj
z}d|vr|tjjz}d|vr|tjjz}d|vr|tjjz}d	|vr|tjjz}d
|vr|tjjz}d|vr|tjjz}d|vr|tjjz}d
|vr|tjjz}d|vr|tjjz}t|d|�S)N�+r�rr@rArnrBrCrDrorErFrGrH)rQr�keyval_from_namerr
rrrrrrrrrr!r)r�r�rrs    r�keybinding_to_keyeventrM�s������C� ��$�D�
�
"�
"�4�
(�F�
�E��:��
��"�"�-�-�-���*��
��"�"�,�,�,���Z��
��"�"�/�/�/���:��
��"�"�-�-�-���:��
��"�"�-�-�-���*��
��"�"�,�,�,���*��
��"�"�,�,�,���*��
��"�"�,�,�,���*��
��"�"�,�,�,���*��
��"�"�,�,�,���*��
��"�"�,�,�,���F�A�u�%�%rc�X�eZdZdZdeeeefddfd�Zdee	e	efde
fd�Zdefd�Zy)	�HotKeyszYClass to make checking whether a key matches a hotkey for a certain
    command easy
    rZrNc�
�i|_|D]w}||D]m}t|�}|j}|jtz}||jvr!|j|j||f��\||fg|j|<�o�yyr)�_hotkeysrMrr�KEYBINDING_STATE_MASKr�)r�rZr�r�r�rrs       rr1zHotKeys.__init__s���:<��
�"�	<�G�)�'�2�
<�
�,�Z�8���g�g���	�	�$9�9���d�m�m�+��M�M�'�*�1�1�3��,�?�/2�E�l�^�D�M�M�'�*�
<�	<r�command_key_tuplec��t|t�sy|d}|d}|d}|�|}|j}|j}|jdv�r�|j|k7s|t
jjzsy|t
jjz}|jdvr |t
jjz}�n|jdvr|t
jjz}n�|jdvr|t
jjz}n�|jd	vr=|t
jjz}|t
jjz}nw|jd
vr=|t
jjz}|t
jjz}n,|jdvr|t
jjz}|tz}||j vr||f|j |vryy)
NFrHrir)�Shift_L�Shift_R�	Control_L�	Control_R�Alt_L�Alt_R�Meta_L�Meta_R�Super_L�Super_R�ISO_Level3_Shift)rUrV)rWrX)rYrZ)r]r^)r[r\)r_T)r5�tuplerrr�rrr-r
rrrrrr!rRrQ)r�rSr�r��prev_keyrrs       r�__contains__zHotKeys.__contains__ s����+�U�3��#�A�&����"��$�Q�'�����H��g�g���	�	���8�8�,�,�����#��t�0�0�=�=�=���d�'�'�4�4�4�4�E��x�x�1�1��$�+�+�6�6�6�6�����7�7��$�+�+�8�8�8�8�����/�/��$�+�+�5�5�5�5�����3�3��$�+�+�6�6�6�6���$�+�+�5�5�5�5�����1�1��$�+�+�5�5�5�5���$�+�+�5�5�5�5�����2�2��$�+�+�5�5�5�5���-�-���d�m�m�#��U�|�t�}�}�W�5�5��rc�,�t|j�Sr)r;rQr�s rr=zHotKeys.__str__Ss���D�M�M�"�"r)
r�r�r�r�rr�rr1rrr�rbr=rrrrOrOsU���
<�D��d�3�i��$8�
<�T�
<�1�%*�8�X�s�+B�%C�1�HL�1�f#��#rrOc��eZdZed�dfdedejddfd�Zdejde	jdefd	�Zdejd
e	jdefd�Z
y)�ItKeyInputDialogz	Key inputN�title�parentrc��tjj|||��|jt	d�tj
j�|jd�|jdt	d�z�|jt	d��|jd|j�|jd|j�|r|j|j��|j�y)	N)rfrg�CancelTz<big><b>%s</b></big>z)Please press a key (or a key combination)z2The dialog will be closed when the key is released�key_press_event�key_release_event)r�Dialogr1�
add_buttonr�ResponseType�CANCEL�	set_modal�
set_markup�format_secondary_text�connect�on_key_press_event�on_key_release_event�set_transient_for�get_toplevel�show)r�rfrgs   rr1zItKeyInputDialog.__init__Ws���	�
�
������	�	�	
����(��S�%5�%5�%<�%<�=����t�����"��;�<�	
=�	>�	
�"�"�
�B�C�		E�
	
���&��(?�(?�@����(�$�*C�*C�D���"�"�6�#6�#6�#8�9��	�	�r�widget�eventc�T�|j|j�tzf|_y�NT)r�	get_staterR�e)r�ryrzs   rrtz#ItKeyInputDialog.on_key_press_eventus%���L�L��O�O�%�(=�=�?���r�_eventc�V�|jtjj�yr|)�responserrn�OK)r�ryrs   rruz%ItKeyInputDialog.on_key_release_event{s������(�(�+�+�,�r)r�r�r�rr�r�Windowr1�
MessageDialogr
�EventKeyr�rtrurrrrereVs����;��!%�
�
���J�J�
�+/�
�<��+�+��47�L�L��EI����+�+��58�\�\��FJ�rrec�n�eZdZddejddfd�Zdejdejddfd�Zy)	�
ItAboutDialogNrgrc��tjj||��|jd�|j	dtj�z�|jd�|jtj��|jtd��|jd�|jgd��|jtd��|jd	g�|jd
�|j!td�dzd
z�|j#d
�|j%d�|j'tj(j*�|j-d|j.�|r|j1|j3��|j5�y)N)rgTu码 IBus Table %su码 IBus TablezTable input method for IBus.uECopyright © 2009-2012 Peng Huang,
Copyright © 2012-2022 Mike FABIAN)uYuwei YU (“acevery”)z
Peng Huang�BYVoidzPeng WuuCaius ‘kaio’ Chance�$Mike FABIAN <maiku.fabian@gmail.com>z
Contributors:�
koterpilla�Zerng07zMike FABIANzBernard Nauwelaertsz
Xiaojun Ma�	mozbugboxuSeán de Búrcaztranslator-creditsr�z'http://mike-fabian.github.io/ibus-tablezOnline documentation:� a�
        This library is free software: you can redistribute it and/or modify
        it under the terms of the GNU Lesser General Public License as published by
        the Free Software Foundation, either version 2.1 of the License, or
        (at your option) any later version.

        This library is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU Lesser General Public License for more details.

        You should have received a copy of the GNU Lesser General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>
        r�)r�AboutDialogr1rp�	set_title�version�get_version�set_program_name�set_version�set_commentsr�
set_copyright�set_authors�set_translator_credits�set_documenters�set_website�set_website_label�set_license�set_wrap_license�set_license_type�License�LGPL_2_1rs�on_close_aboutdialogrvrwrx)r�rgs  rr1zItAboutDialog.__init__�s������ � ��f� �5����t��	
���*�G�,?�,?�,A�A�B����.�/�����,�,�.�/����
�,�-�	/����
1�	2�	
����	� 	
�#�#�
�"�#�		%�	
���2��	�	
���5�	7����
�%�&��
�=�
>�	?�	
���
�
	
�	
���d�#����c�k�k�2�2�3����Z��!:�!:�;���"�"�6�#6�#6�#8�9��	�	�r�
_about_dialog�	_responsec�$�|j�y)u�
        The “About” dialog has been closed by the user

        :param _about_dialog: The “About” dialog
        :param _response: The response when the “About” dialog was closed
        N)�destroy)r�r�r�s   rr�z"ItAboutDialog.on_close_aboutdialog�s
��	
���rr)	r�r�r�rr�r1rlrnr�rrrr�r��sD��C��
�
�C�d�C�J�!$����8;�8H�8H��MQ�rr��__main__)�streamri)Er��typingrrrrr�enumrr	�sysrO�loggingr�gir
�
gi.repositoryrrr
rrr��tabsqlitedb�	getLoggerr'rrr��__annotations__rrr/rrrrRr&r0r9r?�TabSqliteDbrW�Settingsr�r�r�r�r�rrIrMrOr�rer�r�r��
StreamHandler�stderr�LOG_HANDLER�setLevel�DEBUG�
addHandler�doctest�testmod�FAILED�	ATTEMPTED�exitrrr�<module>r�s���,�������
�	������u����������u�����u����������	��	�	�<�	(��
�
�C��8�S�E�3�J��C�&��H�c�U�C�Z��&�
	���#�#����"�"�"�#����"�"�"�#����"�"�"�#���d�l�l��s��,"4�s�"4�s�"4�HC�{�'>�'>�C�3�C�Jt��<�<�t��)�)�t�.2�3��S�	�>�.B�t�l*��C��H�~�*�,0��c��N�*�?C�*�8Y,��Y,�vj�4�j�Xn��n�`M)�M)�^�X��#��6&�s�&�x�&�8D#�D#�L(�s�(�(�(�TN�C�O�O�N�`�z��'�'�'�'�s�z�z�:�K�
�O�O�G�M�M�"�
���k�"��)�'�/�/�+��V�Y�
�������������r

Zerion Mini Shell 1.0