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

�

g
f���6�dZdZdZdZdZdZddlZejdd	�ejd
d	�ddlm	Z	m
Z
mZdd
lm
Z
ddlmZddlmZddlmZddlmZddlmZddlmZddlmZGd�d�ZGd�dej.�Ze�Zd�Zy)z3Module for performing accessible actions via a menuz$Id$z
$Revision$z$Date$zCopyright (c) 2023 Igalia, S.L.�LGPL�N�Gdkz3.0�Gtk)r�GLibr�)�cmdnames)�debug)�
focus_manager)�input_event)�keybindings)�messages)�script_manager)�AXObjectc�F�eZdZdZd�Zdd�Zdd�Zd�Zd�Zd�Z	d�Z
d
d
�Zy	)�ActionPresenterz=Provides menu for performing accessible actions on an object.c��|jd�|_tj�|_d|_d|_d|_y)NT)�get_handlers�	_handlersr�KeyBindings�	_bindings�_gui�_obj�_window)�selfs �7/usr/lib/python3/dist-packages/orca/action_presenter.py�__init__zActionPresenter.__init__0s9���*�*�4�0���$�0�0�2�����	���	����c��|rCd}tjtj|d�|j�|jS|jj�r|j�|jS)z)Returns the action-presenter keybindings.z&ACTION PRESENTER: Refreshing bindings.T)r	�printMessage�
LEVEL_INFO�_setup_bindingsr�isEmpty)r�refresh�
is_desktop�msgs    r�get_bindingszActionPresenter.get_bindings7sd���:�C����u�/�/��d�;�� � �"��~�~���^�^�
#�
#�
%�� � �"��~�~�rc��|r7d}tjtj|d�|j�|jS)z&Returns the action-presenter handlers.z&ACTION PRESENTER: Refreshing handlers.T)r	rr �_setup_handlersr)rr#r%s   rrzActionPresenter.get_handlersCs:���:�C����u�/�/��d�;�� � �"��~�~�rc���i|_tj|jtj
�|jd<d}t
jtj|d�y)z2Sets up the action-presenter input event handlers.�show_actions_menuz"ACTION PRESENTER: Handlers set up.TN)	rr�InputEventHandlerr*r�SHOW_ACTIONS_MENUr	rr �rr%s  rr(zActionPresenter._setup_handlersMs[�����
�)�)��&�&��*�*�
,�	
���*�+�
3��
���5�+�+�S�$�7rc
�P�tj�|_|jjtjdtj
tj|jjd���d}tjtj|d�y)z*Sets up the action-presenter key bindings.�ar*z"ACTION PRESENTER: Bindings set up.TN)rrr�add�
KeyBinding�defaultModifierMask�ORCA_SHIFT_MODIFIER_MASKr�getr	rr r-s  rr!zActionPresenter._setup_bindingsZs{��%�0�0�2���������"�"���/�/��4�4����"�"�#6�7�	
9�	:�3��
���5�+�+�S�$�7rc� �d|jd|jg}tjtj|d�d}tj|j�}tj�j||j�}tj�j||�tj�}|j|�|j|j�|jd|j�y)z>Restores focus to the object associated with the actions menu.z$ACTION PRESENTER: Restoring focus to�inTz(Action Presenter menu is being destroyedN)rrr	�printTokensr r�get_applicationr�
getManager�	getScript�setActiveScriptr
�clear_state�set_active_window�set_locus_of_focus)r�tokens�reason�app�script�managers      r�_restore_focuszActionPresenter._restore_focusis���9�$�)�)�T�4�<�<�X��
���%�*�*�F�D�9�<���&�&�t�y�y�1���*�*�,�6�6�s�D�I�I�F���!�!�#�3�3�F�F�C��*�*�,�����F�#��!�!�$�,�,�/��"�"�4����3rc��tj|j|�}d|d|jd|g}tjtj
|d�d|_y)z%Attempts to perform the named action.zACTION PRESENTER: Performing�onz
succeeded:TN)r�do_named_actionrr	r7r r)r�action�resultr?s    r�_perform_actionzActionPresenter._perform_actionzsP���)�)�$�)�)�V�<��0�&�$��	�	�<�Y_�`��
���%�*�*�F�D�9���	rNc��tj�}|j�dxs|j�}|�3tj
}tj}|j||�yi}ttj|��D]l}tj||�}	tj||�}
d|�d�|d|	�d|
�d�g}tjtj|d�|
xs|	||	<�n|j!�sUtj"|�xs|j$j'|�}	|jtj(|	z�y||_|j-�|_t1||j2|j4�|_d}d	|�d
�}
tj8tj|
d�t;j<||j6j>�y)z7Shows a menu with all the available accessible actions.rTzACTION PRESENTER: Action z onz: 'z' localized description: '�'i�z!ACTION PRESENTER: Delaying popup z ms due to GtkMenu grab conflict.) r
r9�&get_active_mode_and_object_of_interest�get_locus_of_focusr
�LOCATION_NOT_FOUND_FULL�LOCATION_NOT_FOUND_BRIEF�presentMessage�ranger�
get_n_actions�get_action_name�get_action_descriptionr	r7r �items�get_name�speechGenerator�getLocalizedRoleName�NO_ACTIONS_FOUND_ONr�get_active_windowr�
ActionMenurJrDrrr�timeout_add�show_gui)rrB�eventrC�obj�full�brief�actions�i�name�descriptionr?�timeoutr%s              rr*z!ActionPresenter.show_actions_menu�s��� �*�*�,���<�<�>�q�A�a�W�E_�E_�Ea���;��3�3�D��5�5�E��!�!�$��.�����x�-�-�c�2�3�	0�A��+�+�C��3�D�"�9�9�#�q�A�K�1�!��C�8�#��D�6�!;�K�=��J�L�F����e�.�.���=�'�/�4�G�D�M�
	0��}�}���$�$�S�)�]�V�-C�-C�-X�-X�Y\�-]�D��!�!�(�">�">��"E�F����	��0�0�2����w��(<�(<�d�>Q�>Q�R��	���1�'��:Z�[��
���5�+�+�S�$�7�����$�)�)�"4�"4�5�r)FT)F�N)�__name__�
__module__�__qualname__�__doc__rr&rr(r!rDrJr*�rrrr-s-��G��
��8�
8�4�"� rrc�:��eZdZdZ�fd�Zd�Zd�Zd�Zd�Z�xZ	S)r\z:A simple Gtk.Menu containing a list of accessible actions.c�f��t�|��|jd|j�|jd|j�||_||_|j�D]I\}}tj|��}|jd|j|�|j|��Ky)Nz	popped-up�hide)�label�activate)�superr�connect�
_on_popped_up�
_on_hidden�on_option_selected�on_menu_hiddenrVr�MenuItem�_on_activate�append)rrc�action_handler�cleanup_handlerrerf�	menu_item�	__class__s       �rrzActionMenu.__init__�s����
�������[�$�"4�"4�5����V�T�_�_�-�"0���-���!(����	#��D�+����;�7�I����j�$�*;�*;�T�B��K�K�	�"�	#rc�&�|j|�y)z*Handler for the 'activate' menuitem signalN)rw)r�widget�options   rrzzActionMenu._on_activate�s��	
����'rc�R�d}tjtj|d�y)z'Handler for the 'popped-up' menu signalz&ACTION PRESENTER: ActionMenu popped upTN)r	rr �r�argsr%s   rruzActionMenu._on_popped_up�s!��7��
���5�+�+�S�$�7rc�r�d}tjtj|d�|j�y)z"Handler for the 'hide' menu signalz#ACTION PRESENTER: ActionMenu hiddenTN)r	rr rxr�s   rrvzActionMenu._on_hidden�s-��4��
���5�+�+�S�$�7����rc���|j�tjj�}|j	�}|j�}|j
�\}}}tjjtjj�}|j|�|j|�tj�|_||_||_tj$�}||_||_d|_d|_tj*�}	|j-|	|tj.j0tj.j0|�y)zShows the menurN)�show_allr�Display�get_default�get_default_seat�get_pointer�get_position�Event�new�	EventType�BUTTON_PRESS�
set_screen�
set_devicer�get_current_event_time�time�x�y�	Rectangle�width�height�get_default_root_window�
popup_at_rect�Gravity�
NORTH_WEST)
r�display�seat�device�screenr�r�r_�rect�windows
          rr^zActionMenu.show_gui�s��	
�
�
���+�+�)�)�+���'�'�)���!�!�#���*�*�,����1��	�	�
�
�c�m�m�8�8�9��
���� �
���� ��/�/�1��
��������}�}�����������
�����,�,�.�����6�4����)?�)?����AW�AW�Y^�_r)
rirjrkrlrrzrurvr^�
__classcell__)rs@rr\r\�s ���D�	#�(�
8��`rr\c��tSrh)�
_presenterrmrr�getPresenterr��s���r)rl�__id__�__version__�__date__�
__copyright__�__license__�gi�require_version�
gi.repositoryrrr�rr	r
rrr
r�	ax_objectrr�Menur\r�r�rmrr�<module>r�s���*:�������1�
���	�����5�%� �����5�%� �(�(���������u�u�p7`����7`�t�
�
�r

Zerion Mini Shell 1.0