%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_value.cpython-312.pyc

�

g
fO���dZdZdZdZdZdZddlZddlZddlZejdd	�dd
l
mZddlm
Z
dd
lmZddlmZGd�d�Zej'�y)a�
Utilities for obtaining value-related information about accessible objects.
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$zGCopyright (c) 2024 Igalia, S.L.Copyright (c) 2024 GNOME Foundation Inc.�LGPL�N�Atspiz2.0)r�)�debug)�AXObject)�AXUtilitiesc���eZdZdZiZej�Zed��Z	ed��Z
ed��Zed��Zed��Z
ed��Zed��Zed	��Zed
��Zy)�AXValuezKUtilities for obtaining value-related information about accessible objects.c��	tjd�d}tjtj|d�t
jj��[)z*Clears any data we have cached for objectsT�<zAXValue: Clearing local cache.)�time�sleepr�printMessage�
LEVEL_INFOr
�LAST_KNOWN_VALUE�clear)�msgs �//usr/lib/python3/dist-packages/orca/ax_value.py�_clear_stored_datazAXValue._clear_stored_data8sF����J�J�r�N�2�C����u�/�/��d�;��$�$�*�*�,�	�c�z�tjtj��}d|_|j�y)z3Starts thread to periodically clear cached details.)�targetTN)�	threading�Threadr
r�daemon�start)�threads r�start_cache_clearing_threadz#AXValue.start_cache_clearing_threadBs*���!�!��)C�)C�D����
����rc��tj|�sytjj	t|��}|tj
|�k7}|r-d|d|��g}tjtj|d�|S)z*Returns True if the current value changed.FzAXValue: Previous value ofzwas T)
r�supports_valuer
r�get�hash�_get_current_valuer�printTokensr)�obj�	old_value�result�tokenss    r�did_value_changezAXValue.did_value_changeJsw���&�&�s�+���,�,�0�0��c��;�	��g�8�8��=�=���2�C�4�	�{�9K�L�F����e�.�.���=��
rc�L�tj|�sy	tjj	|�}d|d|��g}t
jtj|d�|S#t
$r4}d|��}t
jtj|d�Yd}~yd}~wwxYw)�!Returns the current value of obj.rz*AXValue: Exception in _get_current_value: TN�AXValue: Current value of�is )
rr r�Value�get_current_value�	Exceptionrrrr$�r%�value�errorrr(s     rr#zAXValue._get_current_valueYs����&�&�s�+��	��K�K�1�1�#�6�E�.�s�c�%��M�B��
���%�*�*�F�D�9�����	�>�u�g�F�C����u�/�/��d�;���	���A&�&	B#�/*B�B#c��tj|�sytj|�}|tjt|�<|S)r+r)rr r
r#rr")r%r2s  rr/zAXValue.get_current_valueks>���&�&�s�+���*�*�3�/��.3�� � ��c��+��rc��tj|dd�xsd}|r0d|d|�d�g}tjtj|d�|Stj
|�sy	tjj|�}d
|d|�d�g}tjtj|d�|r|Stj|�}t|�dkr.|dk7r)t|�}t|j!d
�d�}nd}|d
|�d��S#t$r6}d|��}tjtj|d�d}Yd	}~��d	}~wwxYw)zGReturns the app-provided text-alternative for the current value of obj.�	valuetextF�z AXValue: valuetext attribute forzis '�'Tz.AXValue: Exception in get_current_value_text: NzAXValue: Value text ofrr�.�f)r�
get_attributerr$rr rr.�get_textr0rr
r#�abs�str�len�split)	r%�textr(r2r3r�current�str_current�decimal_placess	         r�get_current_value_textzAXValue.get_current_value_textvsK���%�%�c�;��>�D�"���8�#��d�V�1�~�N�F����e�.�.���=��K��&�&�s�+��	��K�K�(�(��-�E�+�C�4��w�a��A��
���%�*�*�F�D�9���L��,�,�S�1���w�<�!���1���g�,�K� ��!2�!2�3�!7��!:�;�N��N��!�N�+�1�,�-�.��#�	�B�5�'�J�C����u�/�/��d�;��E��	�s�%D�	E�,E�Ec���tj|�sytj|�}t	j
|�r0|dkr+d|dg}t
jtj|d�ytj|�}tj|�}||k(ryt|||z
zdz�}d|d|��g}t
jtj|d�|S)	zJReturns the current value as a percent, or None if that is not applicable.NrzAXValue:zhas state indeterminateT�dr,zas percent is is )rr r
r#r�is_indeterminaterr$r�get_minimum_value�get_maximum_value�int)r%r2r(�minimum�maximumr's      r�get_value_as_percentzAXValue.get_value_as_percent�s����&�&�s�+���*�*�3�/���'�'��,��!�� �#�'@�A�F����e�.�.���=���+�+�C�0���+�+�C�0���g����e�w��0�1�S�8�9��-�s�6G��x�4P�Q��
���%�*�*�F�D�9��
rc�L�tj|�sy	tjj	|�}d|d|��g}t
jtj|d�|S#t
$r4}d|��}t
jtj|d�Yd}~yd}~wwxYw)z!Returns the minimum value of obj.rz)AXValue: Exception in get_minimum_value: TNzAXValue: Minimum value ofr-)
rr rr.rJr0rrrr$r1s     rrJzAXValue.get_minimum_value�����&�&�s�+��	��K�K�1�1�#�6�E�.�s�c�%��M�B��
���%�*�*�F�D�9�����	�=�e�W�E�C����u�/�/��d�;���	�r4c�L�tj|�sy	tjj	|�}d|d|��g}t
jtj|d�|S#t
$r4}d|��}t
jtj|d�Yd}~yd}~wwxYw)z!Returns the maximum value of obj.rz)AXValue: Exception in get_maximum_value: TNzAXValue: Maximum value ofr-)
rr rr.rKr0rrrr$r1s     rrKzAXValue.get_maximum_value�rQr4N)�__name__�
__module__�__qualname__�__doc__rr�Lock�_lock�staticmethodrrr)r#r/rFrOrJrK�rrr
r
2s���U����I�N�N��E��-��-�������������"�����/��/�B����,����"���rr
)rV�__id__�__version__�__date__�
__copyright__�__license__rr
�gi�require_version�
gi.repositoryrr8r�	ax_objectr�ax_utilitiesrr
rrZrr�<module>resi��,�������;�
�����	�����7�E�"����%�_�_�B�#�#�%r

Zerion Mini Shell 1.0