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

�

g
f\1����dZdZdZdZdZdZddlZejdd	�dd
lm	Z	ddl
Z
ddlmZdd
lm
Z
ddlmZddlmZddlmZdZGd�d�ZGd�d�ZGd�dej.�Zy)z;Utilities for obtaining sounds to be presented for objects.z$Id:$z$Revision:$z$Date:$zCopyright (c) 2016 Igalia, S.L.�LGPL�N�Atspiz2.0)r�)�	generator)�settings_manager)�AXObject)�AXUtilities)�AXValue�	_generatec�"�eZdZdZd�Zd�Zd�Zy)�Iconz9Sound file representing a particular aspect of an object.c�N�tjj||�|_y�N)�os�path�join)�self�location�filenames   �6/usr/lib/python3/dist-packages/orca/sound_generator.py�__init__z
Icon.__init__/s���G�G�L�L��8�4��	�c�D�d|j�d|j��d�S)NzIcon(path: z, isValid: �))r�isValid�rs r�__str__zIcon.__str__2s"���T�Y�Y�K�{�4�<�<�>�2B�!�D�Drc�T�tjj|j�Sr)rr�isfilers rrzIcon.isValid5s���w�w�~�~�d�i�i�(�(rN)�__name__�
__module__�__qualname__�__doc__rrr�rrr
r
,s��C�5�E�)rr
c�V�eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdefd�Zd�Zy)�Tonez3Tone representing a particular aspect of an object.rr��������	�
��c��||_ttd|�d�|_t	j
�j
d�|z|_||_y)Nri N�soundVolume)	�duration�min�max�	frequencyr�
getManager�
getSetting�volume�wave)rr4r7�volumeMultiplierr;s     rrz
Tone.__init__IsF�� ��
��S��I�.��6���&�1�1�3�>�>�}�M�P`�`�����	rc	�p�d|j�d|j�d|j�d|j�d�	S)NzTone(duration: z
, frequency: z
, volume: z, wave: r)r4r7r:r;rs rrzTone.__str__OsD���d�m�m�_�-��.�.�)�*��{�{�m�$��Y�Y�K�q�
"�	
rN)r r!r"r#�	SINE_WAVE�SQUARE_WAVE�SAW_WAVE�
TRIANGLE_WAVE�SILENCE�WHITE_UNIFORM_NOISE�
PINK_NOISE�SINE_WAVE_USING_TABLE�PERIODIC_TICKS�WHITE_GAUSSIAN_NOISE�	RED_NOISE�INVERTED_PINK_NOISE�INVERTED_RED_NOISErrr$rrr&r&8sZ��=��I��K��H��M��G����J����N����I�����=>�Y��
rr&c����eZdZdZ�fd�Zd�Zd�Z�fd�Z�fd�Z�fd�Z	�fd�Z
�fd	�Z�fd
�Z�fd�Z
�fd�Z�fd
�Z�fd�Z�fd�Z�fd�Zd�Zd�Zd�Z�fd�Z�fd�Zd�Zd�Z�xZS)�SoundGeneratorz@Takes accessible objects and produces the sound(s) to be played.c���t�|�|d�tjj	tj�j�d�|_y)N�sound�sounds)	�superrrrrrr8�getPrefsDir�_sounds)r�script�	__class__s  �rrzSoundGenerator.__init__Zs<���
�����)��w�w�|�|�$4�$?�$?�$A�$M�$M�$O�QY�Z��rc�T�t|j|�}|j�r|Syr)r
rRr)rr�icons   r�_convertFilenameToIconz%SoundGenerator._convertFilenameToIcon^s#���D�L�L�(�+���<�<�>��K�rc�(�|j|fi|��S)z@Returns an array of sounds for the complete presentation of obj.)�generate�r�obj�argss   r�
generateSoundzSoundGenerator.generateSoundes���t�}�}�S�)�D�)�)rc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z8Returns an array of sounds indicating obj is grayed out.�playSoundForState)rr8r9rP�_generateAvailability�list�maprW�rr[r\�	filenames�resultrTs     �rr`z$SoundGenerator._generateAvailabilityp�Z��� �*�*�,�7�7�8K�L��I��G�1�#�>��>�	��c�$�5�5�y�A�B����M��	rc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS�z?Returns an array of sounds indicating the checked state of obj.r_)rr8r9rP�_generateCheckedStaterarbrWrcs     �rriz$SoundGenerator._generateCheckedState}rfrc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z7Returns an array of sounds indicating obj is clickable.r_)rr8r9rP�_generateClickablerarbrWrcs     �rrkz!SoundGenerator._generateClickable�sZ��� �*�*�,�7�7�8K�L��I��G�.�s�;�d�;�	��c�$�5�5�y�A�B����M��	rc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z@Returns an array of sounds indicating the expanded state of obj.r_)rr8r9rP�_generateExpandableStaterarbrWrcs     �rrmz'SoundGenerator._generateExpandableState�sZ��� �*�*�,�7�7�8K�L��I��G�4�S�A�D�A�	��c�$�5�5�y�A�B����M��	rc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z9Returns an array of sounds indicating obj has a longdesc.r_)rr8r9rP�_generateHasLongDescrarbrWrcs     �rroz#SoundGenerator._generateHasLongDesc��Z��� �*�*�,�7�7�8K�L��I��G�0��=��=�	��c�$�5�5�y�A�B����M��	rc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgSrh)rr8r9rP�_generateMenuItemCheckedStaterarbrWrcs     �rrrz,SoundGenerator._generateMenuItemCheckedState��Z��� �*�*�,�7�7�8K�L��I��G�9�#�F��F�	��c�$�5�5�y�A�B����M��	rc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z=Returns an array of sounds indicating obj is multiselectable.r_)rr8r9rP�_generateMultiselectableStaterarbrWrcs     �rruz,SoundGenerator._generateMultiselectableState�rsrc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z@Returns an array of sounds indicating the selected state of obj.r_)rr8r9rP�_generateRadioStaterarbrWrcs     �rrwz"SoundGenerator._generateRadioState�sZ��� �*�*�,�7�7�8K�L��I��G�/��<�t�<�	��c�$�5�5�y�A�B����M��	rc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z7Returns an array of sounds indicating obj is read only.r_)rr8r9rP�_generateReadOnlyrarbrWrcs     �rryz SoundGenerator._generateReadOnly��Z��� �*�*�,�7�7�8K�L��I��G�-�c�:�T�:�	��c�$�5�5�y�A�B����M��	rc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z6Returns an array of sounds indicating obj is required.r_)rr8r9rP�_generateRequiredrarbrWrcs     �rr|z SoundGenerator._generateRequired�rzrc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z>Returns an array of sounds indicating the on/off state of obj.r_)rr8r9rP�_generateSwitchStaterarbrWrcs     �rr~z#SoundGenerator._generateSwitchState�rprc���tj�jd�sgSt�|�|fi|��}tt
|j|��}|r|SgS)z?Returns an array of sounds indicating the toggled state of obj.r_)rr8r9rP�_generateToggleStaterarbrWrcs     �rr�z#SoundGenerator._generateToggleState�rprc�Z�tj�jd�sgS|jdd�s|j|d<d|d<tj|�rJ|jjjdi|��g}tt|j|��}|r|SgS)z?Returns an array of sounds indicating the visited state of obj.r_�modeN�visited�
stringTyper$)
rr8r9�get�_moder	�
is_visited�_script�
formatting�	getStringrarbrW)rr[r\rdres     r�_generateVisitedStatez$SoundGenerator._generateVisitedStates��� �*�*�,�7�7�8K�L��I��x�x���%��:�:�D��L�&��\���!�!�#�&�:����0�0�:�:�B�T�B�C�I��#�d�9�9�9�E�F�F���
��	rc��tj�jd�sgStj|�}|�gSgS)z<Returns an array of sounds reflecting the percentage of obj.�playSoundForValue)rr8r9r
�get_value_as_percent)rr[r\�percents    r�_generatePercentagez"SoundGenerator._generatePercentage$s@�� �*�*�,�7�7�8K�L��I��.�.�s�3���?��I��	rc�r�|jd�r|j|fi|��s'gStj�j	d�sgStj|�}|�gS|dk\rd}nd}d|dzz
}|dkrtd|d	zz�}nt|d
z�}t|||tj�gS)z?Returns an array of sounds representing the progress bar value.�isProgressBarUpdater��crg333333�?�xr,�bg������@�)
r��_shouldPresentProgressBarUpdaterr8r9r
r��intr&r>)rr[r\r�r4r<r7s       r�_generateProgressBarValuez(SoundGenerator._generateProgressBarValue0s����8�8�)�*�7�4�7�7��D�t�D��	�!�,�,�.�9�9�:M�N��I��.�.�s�3���?��I��b�=��H��H���#�
�.���Q�;��B��3��.�/�I��G�b�L�)�I��X�y�*:�D�N�N�K�L�Lrc���tj�jd�}|�t�|��St|�S)N�progressBarBeepInterval)rr8r9rP�_getProgressBarUpdateIntervalr�)r�intervalrTs  �rr�z,SoundGenerator._getProgressBarUpdateIntervalNs;���#�.�.�0�;�;�<U�V�����7�8�:�:��8�}�rc�l��tj�jd�syt�|�|fi|��S)N�beepProgressBarUpdatesF)rr8r9rPr�)rr[r\rTs   �rr�z.SoundGenerator._shouldPresentProgressBarUpdateUs3����*�*�,�7�7�8P�Q���w�6�s�C�d�C�Crc�P�tj�jd�sgSgS)z>Returns an array of sounds reflecting the set position of obj.�playSoundForPositionInSet)rr8r9rZs   r�_generatePositionInSetz%SoundGenerator._generatePositionInSetas(�� �*�*�,�7�7�8S�T��I��	rc��tj�jd�sgS|jdt	j
|��}t
j|�jdd�}|j|�}|r|gSgS)z6Returns an array of sounds indicating the role of obj.�playSoundForRole�role� �_)
rr8r9r�r�get_roler�
role_get_name�replacerW)rr[r\r�rres      r�_generateRoleNamez SoundGenerator._generateRoleNamemsx�� �*�*�,�7�7�8J�K��I��x�x��� 1� 1�#� 6�7���&�&�t�,�4�4�S�#�>���,�,�X�6����8�O��	r)r r!r"r#rrWr]r`rirkrmrorrrurwryr|r~r�r�r�r�r�r�r�r��
__classcell__)rTs@rrLrLWsw���J�[��*��������������0
�M�<�D�
�rrL)r#�__id__�__version__�__date__�
__copyright__�__license__�gi�require_version�
gi.repositoryrr�rr�	ax_objectr�ax_utilitiesr	�ax_valuer
�
METHOD_PREFIXr
r&�	GeneratorrLr$rr�<module>r�s{��,B�������1�
���	�����7�E�"��	����%���
�
)�
)�
�
�>b�Y�(�(�br

Zerion Mini Shell 1.0