%PDF- %PDF-
Mini Shell

Mini Shell

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

�

g
f�#����dZdZdZdZdZdZddlZddlZejdd	�dd
l	m
Z
ddlmZdd
l
mZddlmZddlmZddlmZGd�d�Zej,eej.��D]\ZZeeee��ej,eej.��D]\ZZeeee��ej,eej.��D]!\ZZej7d�s�eeee��#y)a�
Utilities for performing tasks related to accessibility inspection.
These utilities are app-type- and toolkit-agnostic. Utilities that might have
different implementations or results depending on the type of app (e.g. terminal,
chat, web) or toolkit (e.g. Qt, Gtk) should be in script_utilities.py file(s).

N.B. There are currently utilities that should never have custom implementations
that live in script_utilities.py files. These will be moved over time.
z$Id$z
$Revision$z$Date$zCopyright (c) 2023 Igalia, S.L.�LGPL�N�Atspiz2.0)r�)�debug)�AXObject)�AXUtilitiesCollection)�AXUtilitiesRole)�AXUtilitiesStatec��eZdZdZdZed��Zedd��Zed��Zed��Z	ed��Z
edd��Zed	��Zed
��Z
ed��Zed��Zy
)�AXUtilitieszCUtilities for performing tasks related to accessibility inspection.Fc��	tjd�}|S#t$r3}d|g}tjtj
|d�Yd}~yd}~wwxYw)zReturns the accessible desktoprz,ERROR: Exception getting desktop from Atspi:TN)r�get_desktop�	Exceptionr�printTokens�
LEVEL_INFO)�desktop�error�tokenss   �3/usr/lib/python3/dist-packages/orca/ax_utilities.pyrzAXUtilities.get_desktop7sU��	��'�'��*�G�����	�D�e�L�F����e�.�.���=���	�s��	A�)A�Ac�|��tj�}|�gS�fd�}ttj||��S)z�Returns a list of running applications known to Atspi, filtering out
        those which have no child windows if must_have_window is True.c�:���rtj|�dkDSy)NrT)r�get_child_count)�obj�must_have_windows �r�predz.AXUtilities.get_all_applications.<locals>.predMs�����/�/��4�q�8�8��)rr�listr�
iter_children)rrrs`  r�get_all_applicationsz AXUtilities.get_all_applicationsDs<���
�)�)�+���?��I�	�
�H�*�*�7�D�9�:�:rc���tj�}|�ytj|�D]	}||k(s�	yd|d|g}t	j
tj|d�y)z%Returns true if app is known to AtspiFTzWARNING:�	is not in)rrrrrrr)�appr�childrs    r�is_application_in_desktopz%AXUtilities.is_application_in_desktopTsi���)�)�+���?���+�+�G�4�	�E���|��	��c�;��8��
���%�*�*�F�D�9�rc���tj�}|�ytj|�D]}tj|�|k(s�|cSd|d|g}tjt
j|d�y)z9Returns the accessible application with the specified pidNzWARNING: app with pidr!T)rrrr�get_process_idrrr)�pidrr"rs    r�get_application_with_pidz$AXUtilities.get_application_with_piddsw���)�)�+���?���)�)�'�2�	�C��&�&�s�+�s�2��
�	�*�3��W�E��
���%�*�*�F�D�9�rc�,���tjjtjjg�d��d}t	j
|�r)t
j|���}tjs|S��fd�}t	j||�S)zBReturns all the descendants of obj that are static text leaf nodesc�2�tj|d�dvS)N�tag)N��br)r�
get_attribute)�accs r�is_not_elementzBAXUtilities.get_all_static_text_leaf_nodes.<locals>.is_not_elementys���)�)�#�u�5�9I�I�IrNc�F��tj|��vxr�|�S)N)r�get_role)r/r0�roless ��r�is_matchz<AXUtilities.get_all_static_text_leaf_nodes.<locals>.is_match�s#����$�$�S�)�U�2�J�~�c�7J�Jr)r�Role�STATIC�TEXTr�supports_collectionr�find_all_with_roler�COMPARE_COLLECTION_PERFORMANCE�find_all_descendants)r�resultr4r0r3s   @@r�get_all_static_text_leaf_nodesz*AXUtilities.get_all_static_text_leaf_nodestsy������"�"�E�J�J�O�O�4��	J����'�'��,�*�=�=�c�5�.�Y�F��=�=��
�	K��,�,�S�(�;�;rc����tj��|rEtjj�vr)�jtjj�d}t
j|�rv�stj|��}nKtjjtjjg}tj|�|�}tjs|S��fd�}t
j ||�S)z5Returns all the descendants of obj with a widget roleNc���tj|��vry�r,tj|�xrtj|�Sy)NFT)rr2r
�
is_showing�
is_visible)r/�must_be_showing_and_visibler3s ��rr4z-AXUtilities.get_all_widgets.<locals>.is_match�sB���� � ��%�U�2��*�'�2�2�3�7�\�<L�<W�<W�X[�<\�\�r)r	�get_widget_rolesrr5�PUSH_BUTTON�removerr8rr9�	StateType�SHOWING�VISIBLE�!find_all_with_role_and_all_statesrr:r;)rrB�exclude_push_buttonr<�statesr4r3s `    @r�get_all_widgetszAXUtilities.get_all_widgets�s���� �0�0�2���5�:�:�#9�#9�U�#B��L�L����/�/�0����'�'��,�.�.�A�A�#�u�M���/�/�1�1�5�?�?�3J�3J�K��.�P�P����(���=�=��
�	��,�,�S�(�;�;rc���d}tj|�r'tj|�}tj
s|Stj|tj�S)z,Returns the default button descendant of objN)	rr8r�find_default_buttonrr:�find_descendantr	�is_default_button�rr<s  r�get_default_buttonzAXUtilities.get_default_button�sN�����'�'��,�*�>�>�s�C�F��=�=��
��'�'��_�-N�-N�O�Orc���d}tj|�r'tj|�}tj
s|Stj|tj�S)z%Returns the focused descendant of objN)	rr8r�find_focused_objectrr:rOr
�
is_focusedrQs  r�get_focused_objectzAXUtilities.get_focused_object�sO�����'�'��,�*�>�>�s�C�F��=�=��
��'�'��-=�-H�-H�I�Irc���d}tj|�r'tj|�}tj
s|Stj|tj�S)z(Returns the status bar descendant of objN)	rr8r�find_status_barrr:rOr	�
is_status_barrQs  r�get_status_barzAXUtilities.get_status_bar�sN�����'�'��,�*�:�:�3�?�F��=�=��
��'�'��_�-J�-J�K�Krc�b�tj|�sytj|�stj|d��}|St
j|�r+d|dg}tjtj|d�yt
j|�r+d|dg}tjtj|d�yt
j|�r+d|dg}tjtj|d�yt
j|�r+d|dg}tjtj|d�yt
j|�r+d|d	g}tjtj|d�yd|d
g}tjtj|d�y)zJReturns True if obj is a dialog that should be treated as a message dialogFT)rJzAXUtilities:z(is not a message dialog: has scroll panez'is not a message dialog: has split panez/is not a message dialog: has tree or tree tablez2is not a message dialog: has combo box or list boxz,is not a message dialog: has editable objectz"is believed to be a message dialog)r	�is_dialog_or_alertrr8rrLr�has_scroll_panerrr�has_split_pane�has_tree_or_tree_table�has_combo_box_or_list_box�has_editable_object)r�widgetsrs   r�is_message_dialogzAXUtilities.is_message_dialog�sv���1�1�#�6���+�+�C�0�!�1�1�#�4�1�P�G��;�� �0�0��5�$�c�+U�V�F����e�.�.���=�� �/�/��4�$�c�+T�U�F����e�.�.���=�� �7�7��<�$�c�+\�]�F����e�.�.���=�� �:�:�3�?�$�c�+_�`�F����e�.�.���=�� �4�4�S�9�$�c�+Y�Z�F����e�.�.���=�� �#�'K�L��
���%�*�*�F�D�9�rN)F)TF)�__name__�
__module__�__qualname__�__doc__r:�staticmethodrrr$r(r=rLrRrVrZrc�rrrr2s���M�%*�"��
��
��
;��
;��
��
��
��
��<��<�$�<��<�8�	P��	P��	J��	J��	L��	L��%��%rr)�	predicate�find)rg�__id__�__version__�__date__�
__copyright__�__license__�inspect�gi�require_version�
gi.repositoryrr,r�	ax_objectr�ax_utilities_collectionr�ax_utilities_roler	�ax_utilities_stater
r�
getmembers�
isfunction�name�method�setattr�
startswithrirr�<module>rs��*�������1�
����	�����7�E�"����:�.�0�|�|�~'�G�&�&��'�BT�BT�U�'�L�D�&��K��v�&�'�'�G�&�&�'7�7�CU�CU�V�'�L�D�&��K��v�&�'�'�G�&�&�'<��HZ�HZ�[�+�L�D�&����v����T�6�*�+r

Zerion Mini Shell 1.0