%PDF- %PDF-
Mini Shell

Mini Shell

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

�

g
f�`��h�dZdZdZdZdZdZddlmZddlZejd	d
�ddlm
Z
ddlZdd
lm
Z
ddlmZddlmZddlmZiZiZdZdZde
j,j.zZde
j,j2zZdezZdezde
j,j.zzZdezde
j,j2zzZdezde
j,j2zzde
j,j.zzZdezde
j,j>zzZ dezde
j,j.zzde
j,j>zzZ!de
j,j>zZ"de
j,j>zde
j,j.zzZ#de
j,j2zde
j,j.zzZ$de
j,j>zde
j,j2zzde
j,j.zzZ%de
j,j.zde
j,j2zzde
j,jLzzde
j,jNzzZ(de
j,j>zde
j,j.zzde
j,j2zzde
j,jLzzde
j,jNzzdezzZ)e)Z*d�Z+d�Z,d�Z-Gd�d�Z.Gd�d�Z/y)zLProvides support for defining keybindings and matching them to input
events.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2008 Sun Microsystems Inc.�LGPL�)�GdkN�Atspiz2.0)r�)�debug)�settings)�
orca_state��_�c��|sy|tvr�tjj�}tj|�}|dk(rydt|<|j|�\}}|D]Q}|jdk(r|jt|<t|St|dk(s�<|djt|<�St|S)a�Converts an XKeysym string (e.g., 'KP_Enter') to a keycode that
    should match the event.hw_code for key events.

    This whole situation is caused by the fact that Solaris chooses
    to give us different keycodes for the same key, and the keypad
    is the primary place where this happens: if NumLock is not on,
    there is no telling the difference between keypad keys and the
    other navigation keys (e.g., arrows, page up/down, etc.).  One,
    for example, would expect to get KP_End for the '1' key on the
    keypad if NumLock were not on.  Instead, we get 'End' and the
    keycode for it matches the keycode for the other 'End' key.  Odd.
    If NumLock is on, we at least get KP_* keys.

    So...when setting up keybindings, we say we're interested in
    KeySyms, but those keysyms are carefully chosen so as to result
    in a keycode that matches the actual key on the keyboard.  This
    is why we use KP_1 instead of KP_End and so on in our keybindings.

    Arguments:
    - keysym: a string that is a valid representation of an XKeysym.

    Returns an integer representing a key code that should match the
    event.hw_code for key events.
    r)�
_keycodeCacher�Keymap�get_default�keyval_from_name�get_entries_for_keyval�group�keycode)�keysym�keymap�keyval�success�entries�entrys      �2/usr/lib/python3/dist-packages/orca/keybindings.py�
getKeycoderSs���4��
�]�"����'�'�)���%�%�f�-���Q�;��!"�
�f��!�8�8��@�����	;�E��{�{�a��(-�
�
�
�f�%���� � ��V�$��)�(/��
�(:�(:�
�f�%�	;��� � �c��d}|tzrEtjtjk(r|t	d�dzz
}nC|t	d�dzz
}n1|dt
jjzzr|t	d�dzz
}|dzr|t	d�dzz
}|dt
jjzzr|t	d�dzz
}|dt
jjzzr|t	d	�dzz
}|tzr|t	d
�dzz
}|tzr|t	d�dzz
}|tzr|t	d�dzz
}|S)
zYGets the modifier names of a numeric modifier mask as a human
    consumable string.
    ��Insert�+�	Caps_Lockr��Alt_R�Super�Meta2�Alt�Ctrl�Shift)
�ORCA_MODIFIER_MASKr�keyboardLayout�GENERAL_KEYBOARD_LAYOUT_DESKTOPrr�ModifierType�	SHIFTLOCK�META3�META2�ALT_MODIFIER_MASK�CTRL_MODIFIER_MASK�SHIFT_MODIFIER_MASK)�mods�texts  r�getModifierNamesr6�sW��
�D�� � ��"�"�h�&N�&N�N�
�A�h�K�#�%�%�D�
�A�k�N�S�(�(�D�	
��e�(�(�2�2�2�	3�	
��+���$�$���c�z�	
��'�
�S� � ���q�E�&�&�,�,�,�-�	
��'�
�S� � ���q�E�&�&�,�,�,�-�	
��'�
�S� � �����	
��%��3����� � �	
��&�	�C�����!�!�	
��'�
�S� � ���Krc�D�|dk(rtd�S|dk(rtd�Sy)zsReturns a human-consumable string representing the number of
    clicks, such as 'double click' and 'triple click'.�zdouble click�ztriple clickrr
)�counts r�getClickCountStringr;�s/��
��z�
�� � ���z�
�� � �
rc�V�eZdZdZ	dd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�
KeyBindingzcA single key binding, consisting of a keycode, a modifier mask,
    and the InputEventHandler.
    c�t�||_||_||_||_||_d|_||_g|_y)a�Creates a new key binding.

        Arguments:
        - keysymstring: the keysymstring - this is typically a string
          from /usr/include/X11/keysymdef.h with the preceding 'XK_'
          removed (e.g., XK_KP_Enter becomes the string 'KP_Enter').
        - modifier_mask: bit mask where a set bit tells us what modifiers
          we care about (see Atspi.ModifierType.*)
        - modifiers: the state the modifiers we care about must be in for
          this key binding to match an input event (see also
          Atspi.ModifierType.*)
        - handler: the InputEventHandler for this key binding
        - enabled: Whether this binding can be bound and used, i.e. based
          on mode, the feature being enabled/active, etc.
        N)�keysymstring�
modifier_mask�	modifiers�handler�click_countr�_enabled�	_grab_ids)�selfr?r@rArBrC�enableds       r�__init__zKeyBinding.__init__�s?��$)���*���"������&��������
���rc	��|jsd|j�d�S|jrd|j�d�}nd|j�d�}|�d|j�d|j�d|j�d|j
��	S)	NzUNBOUND BINDING for '�'zENABLED BINDING for 'zDISABLED BINDING for '�: z mods=z clicks=z
 grab ids=)r?rBrDrArCrE)rF�strings  r�__str__zKeyBinding.__str__�s���� � �*�4�<�<�.��:�:��=�=�,�T�\�\�N�!�<�F�-�d�l�l�^�1�=�F��h�b��*�*�+�6�$�.�.�1A��$�JZ�JZ�I[�\����'�
)�	
rc��|jst|j�|_|j|k(r||jz}||jk(Sy)z_Returns true if this key binding matches the given keycode and
        modifier state.
        F)rrr?r@rA)rFrrA�results    r�matcheszKeyBinding.matchessK���|�|�%�d�&7�&7�8�D�L��<�<�7�"���!3�!3�3�F��T�^�^�+�+�rc��|jS)z+Returns True if this KeyBinding is enabled.�rD�rFs r�
is_enabledzKeyBinding.is_enableds���}�}�rc��||_y)z$Set this KeyBinding's enabled state.NrR)rFrGs  r�set_enabledzKeyBinding.set_enableds�� ��
rc�N�	|jjS#t$rYywxYw)z8Returns the description of this binding's functionality.r)rB�description�	ExceptionrSs rrXzKeyBinding.descriptions)��	��<�<�+�+�+���	��	�s��	$�$c��t|j�}t|j�}|j}|�|�d|��}|j�S)zAReturns a more human-consumable string representing this binding.� )r6rAr;rCr?�strip)rFr4�
clickCountrrLs     r�asStringzKeyBinding.asString&sM�� ����/��(��)9�)9�:�
��"�"���6�&���:�,�/���|�|�~�rc�(�g}|jst|j�|_|jtzr�t
j}|�|Sg}|jtz}tjD]G}t|�}|dk(r|dk(rtd�}|j|�}|j||z��In
|jg}|D]?}tj�}|j|_||_|j|��A|S)z� return a list of Atspi key definitions for the given binding.
            This may return more than one binding if the Orca modifier is bound
            to more than one key.
        r�
Shift_Lockr")
rrr?rAr*r	�devicer�orcaModifierKeys�map_modifier�appendr�
KeyDefinition)	rF�retra�modList�	otherMods�keyr�mod�kds	         r�keyDefszKeyBinding.keyDefs0s��
���|�|�%�d�&7�&7�8�D�L��>�>�.�.��&�&�F��~��
��G����*<�)<�<�I��0�0�
0��$�S�/���a�<�C�<�$7�(��5�G��)�)�'�2�����s�Y��/�
0��~�~�&�G��	�C��$�$�&�B����B�J��B�L��J�J�r�N�		�
�
rc�,�t|j�S)zIReturns True if there are existing grabs associated with this KeyBinding.)�boolrErSs r�hasGrabszKeyBinding.hasGrabsNs���D�N�N�#�#rc�H�|jr|jsytj�y|j	�D];}|j
j
tjj|d���=d|��}tjtj|d�y)z#Adds key grabs for this KeyBinding.Nz
GRABS ADDED: T)r?rDr	rarlrErd�add_key_grabr�printMessage�
LEVEL_INFO)rFrk�msgs   r�addGrabszKeyBinding.addGrabsSs����!�!�d�m�m�����$���,�,�.�	L�B��N�N�!�!�*�"3�"3�"@�"@��T�"J�K�	L��d�V�$��
���5�+�+�S�$�7rc�P�|jr9tjs)d}tjtj
|dd�y|jD]!}tjj
|��#g|_d|��}tjtj|d�y)z&Removes key grabs for this KeyBinding.z+WARNING: Have grab to remove but no device.TNzGRABS REMOVED: )rEr	rarrr�
LEVEL_WARNING�remove_key_grabrs)rFrt�ids   r�removeGrabszKeyBinding.removeGrabsbs����>�>�*�"3�"3�?�C����u�2�2�C��t�D���.�.�	2�B����-�-�b�1�	2������v�&��
���5�+�+�S�$�7rN)rT)�__name__�
__module__�__qualname__�__doc__rHrMrPrTrVrXr^rlrorurz�rrr=r=�sC���
+/��6

��$�
 �
���<$�

8�
8rr=c�~�eZdZdZd�Zd�Zdd�Zdd�Zd�Zdd�Z	dd�Z
d	�Zd
�Zdd�Z
dd�Zdd
�Zd�Zd�Zd�Zd�Zy)�KeyBindingsz<Structure that maintains a set of KeyBinding instances.
    c��g|_y�N��keyBindingsrSs rrHzKeyBindings.__init__us
����rc�<�d}|jD]
}||�d�z
}�|S)Nr�
r�)rFrO�
keyBindings   rrMzKeyBindings.__str__xs2�����*�*�	(�J����B�'�'�F�	(��
rc�0�|jr\|j|d�rJd|j��d|j��d�}t	j
tj|d�|jj|�|r|j�yy)zOAdds KeyBinding instance to this set of keybindings, optionally updating grabs.�
keysNoMask�KEYBINDINGS: '�' (z) already in keybindingsTN)
r?�
hasKeyBindingr^rXrrrrsr�rdru)rFr��includeGrabsrts    r�addzKeyBindings.add~s����"�"�t�'9�'9�*�l�'S��
� 3� 3� 5�6�7��)�)�+�,�,D�F�
�
���u�/�/��d�;������
�+�����!�rc���||jvr||j|j�}|syd|d|g}tjtj
|d�|j|j�D]}|j
||��y|j�r=|r|j�n*d|dg}tjtj
|d�|jj
|�y)zKRemoves KeyBinding from this set of keybindings, optionally updating grabs.Nz5KEYBINDINGS: Warning: No binding in set to remove forzAlternates:TzKEYBINDINGS: Warning:zwill be removed but has grabs.)	r��getBindingsForHandlerrBr�printTokensrw�removerorz)rFr�r��
candidates�tokens�	candidates      rr�zKeyBindings.remove�s����T�-�-�-��3�3�J�4F�4F�G�J�
��N�z�#�Z�1�F����e�1�1�6�4�@�!�7�7�
�8J�8J�K�
5�	����I�|�4�
5����� ���&�&�(�2�:�?_�`���!�!�%�"5�"5�v�t�D������
�+rc��|jS)zAReturns True if there are no bindings in this set of keybindings.r�rSs r�isEmptyzKeyBindings.isEmpty�s���#�#�#�#rc���d}|r|d|��z
}tjtj|d�|jD]4}|j	�s�|j�r�%|j
��6y)z?Adds grabs for all enabled bindings in this set of keybindings.zKEYBINDINGS: Adding key grabsrKTN)rrrrsr�rTroru�rF�reasonrt�bindings    r�addKeyGrabszKeyBindings.addKeyGrabs�sl��.����R��x�=� �C�
���5�+�+�S�$�7��'�'�	#�G��!�!�#�G�,<�,<�,>�� � �"�	#rc���d}|r|d|��z
}tjtj|d�|jD]#}|j	�s�|j��%y)z.Removes all grabs for this set of keybindings.zKEYBINDINGS: Removing key grabsrKTN)rrrrsr�rorzr�s    r�removeKeyGrabszKeyBindings.removeKeyGrabs�sa��0����R��x�=� �C�
���5�+�+�S�$�7��'�'�	&�G����!��#�#�%�	&rc�H�|jD]}|j|k(s�yy)z@Returns True if the handler is found in this set of keybindings.TF�r�rB�rFrBr�s   r�
hasHandlerzKeyBindings.hasHandler�s-���'�'�	�G����'�)��	�rc�~�|jD].}|j|k(s�|jj�s�.yy)zOReturns True if the handler is found in this set of keybindings and is enabled.TF)r�rBrTr�s   r�hasEnabledHandlerzKeyBindings.hasEnabledHandler�s<���'�'�	�G����'�)�g�o�o�.H�.H�.J��	�rc���|jD�]�}|dk(r�|js�|js�#|jj|jjk(s�Q|j|jk(s�k|j|jk(s��|j
|j
k(s��|j|jk(s��y|dk(rK|js��|js��|jj|jjk(s��	y|dk(rn|j|jk(s��+|j|jk(s��F|j
|j
k(s��a|j|jk(s��|y|dk(s���|j|jk(s���|j
|j
k(s���|j|jk(s���yy)a�Return True if keyBinding is already in self.keyBindings.

           The typeOfSearch can be:
              "strict":      matches description, modifiers, key, and click count
              "description": matches only description
              "keys":        matches the modifiers, key, modifier mask, and click count
              "keysNoMask":  matches the modifiers, key, and click count
        �strictTrX�keysr�F)r�rBrXr?r@rArC)rF�
newKeyBinding�typeOfSearchr�s    rr�zKeyBindings.hasKeyBinding�s����*�*�	 �J��x�'��%�%�-�*?�*?�!�)�)�5�5��9N�9N�9Z�9Z�Z�!�.�.�-�2L�2L�L�!�/�/�=�3N�3N�N�!�+�+�}�/F�/F�F�!�-�-��1J�1J�J����.��%�%�-�*?�*?�!�)�)�5�5��9N�9N�9Z�9Z�Z����'��*�*�m�.H�.H�H�!�/�/�=�3N�3N�N�!�+�+�}�/F�/F�F�!�-�-��1J�1J�J����-��*�*�m�.H�.H�H�!�+�+�}�/F�/F�F�!�-�-��1J�1J�J��/	 �2rc��|jD�cgc]}|js�|��}}|rR|D�cgc]}|jj��}}t	|j
t
|��D�cgc]}||��	}}i}|D]s}|j�}|j|�}|�;d|d|j�d|g}	tjtj|	d�|j�||<�u|Scc}wcc}wcc}w)z�Returns the KeyBinding instances which are bound to a keystroke.

        Arguments:
        - uniqueOnly: Should alternative bindings for the same handler be
          filtered out (default: False)
        z
WARNING: 'r�z) also matches:T)r�r?rBrX�map�index�setr^�getrr�rs)
rF�
uniqueOnly�kb�bound�handlers�i�bindingsrL�matchr�s
          r�getBoundBindingszKeyBindings.getBoundBindings�s���#�.�.�B��"�/�/��B��B��9>�?�2��
�
�.�.�?�H�?�'*�8�>�>�3�x�=�'I�J�!�U�1�X�J�E�J����	0�B��[�[�]�F��L�L��(�E�� �&���r�~�~�7G�IZ�\a�b���!�!�%�"2�"2�F�D�A�!�~�~�/�H�V��
	0����C��?��Js�C7�C7�C<�-Dc�f�|r)|jD�cgc]}|js�|��}}d}n|j}d}|D�cgc]}|j�s�|��}}dt|��d|�dt|j��d�}t	j
tj|d�|Scc}wcc}w)z>Returns the KeyBindings instances which can be bound and used.zbound bindingsr�zKEY BINDINGS: r[z found out of �.T)r�r?rT�lenrrrrs)rF�	boundOnlyr�r��boundStringrGrts       r�getEnabledBindingszKeyBindings.getEnabledBindingss����%)�%5�%5�I�r�����I�H�I�*�K��'�'�H�$�K� (�<�"�B�M�M�O�2�<��<��s�7�|�n�A�k�]�.��T�M]�M]�I^�H_�_`�a��
���5�+�+�S�$�7����J��=s�B)�B)�B.�B.c�`�|jD�cgc]}|j|k(s�|��c}Scc}w)z9Returns the KeyBinding instances associated with handler.r�)rFrBr�s   rr�z!KeyBindings.getBindingsForHandler&s)��"�-�-�G�r����w�1F��G�G��Gs�+�+c	�l�tjtjkDryt|�dkrytt	td�|���t|�k(ryd�}d|j
��ddjt||����}tjtj|d�y)Nrc��|jSr��rC��xs r�<lambda>z4KeyBindings._checkMatchingBindings.<locals>.<lambda>4s
�����rc�:�|j�d|j�d�S)Nz (zx))rBrCr�s r�toStringz4KeyBindings._checkMatchingBindings.<locals>.toString7s���i�i�[��1�=�=�/��4�4rr�z' matches multiple handlers: z, T)	r�
debugLevelrsr�r�r��asSingleLineString�joinrr)rF�
keyboardEventrOr�rts     r�_checkMatchingBindingsz"KeyBindings._checkMatchingBindings+s������e�.�.�.���v�;�!����s�3�.��7�8�9�S��[�H��	5��]�=�=�?�@�A*�*.�)�)�C��&�4I�*J�)K�
M�	�	���5�+�+�S�$�7rc�V�g}g}|j�}|jD]�}|j|j|j�s�*|j
|jk(r |j|k(r|j|�|js�p|j|���d|j��d�|g}tjtj|d�|j||�|r|djS|j�ryd|j��d�|g}tjtj|d�|j!t#j$d����|j||�|D]}|j|ks�|jcSy)	z�Returns the input handler of the key binding that matches the
        given keycode and modifiers, or None if no match exists.
        z
KEYBINDINGS: z matchesTrNz fallback candidatesc�4�|j|jz
Sr�r�)r��ys  rr�z-KeyBindings.getInputHandler.<locals>.<lambda>es��a�m�m�a�m�m�>[�r)ri)�
getClickCountr�rP�hw_coderAr@rCrdr?r�rr�rsr�rB�isKeyPadKeyWithNumlockOn�sort�	functools�
cmp_to_key)rFr�rPr�r]r�r�r�s        r�getInputHandlerzKeyBindings.getInputHandler@s���
���
�"�0�0�2�
��*�*�		2�J��!�!�-�"7�"7��9P�9P�Q��+�+�}�/F�/F�F��)�)�Z�7��N�N�:�.��*�*��%�%�j�1�		2�"�-�"B�"B�"D�!E�X�N�PW�X��
���%�*�*�F�D�9��#�#�M�7�;���1�:�%�%�%��1�1�3��!�-�"B�"B�"D�!E�EY�Z����
���%�*�*�F�D�9�	���I�0�0�1[�\��]��#�#�M�:�>�#�	)�I��$�$�
�2� �(�(�(�	)�rc
��|D]l}|d}|d}|d}|d}	|d}||vr"|jt||||||���Cd|dg}	tjtj
|	d��ny	#t$rd}Y�`wxYw)
a4 Takes the keymappings and tries to find a matching named
           function in handlers.
           keymap is a list of lists, each list contains 5 elements
           If addUnbound is set to true, then at the end of loading all the
           keybindings, any remaining functions will be unbound.
        rrr8r9�zKEYBINDINGS: Could not findzhandler for keybinding.TN)rYr�r=rr�rs)
rFrr�r�r?�modifierMaskrArBr]r�s
          r�loadzKeyBindings.loadms����	B�A��Q�4�L��Q�4�L��!��I���d�G�
��q�T�
��(�"����� �,�	�8�G�;L�j�Z�[�8��B[�\���!�!�%�"2�"2�F�D�A�	B���
��
�
�s�A3�3B�BN)F)r)r�)r{r|r}r~rHrMr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r�qs[�����"�,�>$�

#�
&���#�J�0
�H�
8�*+�ZBrr�)0r~�__id__�__version__�__date__�
__copyright__�__license__�
gi.repositoryr�gi�require_versionrr�rrrr	�	orca_i18nr�
_keysymsCacher�
MODIFIER_ORCA�NO_MODIFIER_MASKr-�ALTr1�CONTROLr2r*�ORCA_ALT_MODIFIER_MASK�ORCA_CTRL_MODIFIER_MASK�ORCA_CTRL_ALT_MODIFIER_MASK�SHIFT�ORCA_SHIFT_MODIFIER_MASK�ORCA_ALT_SHIFT_MODIFIER_MASKr3�SHIFT_ALT_MODIFIER_MASK�CTRL_ALT_MODIFIER_MASK�SHIFT_ALT_CTRL_MODIFIER_MASKr0r/�COMMAND_MODIFIER_MASK�NON_LOCKING_MODIFIER_MASK�defaultModifierMaskrr6r;r=r�rrr�<module>r�sv��(�������?�
����	�����7�E�"��������
��
��
�!"��!"�e�&8�&8�&<�&<�!<��!"�e�&8�&8�&@�&@�!@��!"�m�!3��!"�m�!3�!"�e�&8�&8�&<�&<�!<�"=��!"�m�!3�!"�e�&8�&8�&@�&@�!@�"A��!"�m�!3�!"�e�&8�&8�&@�&@�!@�"A�!"�e�&8�&8�&<�&<�!<�"=��"#�m�!3�!"�e�&8�&8�&>�&>�!>�"?��!"�m�!3�!"�e�&8�&8�&<�&<�!<�"=�!"�e�&8�&8�&>�&>�!>�"?��"#�e�&8�&8�&>�&>�!>��!"�e�&8�&8�&>�&>�!>�!"�e�&8�&8�&<�&<�!<�"=��!"�e�&8�&8�&@�&@�!@�!"�e�&8�&8�&<�&<�!<�"=��!"�e�&8�&8�&>�&>�!>�!"�e�&8�&8�&@�&@�!@�"A�!"�e�&8�&8�&<�&<�!<�"=��"#�e�&8�&8�&<�&<�!<�!"�e�&8�&8�&@�&@�!@�"A�!"�e�&8�&8�&>�&>�!>�"?�"#�e�&8�&8�&>�&>�!>�"?��"#�e�&8�&8�&>�&>�!>�!"�e�&8�&8�&<�&<�!<�"=�!"�e�&8�&8�&@�&@�!@�"A�"#�e�&8�&8�&>�&>�!>�"?�"#�e�&8�&8�&>�&>�!>�	"?�
"#�m�!3�"4��0��7!�r6�p�$Y8�Y8�vVB�VBr

Zerion Mini Shell 1.0