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

�

g
f ����dZdZdZdZdZdZddlZejdd	�dd
lm	Z	ddl
Z
ddlmZdd
lm
Z
ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZdZGd�d�ZGd�d�ZGd�d�ZGd�de�ZGd�d e�Z Gd!�d"e�Z!Gd#�d$�Z"Gd%�d&�Z#y)'z=Provides the default implementation for flat review for Orca.z$Id$z
$Revision$z$Date$zLCopyright (c) 2005-2008 Sun Microsystems Inc.Copyright (c) 2016 Igalia, S.L.�LGPL�N�Atspiz2.0)r�)�braille)�debug)�
focus_manager)�script_manager)�settings)�AXComponent)�AXEventSynthesizer)�AXObject)�AXText)�AXUtilitiesuc��eZdZdZd�Zy)�Charz/A character's worth of presentable information.c	��||_||_||_|dz|_||_||_||_||_||_y)aCreates a new char.

        Arguments:
        - word: the Word instance this belongs to
        - startOffset: the start offset with respect to the accessible
        - string: the actual char
        - x, y, width, height: the extents of this Char on the screen
        rN)	�word�index�startOffset�	endOffset�string�x�y�width�height)	�selfrrrrrrrrs	         �2/usr/lib/python3/dist-packages/orca/flat_review.py�__init__z
Char.__init__4sH����	���
�&���$�q���������������
����N)�__name__�
__module__�__qualname__�__doc__r�rrrr1s
��9�rrc�4��eZdZdZd�Zd�Z�fd�Zd�Z�xZS)�Wordz;A single chunk (word or object) of presentable information.c	���||_||_||_||_t	|�|_|jt	|�z|_||_||_||_	||_
g|_y)aGCreates a new Word.

        Arguments:
        - zone: the Zone instance this belongs to
        - index: the index of this Word in the Zone
        - startOffset: the start offset with respect to the accessible
        - string: the actual string
        - x, y, width, height: the extents of this Word on the screen
        N)�zonerrr�len�lengthrrrrr�chars)	rr(rrrrrrrs	         rrz
Word.__init__Lse����	���
�&�������&�k����)�)�C��K�7�����������
������
rc��d|jjdd�|j|j|jj
fzS)NzWORD: '%s' (%i-%i) %s�
�\n)r�replacerrr(�
accessible�rs r�__str__zWord.__str__csE��&�
�[�[�
 �
 ��u�
-�
�
�
�
�^�^�
�Y�Y�
!�
!�
#�#�	#rc	�x��|dk7rt�|�|�Sg}t|j�D]�\}}||jz}tj|jj|�}|j|j|j|jf}|jt||||g|������|S)Nr+)�super�__getattribute__�	enumeraterrr�get_character_rectr(r0rrrr�appendr)	r�attrr+�i�char�start�rect1�extents�	__class__s	        �rr5zWord.__getattribute__js�����7�?��7�+�D�1�1��� ����-�	?�G�A�t���(�(�(�E��-�-�d�i�i�.B�.B�E�J�E��g�g�u�w�w����U�\�\�A�G��L�L��d�A�u�d�=�W�=�>�		?��rc��|j|cxkr%|jt|j�zkrny||jz
Sy)z8Returns the char offset with respect to this word or -1.���)rr)r)r�offsets  r�getRelativeOffsetzWord.getRelativeOffsetwsF�����v�K��(8�(8�3�t�{�{�;K�(K�K���D�,�,�,�,�r)	r r!r"r#rr2r5rC�
__classcell__�r?s@rr&r&Is���E��.#��rr&c���eZdZdZej
dej�Zdd�Zd�Z	�fd�Z
d�Zd
d�Zd�Z
d	�Zd
�Zd�Z�xZS)�Zonez>Represents text that is a portion of a single horizontal line.z(\S+\s*)c���||_d|_||_t|�|_||_||_||_||_|xstj|�|_g|_y)aCreates a new Zone.

        Arguments:
        - accessible: the Accessible associated with this Zone
        - string: the string being displayed for this Zone
        - extents: x, y, width, height in screen coordinates
        - role: Role to override accessible's role.
        rN)
r0r�_stringr)r*rrrrr
�get_role�role�_words)rr0rrrrrrKs        rrz
Zone.__init__�s_��%����������&�k�����������
�����9�H�-�-�j�9��	���rc�Z�d|jjdd��d|j��S)NzZONE: 'r-r.z' )rIr/r0r1s rr2zZone.__str__�s"��"&�,�,�"6�"6�t�U�"C�T�_�_�U�Urc
����|dvrt�|�|�S|dk(r|jS|j�s|jS|j
|j|j|jf}g}ttj|j|j��D]?\}}|jt|||j�|j!�g|�����A||_|S)� To ensure we update the content.��wordsrr)r4r5rI�_shouldFakeTextrLrrrrr6�re�finditer�WORDS_REr8r&r<�group)rr9r>rQr:rr?s      �rr5zZone.__getattribute__�s�����*�*��7�+�D�1�1��8���<�<���#�#�%��;�;���&�&�$�&�&�$�*�*�d�k�k�9���� ����T�]�]�D�L�L�!I�J�	N�G�A�t��L�L��d�A�t�z�z�|�T�Z�Z�\�L�G�L�M�	N�����rc��tjjtjjtjjtjj
tjjtjjtjjtjjg}|j|vryy)z8Returns True if we should try to fake the text interfaceTF)r�Role�LABEL�MENU�	MENU_ITEM�CHECK_MENU_ITEM�RADIO_MENU_ITEM�PAGE_TAB�PUSH_BUTTON�
TABLE_CELLrK)r�	textRoless  rrRzZone._shouldFakeText�s����Z�Z�%�%��Z�Z�_�_��Z�Z�)�)��Z�Z�/�/��Z�Z�/�/��Z�Z�(�(��Z�Z�+�+��Z�Z�*�*�,�	��9�9�	�!��rc��|jdk(rJ|jdk(r;|j|jcxkxr|j|jzkScS|jdk(rJ|jdk(r;|j|jcxkxr|j|jzkScSt|j|jz|j|jz�}t	|j|j�}||k\ry|j|jdzz}|j|jdzz}t||z
�|kDryy)zAReturns True if this Zone is physically on the same line as zone.rF�T)rrr�min�max�abs)rr(�
pixelDelta�
highestBottom�	lowestTop�middle�
zoneMiddles       r�_extentsAreOnSameLinezZone._extentsAreOnSameLine�s���:�:��?�t�{�{�a�/��6�6�T�V�V�;�t�v�v����';�;�;�;�;��:�:��?�t�{�{�a�/��6�6�T�V�V�;�t�v�v����';�;�;�;�;��D�F�F�T�[�[�0�$�&�&�4�;�;�2F�G�
��������'�	��
�%�����$�+�+��/�)���V�V�d�k�k�A�o�-�
��v�
�"�#�j�0��rc���tjj|j|jfvr|j|jk(Stj|j�}tj|�}tj|j�}tj|�}tjj||fvr||k(S|j|�S)zAReturns True if we treat this Zone and zone as being on one line.)
rrX�
SCROLL_BARrKr0r
�
get_parentrJ�MENU_BARrl)rr(�
thisParent�thisParentRole�
zoneParent�zoneParentRoles      r�
onSameLinezZone.onSameLine�s����:�:� � �T�Y�Y��	�	�$:�:��?�?�d�o�o�5�5��(�(����9�
�!�*�*�:�6���(�(����9�
�!�*�*�:�6���:�:���>�>�"B�B���+�+��)�)�$�/�/rc�t�d|��}tjtj|d�|jD]G}d|g}tjtj|d�|j|�}|dk\s�C||fcS|j|k(r)|jr|jd}||jfSy)Nz*FLAT REVIEW: Searching for word at offset TzFLAT REVIEW: CheckingrrA�NrA)r�printMessage�
LEVEL_INFOrQ�printTokensrCr*)r�
charOffset�msgr�tokensrB�lastWords       r�getWordAtOffsetzZone.getWordAtOffset�s���:�:�,�G��
���5�+�+�S�$�7��J�J�	$�D�-�t�4�F����e�.�.���=��+�+�J�7�F���{��V�|�#�
	$��;�;�*�$�����z�z�"�~�H��X�_�_�,�,�rc��y)�-Returns True if this Zone contains the caret.Fr$r1s r�hasCaretz
Zone.hasCaret�s��rc��y�z4Returns the Word and relative offset with the caret.rwr$r1s r�
wordWithCaretzZone.wordWithCarets��r�N)�)r r!r"r#rS�compile�UNICODErUrr2r5rRrlrurr�r�rDrEs@rrGrG�sJ���H��r�z�z�+�r�z�z�2�H��*V��.�"�*
0��$�
rrGc�:��eZdZdZd�fd�	Z�fd�Zd�Zd�Z�xZS)�TextZonez5A Zone whose purpose is to display text of an object.c		�x��t�	|�|||||||�||_|jt|�z|_yr�)r4rrr)r)
rr0rrrrrrrKr?s
         �rrzTextZone.__init__s:���
����V�Q��5�&�$�G�&����)�)�C��K�7��rc
�l���|dvrt�
��|�Stj�j�j
�j�}g}ttj�j|��D]�\}}t�fd�|j��\}}tj�j||�}|j|j|j |j"f}	|j%t'�|||j)�g|	������|�_|�_t�
��|�S)rOrPc�"��|�jzSr�)r)rrs �r�<lambda>z+TextZone.__getattribute__.<locals>.<lambda>s���q�4�+;�+;�';�r)r4r5r�
get_substringr0rrr6rSrTrU�map�span�get_range_rectrrrrr8r&rVrIrL)rr9rrQr:rr<�end�rectr>r?s`         �rr5zTextZone.__getattribute__s�����*�*��7�+�D�1�1��%�%�d�o�o�t�7G�7G����X���� ����T�]�]�F�!C�D�	G�G�A�t��;�T�Y�Y�[�I�J�E�3��(�(����%��E�D��f�f�d�f�f�d�j�j�$�+�+�=�G��L�L��d�A�u�d�j�j�l�E�W�E�F�		G��������w�'��-�-rc���|jtj|j�cxkr|jkry|jtj
|j�k(S)r�T)rr�get_caret_offsetr0r�get_character_countr1s rr�zTextZone.hasCaret sS�����v�6�6�t���G�X�$�.�.�X��Y��~�~��!;�!;�D�O�O�!L�L�Lrc��|j�sy|jtj|j��Sr�)r�rrr�r0r1s rr�zTextZone.wordWithCaret(s0���}�}����#�#�F�$;�$;�D�O�O�$L�M�Mrr�)	r r!r"r#rr5r�r�rDrEs@rr�r�s���?�8�.�$M�Nrr�c�.��eZdZdZd�fd�	Z�fd�Z�xZS)�	StateZonez:A Zone whose purpose is to display the state of an object.c	�0��t�|�|d|||||�y�N��r4r�rr0rrrrrKr?s       �rrzStateZone.__init__4����
����R��A�u�f�d�Crc���|dvrt�|�|�Stj�j	�}|dk(r
|j
}n|j}|j|j|j��}|r|dSy)zTo ensure we update the state.�r�
brailleStringr)rKrr�)
r4r5r	�
getManager�getActiveScript�speechGenerator�brailleGenerator�getStateIndicatorr0rK)rr9�script�	generator�resultr?s     �rr5zStateZone.__getattribute__7s�����2�2��7�+�D�1�1��*�*�,�<�<�>���8���.�.�I��/�/�I��,�,�T�_�_�4�9�9�,�M����!�9��rr��r r!r"r#rr5rDrEs@rr�r�1s���D�D��rr�c�.��eZdZdZd�fd�	Z�fd�Z�xZS)�	ValueZonez:A Zone whose purpose is to display the value of an object.c	�0��t�|�|d|||||�yr�r�r�s       �rrzValueZone.__init__Mr�rc�:��|dvrt�|�|�Stj�j	�}|dk(r
|j
}n|j}d}|j|j�}|j|j�}|r|r
|�d|d��}|S)zTo ensure we update the value.r�rr�� r)
r4r5r	r�r�r�r��getLocalizedRoleNamer0�getValue)rr9r�r�r��rolename�valuer?s       �rr5zValueZone.__getattribute__Ps�����2�2��7�+�D�1�1��*�*�,�<�<�>���8���.�.�I��/�/�I����1�1�$�/�/�B���"�"�4�?�?�3���� �z��5��8�*�-�F��
rr�r�rEs@rr�r�Js���D�D��rr�c�.��eZdZdZd�Z�fd�Zd�Z�xZS)�LinezAA Line is a single line across a window and is composed of Zones.c�.�||_||_d|_y)z�Creates a new Line, which is a horizontal region of text.

        Arguments:
        - index: the index of this Line in the window
        - zones: the Zones that make up this line
        N)r�zones�brailleRegions)rrr�s   rrz
Line.__init__ks����
���
�"��rc�T��|dk(r3dj|jD�cgc]}|j��c}�S|dk(r-t|jD�cgc]}|j��c}�S|dk(r-t|jD�cgc]}|j
��c}�S|dk(r-t
|jD�cgc]}|j��c}�S|dk(r-t|jD�cgc]}|j��c}�St�|�-|�Scc}wcc}wcc}wcc}wcc}w)Nrr�rrrr)�joinr�rrdrr�sumrrerr4r5)rr9r(r?s   �rr5zLine.__getattribute__xs�����8���8�8�T�Z�Z�@�T�T�[�[�@�A�A��3�;��4�:�:�6�4����6�7�7��3�;��4�:�:�6�4����6�7�7��7�?��t�z�z�:�t��
�
�:�;�;��8����
�
�;�����;�<�<��w�'��-�-��A��7��7��;��<s�D�D�D�6D �(D%c��	g|_d}|jD�]�}t|t��rt	j
|j�tjjtjjtjjfvslt	j
|j�tjjtjjtjjfvr7tj |j|j"|j$|�}n/	|j&}tj*|j|d|�}t-|j�r<tj.d�}||_|jj3|�|dz
}||_||_|jj3|�|j"}|t-|�z
}���t6j8s�t-|j�r<tj.d�}||_|jj3|�|dz
}tj.d�}||_|jj3|�|jS#t($r|j"}Y��uwxYw)Nrr�rz$l)r�r��
isinstancer�r
rJr0rrX�TEXT�
PASSWORD_TEXT�TERMINAL�	PARAGRAPH�HEADING�LINKr�
ReviewTextrrr��	Exception�ReviewComponentr)�Region�
brailleOffsetr8�
brailleRegionr
�disableBrailleEOL)rr�r(�regionr��pad�regionString�eols        r�getBrailleRegionszLine.getBrailleRegions�s2��
�"$�D���M��
�
�)
3���d�H�-��&�&�t���7��*�*�/�/��*�*�2�2��*�*�-�-�/�/��&�&�t���7��*�*�.�.��*�*�,�,��*�*�/�/�+�+�%�/�/����04���04�0@�0@�04�6�F�
4�(,�(:�(:�
�%�4�4�T�_�_�5B�56�59�;�F��t�*�*�+�!�.�.��-�C�(5�C�%��'�'�.�.�s�3�!�Q�&�M�%+��"�'4��$��#�#�*�*�6�2�%�}�}����\�!2�2�
�S)
3�V�-�-��t�*�*�+�!�.�.��-�C�(5�C�%��'�'�.�.�s�3�!�Q�&�M��n�n�T�*��$1��!��#�#�*�*�3�/��"�"�"��;%�4�(,���
�4�s�<J%�%J>�=J>)r r!r"r#rr5r�rDrEs@rr�r�hs���K�#�.�$=#rr�c��eZdZdZdZdZdZdZdZdZ	dZ
dZe
ezZd!d�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd!d�Zd�Zefd�Zd�Zd�Zd�Zd"d�Zd�Zd�Zd�Zefd�Zefd�Z eedfd�Z!eedfd�Z"eefd�Z#eefd �Z$y)#�ContextzBContains the flat review regions for the current top-level object.rrrc��Nc�B�
�||_g|_g|_d|_d|_d|_d|_d|_d|_d|_	tj�j�|_
d|_tj �|_|j$j'|j�\}}|�1||_d|g}t)j*t(j,|d�n|xs||_d|d|d|jg}t)j*t(j,|d�t/j0|j�|_tj2j4g�
�
fd�}t7j8|j|�}|s||j�r|j}|xs|j|_	|j;|j�\|_|_|j=|j�|_|jr|jsyt?|j�D]�\}}	|j|	jvs�||_|	jjA|j�|_|jjC�\}
}|
r|
j@|_||_nd	|j�d
|j�d|j
�d|j��}t)jDt(j,|d�y)
z Create a new Context for script.rNz'FLAT REVIEW: Restricting flat review toTzFLAT REVIEW: Frame:zDialog:z. Top level:c�2��tj|��vSr�)r
rJ)r�containerRoless �r�isContainerz%Context.__init__.<locals>.isContainer�s����$�$�Q�'�>�9�9rzFLAT REVIEW: On line z, zone z word z, char )#r�r��lines�	lineIndex�	zoneIndex�	wordIndex�	charIndex�targetCharInfo�	focusZone�	containerrr��get_locus_of_focus�focusObj�topLevelr�Rect�bounds�	utilities�frameAndDialogrrzryr�get_rectrXrZr
�
find_ancestor�getShowingZones�clusterZonesByLiner6rr�rx)rr��root�frame�dialogr}r�r�r:�linerrBr|r�s             @rrzContext.__init__�s���������
���
�������������"���������%�0�0�2�E�E�G��
���
��j�j�l����(�(�7�7��
�
�F�
��v��� �D�M�?��F�F����e�.�.���=�"�O�e�D�M�'��	�6�>�SW�S`�S`�a��
���%�*�*�F�D�9�!�*�*�4�=�=�9����*�*�/�/�*��	:��*�*�4�=�=�+�F�	��[����7��
�
�I�"�3�d�m�m���%)�%9�%9�$�.�.�%I�"��
�D�N��,�,�T�Z�Z�8��
��
�
�t�~�~�� ����,�	�G�A�t��~�~����+�!"���!%���!1�!1�$�.�.�!A���#�~�~�;�;�=���f��%)�Z�Z�D�N�%+�D�N��	�$�D�N�N�#3�7�4�>�>�:J�K��N�N�#�7�4�>�>�*:�
<�	�	���5�+�+�S�$�7rc���g}tjd|�D�cgc]&}g|j��|jd�����(}}t	t�fd�|��}|D]�\}}	}
t
j|||	�}tj||�}tj|�r�J|j|j|j|jf}
|jt!|||
g|
������|Scc}w)a.Traverses the string, splitting it up into separate zones if the
        string contains the EMBEDDED_OBJECT_CHARACTER, which is used by apps
        such as Firefox to handle containment of things such as links in
        paragraphs.

        Arguments:
        - accessible: the accessible
        - string: a substring from the accessible's text specialization
        - startOffset: the starting character offset of the string
        - cliprect: the extents that the Zones must fit inside.

        Returns a list of Zones for the visible text.
        z
[^\ufffc]+rc�,��|d�z|d�z|dfS)Nrrrcr$)rrs �rr�z,Context.splitTextIntoZones.<locals>.<lambda>%s'����1���);�Q�q�T�K�=O�QR�ST�QU�(V�r)rSrTr�rV�listr�rr�r�get_rect_intersection�
is_empty_rectrrrrr8r�)rr0rr�cliprectr��m�
substringsr<r��	substringr��intersection�clippings   `          r�splitTextIntoZoneszContext.splitTextIntoZoness������8:���M�SY�8Z�[�1�-�����-�!�'�'�!�*�-�[�
�[��#�V�Xb�c�d�
�'1�	P�#�U�C���(�(��U�C�@�D�&�<�<�T�8�L�L��,�,�\�:�'�>�>�<�>�>�<�;M�;M�|�Ob�Ob�b�����X�j�%��N�X�N�O�	P����\s�+C<c	���|jjj|�sgSg}d�}tj||�}|rptj|�}tj||�}tj||�r/d|d|d|g}tjtj|d�|}tj|�rztj|�retj|�}|j|j |j"|j$f}	t'|dt)j*|�g|	���gSd|g}tjtj|d�t)j,||�}
dt/|
�d	|g}tjtj|d�|
D])\}}}
|j1|j3||||���+|S)
aGets a list of Zones from an object that implements the
        AccessibleText specialization.

        Arguments:
        - accessible: the accessible
        - cliprect: the extents that the Zones must fit inside.

        Returns a list of Zones.
        c�Z�tj|�xstj|�Sr�)r�is_scroll_pane�is_document�rs r�
_is_containerz/Context.getZonesFromText.<locals>._is_container?s#���-�-�a�0�N�K�4K�4K�A�4N�NrzFLAT REVIEW: Cliprectz->�fromTrzFLAT REVIEW: Getting lines for�FLAT REVIEW:zlines found for)r�r��hasPresentableTextr
r�rr�r��is_same_rectrrzry�supports_editable_textr�is_single_linerrrrr�r�get_all_text�get_visible_linesr)�extendr�)rr0r�r�rr�r�r�r}r>r�rrrs              r�getZonesFromTextzContext.getZonesFromText/s����{�{�$�$�7�7�
�C��I���	O��*�*�:�}�E�	���'�'�	�2�D�&�<�<�T�8�L�L��'�'��l�;�1�8�T�4��QZ�[���!�!�%�"2�"2�F�D�A����*�*�:�6�;�;U�;U�V`�;a��'�'�
�3�D��f�f�d�f�f�d�j�j�$�+�+�=�G��Z��F�,?�,?�
�,K�V�g�V�W�W�2�J�?��
���%�*�*�F�D�9��(�(��X�>�� �#�e�*�.?��L��
���%�*�*�F�D�9�.3�	]�*�F�K���L�L��0�0��V�[�RZ�[�\�	]��rc���|d|dd|dg}tj|�}|tjjk(r$t|g|��d|i�}|r|j
d|�y|tjjk(r?|jjj|�rtjj}|tjjtjjtjjtjjfvryd}d}t|�dk(r�t!|dt"�rq|d}|j$|j$z
}	|d|dz|j$|j&zz
}
|	dkD}|r|	|d<n!|j$|j&z|d<|
|d<t|g|��d|i�}|r'|r|j
d|�y|j)|�yy)	z�If the accessible presents non-textual state, such as a
        checkbox or radio button, insert a StateZone representing
        that state.rrr�rKNTrc�)r
rJrrX�
TOGGLE_BUTTONr��insertr`r�r��hasMeaningfulToggleAction�	CHECK_BOXr\�RADIO_BUTTONr]r)r�r�rrr8)rr�r0r>�indicatorExtentsrKr(�stateOnLeft�textZone�textToLeftEdge�textToRightEdges           r�_insertStateZonezContext._insertStateZone\s���$�A�J���
�A�w�q�z�B��� � ��,���5�:�:�+�+�+��Z�F�*:�F��F�D�����Q��%���5�:�:�(�(�(��{�{�$�$�>�>�z�J��:�:�'�'�D���
�
�,�,��
�
�2�2��
�
�/�/��
�
�2�2�4�4�
������u�:��?�z�%��(�H�=��Q�x�H�%�Z�Z�'�)�)�3�N�&�q�z�G�A�J�6�8�:�:����;V�W�O�(�2�-�K��&4� ��#�&.�j�j�8�>�>�&A� ��#�&5� ��#���B�&6�B�T�B�������Q��%����T�"�	rc�h�tj|�}|j|j|j|j
f}t
j|�}|j||�}|sk|tjjtjjtjjfvr|jt|g|����n�|s�d}tjj g}||vr'|j"j$j'|d��}tjj(tjj*g}	|s)||	vr%|j"j$j-|�}|r|jt/||g|����|j1|||�|S)z1Returns a list of Zones for the given accessible.r�T)�inFlatReview)rr�rrrrr
rJr
rrXrn�SLIDER�PROGRESS_BARr8r��	TABLE_ROWr�r��getNamer`rY�getRoleNamerGr)
rr0r�r�r>rKr�r�	redundant�uselesss
          r�getZonesFromAccessiblezContext.getZonesFromAccessible�sW���#�#�J�/���&�&�$�&�&�$�*�*�d�k�k�9��� � ��,���%�%�j�(�;����%�*�*�"7�"7�"'�*�*�"3�"3�"'�*�*�"9�"9�";�;�
�L�L��:�8��8�9���F����-�-�.�I��9�$����4�4�<�<�Z�VZ�<�[���z�z�,�,�e�j�j�.>�.>�?�G��d�'�1����4�4�@�@��L������T�*�f�?�w�?�@����e�Z��9��rc�L��|r�sy|�k(rytj|�fd��S)NFTc���|�k(Sr�r$)r�parents �rr�z#Context._isOrIsIn.<locals>.<lambda>�s���q�F�{�r)r
r�)r�childr's  `r�	_isOrIsInzContext._isOrIsIn�s)����&���F�?���%�%�e�-B�C�Crc���d|j�d|j�d|j�d�d|j�d|j�d�g}tjt
j|d�|j|�}d	|d
|g}tjt
j|d�|�yt|j�D]�\}}||jvs�||_|jj|�|_|j�\}}|r|j|_||_d}tjt
j|d�n)d
}tjt
j|d�yd|j�d|j�d|j�d�d|j�d|j�d�g}tjt
j|d�y)zJAttempts to set the current zone to obj, if obj is in the current context.zFLAT REVIEW: Currentzline: z, zone: �,zword: z, char: �)TzFLAT REVIEW: Zone with�isFz"FLAT REVIEW: Updated current zone.z+FLAT REVIEW: Failed to update current zone.zFLAT REVIEW: Updated)�getCurrentAccessibler�r�r�r�rrzry�_findZoneWithObjectr6r�r�rr�rx)	r�objr}r(r:r�rrBr|s	         r�setCurrentToZoneWithObjectz"Context.setCurrentToZoneWithObject�s���)�$�*C�*C�*E��4�>�>�*�(�4�>�>�2B�!�D��4�>�>�*�(�4�>�>�2B�!�D�F��	���%�*�*�F�D�9��'�'��,��*�C��t�<��
���%�*�*�F�D�9��<�� ����,�	�G�A�t��t�z�z�!�!"���!%���!1�!1�$�!7���#�1�1�3���f��%)�Z�Z�D�N�%+�D�N�:���"�"�5�#3�#3�S�$�?��	�@�C����u�/�/��d�;��(�$�*C�*C�*E��4�>�>�*�(�4�>�>�2B�!�D��4�>�>�*�(�4�>�>�2B�!�D�F��	���%�*�*�F�D�9�rc��|�y|jD]n}|j|k(r|cStj|j|�s�7d|jd|g}t	j
tj|d�|cSy)z-Returns the existing zone which contains obj.Nrzis ancestor of zone accessibleT)r�r0r
�is_ancestorrrzry)rr0r(r}s    rr/zContext._findZoneWithObject�s|���;���J�J�	�D����#�%����#�#�D�O�O�S�9�(�$�/�/�;[�]`�a���!�!�%�"2�"2�F�D�A���	�rc��|�|j}|jjj||�}dt	|�d|g}tjt
j|d�gd}}|D]�}|j||�}|s9|jjj|�}	|	r|j|	|�}|s�S|j|�|r�g|s�j|js�w|j||j�s��ttd�|��xs|}|d}��dt	|�d|g}tjt
j|d�||fS)zGReturns an unsorted list of all the zones under root and the focusZone.Nrzon-screen objects found forTc�"�|j�Sr�)r���zs rr�z)Context.getShowingZones.<locals>.<lambda>�s��a�j�j�l�rrzzones found for)r�r�r��getOnScreenObjectsr)rrzryr$�realActiveDescendantrr�r)r��filter)
rr��boundingbox�objsr}�allZonesr��or��
descendants
          rr�zContext.getShowingZones�s<�����+�+�K��{�{�$�$�7�7��k�J�� �#�d�)�-J�D�Q��
���%�*�*�F�D�9� �$�)���
	%�A��/�/��;�?�E��!�[�[�2�2�G�G��J�
�� �7�7�
�K�P�E����O�O�E�"���4�=�=�T�^�^�A�t�}�}�=]��V�$:�E�B�C�L�u��!�!�H�	�
	%�!�#�h�-�1B�D�I��
���%�*�*�F�D�9���"�"rc�8�|sgSg}t|d���}|jd�g}|D]H}|j|d�r|j|��)|jt|d����|g}�J|r|jt|d����g}t	|�D]D\}}|jt||��t	|�D]\}	}|||_|	|_��Fdt|�dg}
tjtj|
d	�|S)
z?Returns a sorted list of Line clusters containing sorted Zones.c��|jSr�)rr6s rr�z,Context.clusterZonesByLine.<locals>.<lambda>
s
��!�#�#�r)�keyrrAc��|jSr�rr6s rr�z,Context.clusterZonesByLine.<locals>.<lambda>s
��Q�S�S�rc��|jSr�rr6s rr�z,Context.clusterZonesByLine.<locals>.<lambda>s
�����rz!FLAT REVIEW: Zones clustered intor�T)�sorted�poprur8r6r�r�rr)rrzry)rr��lineClusters�sortedZones�
newClusterr(r�r��lineClusterr�r}s           rr�zContext.clusterZonesByLines����I����U�
�6��!�o�o�a�(�)�
��	$�D����z�"�~�.��!�!�$�'��#�#�F�:�=�$I�J�"�V�
�	$������z�}� E�F���&/��&=�	'�"�I�{��L�L��i��5�6�#,�[�#9�
'��	�4�!�)�,��	�&��
�
'�	'�6�s�5�z�7�K��
���%�*�*�F�D�9��rc���|j�}|sy|}|tjk(r
|j}nq|tjk7r^|j
rR|j
|j}|tjk(r&|jr	|j|j}|j|j|j|j|jfS#t$rYywxYw)z;Returns the current string, offset, and extent information.)NrArArArA)�_getCurrentZoner��LINEr��ZONErQr��CHARr+r�r�rrrrr)r�flatReviewTyper(�currents    r�
getCurrentzContext.getCurrent$s����#�#�%���'����W�\�\�)��i�i�G�
�w�|�|�
+��
�
��j�j����0�G�����-�'�-�-�0�%�m�m�D�N�N�;�G��~�~�w�y�y�'�)�)�W�]�]�G�N�N�R�R��!�0�/�0�s�C � 	C,�+C,c��||_||_||_||_|j	t
j�|_y)a=Sets the current character of interest.

        Arguments:
        - lineIndex: index into lines
        - zoneIndex: index into lines[lineIndex].zones
        - wordIndex: index into lines[lineIndex].zones[zoneIndex].words
        - charIndex: index lines[lineIndex].zones[zoneIndex].words[wordIndex].chars
        N)r�r�r�r�rRr�rOr�)rr�r�r�r�s     r�
setCurrentzContext.setCurrent;s5��#���"���"���"���"�o�o�g�l�l�;��rc���|jtj�\}}}}}|dkr|dks
|dkr|dkrytt	|||dzzdz
��}t||dzz�}||fS)Nr)rArArcr)rRr�rO�intre)rrrrrrs      r�_getClickPointzContext._getClickPointKsv��&*�o�o�g�l�l�&C�#���1�e�V�
��E�a�!�e��!����
��
��A�q�E�A�I���*�+�,����F�Q�J�����!�t�rc�j�|j�\}}|dks|dkrytj||�S)z3Routes the mouse pointer to the current accessible.rF)rWr�route_to_point)rrrs   r�routeToCurrentzContext.routeToCurrentVs9���"�"�$���1��q�5�A��E��!�0�0��A�6�6rc��|j�\}}|dk\r|dk\rtj|||�rytj|j	�|�ryy)z1Performs a mouse click on the current accessible.rTF)rWr�click_point�click_objectr.)r�buttonrrs    r�clickCurrentzContext.clickCurrent_sW���"�"�$���1���6�a�1�f�!3�!?�!?��1�f�!M���*�*�4�+D�+D�+F��O��rc�.�|jr*d|jcxkrt|j�ksyy|j|j}|r*d|jcxkrt|j�ksyy|j|jS)Nr)r�r�r)r�r�)rr�s  rrLzContext._getCurrentZoneksx���
�
�q�D�N�N�D�S����_�D�� E���z�z�$�.�.�)����d�n�n�>�s�4�:�:��>��?���z�z�$�.�.�)�)rc�@�|j�}|sy|jS)zReturns the current accessible.N)rLr0)rr(s  rr.zContext.getCurrentAccessibleus"���#�#�%�������rc���|jr#|j|jjsddgSd}|j|j}|j�}|jD]�}|j|j
k(s�|j}d|_|jr�|xj|jdj|jz
z
c_td|j�D]7}|xjt|j|j�z
c_�9|xj|jz
c_|j�||gS||gS)zbGets the braille for the entire current line.

        Returns [regions, regionWithFocus]
        Nr)r�r�r�r�rr�r��cursorOffsetrQr�ranger�r)rr��repositionCursor)r�regionWithFocusr��regionsr(r�s      r�getCurrentBrailleRegionsz Context.getCurrentBrailleRegions~s:���
�
��:�:�d�n�n�-�3�3��$�<�����z�z�$�.�.�)���(�(�*��
�J�J�	�D��z�z�T�^�^�+�"&�"4�"4��/0��,��:�:�#�0�0�D�J�J�q�M�4M�4M�PT�P`�P`�4`�`�0�%*�1�d�n�n�%=�>�	�'�4�4���
�
�9� 5� <� <�=�>�4�>� �,�,����>�,��0�0�2����)�)�	���)�)rc��|tjk(s|tjk(r
|j}n$|tjk(rd}ntd|z��|tjk(r
|j}nd}d}d}|j|k7xs1|j|k7xs |j|k7xs|j|k7}|r@||_||_||_||_|jtj�|_|S)z�Moves this context's locus of interest to the first char
        of the first relevant zone.

        Arguments:
        - flatReviewType: one of ZONE, LINE or WINDOW

        Returns True if the locus of interest actually changed.
        r�Invalid type: %d)r�rMrNr��WINDOWr�r�r�r�rRrOr�)rrPr�r�r�r��moveds       r�goBeginzContext.goBegin�s���
�g�l�l�*��'�,�,�0N����I�
�w�~�~�
-��I��.��?�@�@��W�\�\�)����I��I��	��	����9�,�1��N�N�i�/�1��N�N�i�/�1��N�N�i�/�	�
�&�D�N�&�D�N�&�D�N�&�D�N�"&�/�/�'�,�,�"?�D���rc�T�|tjk(s|tjk(r
|j}n:|tjk(rt|j�dz
}ntd|z��|tjk(r
|j}n%t|j|j�dz
}|j|j|}|jrEt|j�dz
}|j|j}|rt|�dz
}nd}nd}d}|j|k7xs1|j|k7xs |j|k7xs|j|k7}|r@||_||_||_||_
|jtj�|_|S)z�Moves this context's locus of interest to the last char
        of the last relevant zone.

        Arguments:
        - flatReviewType: one of ZONE, LINE, or WINDOW

        Returns True if the locus of interest actually changed.
        rrjr)r�rMrNr�rkr)r�r�r�r�rQr+r�r�rRrOr�)	rrPr�r�r(r�r+r�rls	         r�goEndz
Context.goEnd�sl��
�g�l�l�*��'�,�,�0N����I�
�w�~�~�
-��T�Z�Z��1�,�I��.��?�@�@��W�\�\�)����I��D�J�J�y�1�7�7�8�1�<�I��z�z�)�$�*�*�9�5���:�:��D�J�J��!�+�I��J�J�y�)�/�/�E����J��N�	��	��I��I����9�,�1��N�N�i�/�1��N�N�i�/�1��N�N�i�/�	�
�&�D�N�&�D�N�&�D�N�&�D�N�"&�/�/�'�,�,�"?�D���rTc��|js%tjtjd�yd}|tj
k(�r+|jdkDr'|xjdzc_d|_d|_d}�n�|tjz�r�|jdkDr[|xjdzc_
t|j|jj�dz
|_d|_d|_d}�n"|tjz�rt|j�dz
|_
t|j|jj�dz
|_d|_d|_d}�n�|tjk(r�|jdkDr|xjdzc_d}�np|jtj |d�}|�rL|j|jj|j}|j"�r|j"|jj$}|�r�t|�dz
|_�n�|tj k(�r�|j|jj|j}|j&}|j}|j}	|j}
|j}|jdkDr|xjdzc_d|_d}n{|jtj
|�}|rY|j|jj|j}|j"rt|j"�dz
|_|j|jj|j}|�r�|�r�t|j(�dk(sHt|j"��rX|j"|jj(j+��r&d}|jdkDrTt-|t.�rD|j|jdz
jd}
|
j&|j&k(rd}|j&|k(s|r!|jtj |�}n�|jdz
}
|
dk\ro|j"|
j(rIt|j"|
j(�r'|j"|
j(j+�r|
dz}
nn|
dk\r�o|
dk\r|
|_|s�||_
|	|_|
|_||_n�|tj0k(r�|tjzr�|jdkDr-|xjdzc_
d|_d|_d|_d}nn|tjzr[t|j�dk7rCt|j�dz
|_
d|_d|_d|_d}nt3d|z��|r7|tj0k7r$|j5tj�|_|S)aiMoves this context's locus of interest to the first char
        of the previous type.

        Arguments:
        - flatReviewType: one of ZONE, CHAR, WORD, LINE
        - wrap: if True, will cross boundaries, including top and
                bottom; if False, will stop on boundaries.

        Returns True if the locus of interest actually changed.
        z!goPrevious(): no lines in contextFrrTrArj)r�rrxryr�rNr�r�r��	WRAP_LINEr�r)r��WRAP_TOP_BOTTOMrO�
goPrevious�WORDrQr+r0r�isspacer�r�rMr�rRr�)rrP�wrap�omitWhitespacerlr(r+r0r�r�r�r��hasMoreText�prevZones              rrszContext.goPrevious�s����z�z����u�/�/�1T�U�����W�\�\�)��~�~��!����!�#��!"���!"�������)�)�)��>�>�A�%��N�N�a�'�N�%(����D�N�N�)C�)I�)I�%J�Q�%N�D�N�%&�D�N�%&�D�N� �E��G�3�3�3�%(����_�q�%8�D�N�%(����D�N�N�)C�)I�)I�%J�Q�%N�D�N�%&�D�N�%&�D�N� �E�
�w�|�|�
+��~�~��!����!�#����������d�E�B����:�:�d�n�n�5�;�;�D�N�N�K�D��z�z� $�
�
�4�>�>� :� @� @�� �-0��Z�!�^�D�N�
�w�|�|�
+��:�:�d�n�n�-�3�3�D�N�N�C�D����J����I����I����I����I��~�~��!����!�#��!"�����������d�;����:�:�d�n�n�5�;�;�D�N�N�K�D��z�z�),�T�Z�Z��1�)<���
�:�:�d�n�n�-�3�3�D�N�N�C�D�������%��*��D�J�J�� �J�J�t�~�~�6�=�=�E�E�G�#���>�>�A�%�*�T�8�*D�#�z�z�$�.�.�1�*<�=�C�C�B�G�H��*�*�d�o�o�=�&*���?�?�j�0�K� �O�O�G�L�L�$�?�E� $���� 2�I�#�q�.� $�
�
�9� 5� <� <�#&�t�z�z�)�'<�'C�'C�#D�#�z�z�)�4�;�;�C�C�E�%��N�I�!�
$�q�.�!�A�~�)2����!*���!*���!*���!*���
�w�|�|�
+��g�'�'�'��>�>�A�%��N�N�a�'�N�%&�D�N�%&�D�N�%&�D�N� �E��W�4�4�4��d�j�j�/�Q�.�%(����_�q�%8�D�N�%&�D�N�%&�D�N�%&�D�N� �E��.��?�@�@��n����4�"&�/�/�'�,�,�"?�D���rc�x�|js%tjtjd�yd}|tj
k(�r&|jt|j|jj�dz
kr'|xjdz
c_d|_
d|_d}�nV|tjz�rB|jt|j�dz
krB|xjdz
c_d|_d|_
d|_d}tj��n�|tjz�r�d|_d|_d|_
d|_d}tj��n�|tj k(r�|j|jj|j}|j"r�|j"|jj$}|rW|jt|�dz
kr|xjdz
c_d}�n�|j'tj(|d�}�n�|j'tj(|�}�n�|j'tj
|�}�n�|tj(k(�r�|j|jj|j}|j*}|j}|j}	|j}
|j}|j"re|jt|j"�dz
kr|xjdz
c_
d|_d}nA|j'tj
|�}n |j'tj
|�}|j|jj|j}|�rZ|�rWt|j,�dk(sGt|j"��r)|j"|jj,j/�r�|j*|k(r!|j'tj(|�}n�|jdz}
|
t|j"�kr�|j"|
j,rIt|j"|
j,�r'|j"|
j,j/�r|
dz
}
nn|
t|j"�kr��|
t|j"�kr|
|_
|s�||_|	|_|
|_
||_n�|tj0k(r�|tjzr�|jt|j�dz
kr-|xjdz
c_d|_d|_
d|_d}nO|tjzr<|jdk7r-d|_d|_d|_
d|_d}nt3d|z��|r7|tj0k7r$|j5tj �|_|S)a Moves this context's locus of interest to first char of
        the next type.

        Arguments:
        - flatReviewType: one of ZONE, CHAR, WORD, LINE
        - wrap: if True, will cross boundaries, including top and
                bottom; if False, will stop on boundaries.
        zgoNext(): no lines in contextFrrTrj)r�rrxryr�rNr�r)r�r�r�r�rqr�clearrrrOrQr+�goNextrtr0rrurMr�rRr�)rrPrvrwrlr(r+r0r�r�r�r�s            rr|zContext.goNext}s����z�z����u�/�/�1P�Q�����W�\�\�)��~�~��T�Z�Z����%?�%E�%E�!F��!J�K����!�#��!"���!"�������)�)�)��>�>�S����_�q�%8�9��N�N�a�'�N�&'�D�N�%&�D�N�%&�D�N� �E��M�M�O��G�3�3�3�&'�D�N�&'�D�N�%&�D�N�%&�D�N� �E��M�M�O�
�w�|�|�
+��:�:�d�n�n�-�3�3�D�N�N�C�D��z�z��
�
�4�>�>�2�8�8����~�~��U��a��8����!�+�� $�� $���G�L�L�$�� F�� �K�K����d�;�E����G�L�L�$�7��
�w�|�|�
+��:�:�d�n�n�-�3�3�D�N�N�C�D����J����I����I����I����I��z�z��>�>�S����_�q�%8�9��N�N�a�'�N�%&�D�N� �E� �K�K����d�;�E����G�L�L�$�7��
�:�:�d�n�n�-�3�3�D�N�N�C�D�������%��*��D�J�J�� �J�J�t�~�~�6�=�=�E�E�G��?�?�j�0� �K�K����d�;�E� $���� 2�I�#�c�$�*�*�o�5� $�
�
�9� 5� <� <�#&�t�z�z�)�'<�'C�'C�#D�#�z�z�)�4�;�;�C�C�E�%��N�I�!�
$�c�$�*�*�o�5�!�3�t�z�z�?�2�)2����!*���!*���!*���!*���
�w�|�|�
+��g�'�'�'��>�>�S����_�q�%8�9��N�N�a�'�N�%&�D�N�%&�D�N�%&�D�N� �E��W�4�4�4��.�.�A�-�%&�D�N�%&�D�N�%&�D�N�%&�D�N� �E��.��?�@�@��n����4�"&�/�/�'�,�,�"?�D���rc�>�d}|tjk(r�|js$|jtj�|_|j}|\}}}}}	||dzz}
|j	tj
|�}|r_	|jtj�\}}}}
}||z|
k\rn0|j
tjtj�sn�^||_|S|tj
k(r|j	||�Std|z��)a�Moves this context's locus of interest to first char
        of the type that's closest to and above the current locus of
        interest.

        Arguments:
        - flatReviewType: LINE
        - wrap: if True, will cross top/bottom boundaries; if False, will
                stop on top/bottom boundaries.

        Returns: [string, startOffset, endOffset, x, y, width, height]
        Frcrj)	r�rOr�rRrsrMr|�	WRAP_NONEr��rrPrvrl�targetrrrrr�
middleTargetX�bx�by�bwidth�bheights               r�goAbovezContext.goAbove�s�����W�\�\�)�
�&�&�&*�o�o�g�l�l�&C��#��(�(�F�,2�)�V�Q��5�&�����O�M��O�O�G�L�L�$�7�E���!�_�_�W�\�\�:�6�V�R��V�W��U�
�}�4��!�[�[����w�7H�7H�I��
�#)�D�����w�|�|�
+��?�?�>�4�8�8��.��?�@�@rc�B�d}|tjk(r�|js$|jtj�|_|j}|\}}}}}	||dzz}
|j	tj
|�}|r_	|jtj�\}}}}
}||z|
k\rn0|j	tjtj�sn�^||_|S|tj
k(r|j	||�}|Std|z��)a�Moves this context's locus of interest to the first
        char of the type that's closest to and below the current
        locus of interest.

        Arguments:
        - flatReviewType: one of WORD, LINE
        - wrap: if True, will cross top/bottom boundaries; if False, will
                stop on top/bottom boundaries.

        Returns: [string, startOffset, endOffset, x, y, width, height]
        Frcrj)r�rOr�rRr|rMr~r�rs               r�goBelowzContext.goBelow.s�����W�\�\�)�
�&�&�&*�o�o�g�l�l�&C��#��(�(�F�,2�)�V�Q��5�&�����O�M��K�K����d�3�E���!�_�_�W�\�\�:�6�V�R��V�W��U�
�}�4��!�[�[����w�7H�7H�I��
�#)�D�����w�|�|�
+��K�K���5�E����.��?�@�@rr�)r)%r r!r"r#rNrOrtrMrkr~rqrr�WRAP_ALLrr�r
rr$r)r1r/r�r�rRrTrWrZr_rLr.rhrmrorsr|r�r�r$rrr�r��s���L�
�D�
�D�
�D�
�D�
�F��I��I��O� �?�2�H�;8�z�6+�Z-#�^�6D�"�H�*#�<�<)-�S�.<� 	�7�
�*��*�@&,�%�N$*�.�`)-� ��F�P%)�x��@�D&*��-�^&*��-rr�)$r#�__id__�__version__�__date__�
__copyright__�__license__�gi�require_version�
gi.repositoryrrSr�rrrr	r
�ax_componentr�ax_event_synthesizerr�	ax_objectr
�ax_textr�ax_utilitiesr�EMBEDDED_OBJECT_CHARACTERrr&rGr�r�r�r�r�r$rr�<module>r�s���*D�������2�
���	�����7�E�"��	������%�4���%�%����04�4�nC�C�J)N�t�)N�X���2���<_#�_#�BR�Rr

Zerion Mini Shell 1.0