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

�

g
f_���.�dZdZdZdZdZdZddlZejdd	�dd
lm	Z	ddl
mZdd
l
mZddl
m
Z
ddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZGd�d�ZGd�d�Ze�Zd�Zy)zModule for flat-review commandsz$Id$z
$Revision$z$Date$zQCopyright (c) 2005-2008 Sun Microsystems Inc.Copyright (c) 2016-2023 Igalia, S.L.�LGPL�N�Gtkz3.0)r�)�braille)�cmdnames)�debug)�flat_review)�
focus_manager)�	guilabels)�input_event)�keybindings)�messages)�
orca_state)�script_manager)�settings_manager)�settingsc��eZdZdZd�Zd�Zd5d�Zd6d�Zd�Zd7d�Z	d	�Z
d
�Zd�Zd�Z
d8d
�Zd8d�Zd5d�Zd5d�Zd5d�Zd5d�Zd5d�Zd5d�Zd5d�Zd5d�Zd5d�Zd5d�Zd5d�Zd5d�Zd9d�Zd5d�Zd5d�Zd5d�Zd5d�Z d5d �Z!d5d!�Z"d5d"�Z#d5d#�Z$d5d$�Z%d5d%�Z&d5d&�Z'd5d'�Z(d5d(�Z)d5d)�Z*d5d*�Z+d5d+�Z,d5d,�Z-d5d-�Z.d5d.�Z/d5d/�Z0d5d0�Z1d5d1�Z2d:d2�Z3d;d3�Z4d:d4�Z5y)<�FlatReviewPresenterz5Provides access to on-screen objects via flat-review.c��d|_d|_tj�j	d�|_|j
d�|_tj�|_
tj�|_d|_y)N��flatReviewIsRestrictedT)
�_context�_current_contentsr�
getManager�
getSetting�	_restrict�get_handlers�	_handlersr
�KeyBindings�_desktop_bindings�_laptop_bindings�_gui��selfs �</usr/lib/python3/dist-packages/orca/flat_review_presenter.py�__init__zFlatReviewPresenter.__init__5sh����
�!#���)�4�4�6�A�A�BZ�[����*�*�4�0���!,�!8�!8�!:��� +� 7� 7� 9�����	�c��|jduS)z4Returns True if the flat review presenter is active.N)rr#s r%�	is_activezFlatReviewPresenter.is_active>s���}�}�D�(�(r'Nc�J�|j�sd|j��}tjtj|d�|jrBtj�j�\}}tj||��|_ntj|�|_tj�j|jj�t
j��|�d|_
|j�|_|jSd|j��}tjtj|d�tj�j�\}}|xs"tj�j!�}|t
jk7r�||jj�k7rj|js^d|jj�d|g}tj"tj|d�|jj%|�|jrU|t
jk7rBd}tjtj|d�tj||�|_|jS)	z;Returns the flat review context, creating one if necessary.z7FLAT REVIEW PRESENTER: Creating new context. Restrict: T)�root��modez9FLAT REVIEW PRESENTER: Using existing context. Restrict: z9FLAT REVIEW PRESENTER: Attempting to update location from�toz7FLAT REVIEW PRESENTER: Creating new restricted context.)rrr�printMessage�
LEVEL_INFOr
r�&get_active_mode_and_object_of_interestr	�Context�emit_region_changed�getCurrentAccessible�FLAT_REVIEW�justEnteredFlatReviewMode�getBrailleCursorCell�targetCursorCell�get_locus_of_focus�printTokens�setCurrentToZoneWithObject)r$�script�msgr-�obj�tokenss      r%�get_or_create_contextz)FlatReviewPresenter.get_or_create_contextCs����}�}�K�D�N�N�K[�\�C����u�/�/��d�;��~�~�)�4�4�6�]�]�_�	��c� +� 3� 3�F�� E��
� +� 3� 3�F� ;��
��$�$�&�:�:��
�
�2�2�4�=�;T�;T�
;�
V��!�37��0�*0�*E�*E�*G��'��=�=� �I�$�.�.�IY�Z��
���5�+�+�S�$�7�"�,�,�.�U�U�W�	��c��D�]�-�-�/�B�B�D���=�,�,�,���
�
�8Z�8Z�8\�1\��>�>�Q��m�m�8�8�:�D�#�G�F����e�.�.���=��M�M�4�4�S�9��>�>�d�m�&?�&?�?�K�C����u�/�/��d�;�'�/�/���<�D�M��}�}�r'c�\�|r8d}tjtj|d�|j�nY|r+|jj�r|j�n,|s*|jj�r|j�|r|jS|jS)z.Returns the flat-review-presenter keybindings.z+FLAT REVIEW PRESENTER: Refreshing bindings.T)rr/r0�_setup_bindingsr �isEmptyr!)r$�refresh�
is_desktopr=s    r%�get_bindingsz FlatReviewPresenter.get_bindingsxs����?�C����u�/�/��d�;�� � �"�
�D�2�2�:�:�<�� � �"��� 5� 5� =� =� ?�� � �"���)�)�)��$�$�$r'c��i}	|jjd�|tjj<|jjd�|tjj
<|jjd�|tjj<|jjd�|tjj<|jjd�|tjj<|S#t$r5}d|g}tjtj|d�icYd}~Sd}~wwxYw)	z3Returns the flat-review-presenter braille bindings.�reviewAboveHandler�reviewBelowHandler�toggleFlatReviewModeHandler�reviewHomeHandler�reviewBottomLeftHandlerz:FLAT REVIEW PRESENTER: Exception getting braille bindings:TN)
r�getr�brlapi�KEY_CMD_LNUP�KEY_CMD_LNDN�KEY_CMD_FREEZE�KEY_CMD_TOP_LEFT�KEY_CMD_BOT_LEFT�	Exceptionrr:r0)r$�bindings�errorr?s    r%�get_braille_bindingsz(FlatReviewPresenter.get_braille_bindings�s����	����"�"�#7�8�
�W�^�^�0�0�1����"�"�#7�8�
�W�^�^�0�0�1����"�"�#@�A�
�W�^�^�2�2�3����"�"�#6�7�
�W�^�^�4�4�5����"�"�#<�=�
�W�^�^�4�4�5����	�	�R�TY�Z�F����e�.�.���=��I��	�s�DD�	E�*E
�E�
Ec��|r7d}tjtj|d�|j�|jS)z+Returns the flat-review-presenter handlers.z*WHERE AM I PRESENTER: Refreshing handlers.T)rr/r0�_setup_handlersr)r$rDr=s   r%rz FlatReviewPresenter.get_handlers�s:���>�C����u�/�/��d�;�� � �"��~�~�r'c�D�|j�|j�y)z/Sets up the flat-review-presenter key bindings.N)�_setup_desktop_bindings�_setup_laptop_bindingsr#s r%rBz#FlatReviewPresenter._setup_bindings�s��	
�$�$�&��#�#�%r'c�H
�i|_tj|jtj
�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|j tj"�|jd<tj|j$tj&�|jd<tj|j(tj*�|jd	<tj|j,tj.�|jd
<tj|j0tj2�|jd<tj|j4tj6�|jd<tj|j8tj:�|jd
<tj|j<tj>�|jd<tj|j@tjB�|jd<tj|jDtjF�|jd<tj|jHtjJ�|jd<tj|jLtjN�|jd<tj|jPtjR�|jd<tj|jTtjV�|jd<tj|jXtjZ�|jd<tj|j\tj^�|jd<tj|j`tjb�|jd<tj|jdtjf�|jd<tj|jhtjj�|jd<tj|jltjn�|jd<tj|jptjr�|jd<tj|jttjv�|jd<d}tyjztxj||d�y) z7Sets up the flat-review-presenter input event handlers.rJrK�reviewEndHandlerrL�reviewPreviousLineHandler�reviewCurrentLineHandler�reviewNextLineHandler�reviewSpellCurrentLineHandler� reviewPhoneticCurrentLineHandler�reviewEndOfLineHandler�reviewPreviousItemHandler�reviewCurrentItemHandler�reviewNextItemHandler�reviewSpellCurrentItemHandler� reviewPhoneticCurrentItemHandler�reviewPreviousCharacterHandler�reviewCurrentCharacterHandler�"reviewSpellCurrentCharacterHandler�$reviewUnicodeCurrentCharacterHandler�reviewNextCharacterHandler�reviewCurrentAccessibleHandlerrHrI�showContentsHandler�flatReviewCopyHandler�flatReviewAppendHandler�flatReviewSayAllHandler�flatReviewToggleRestrictHandlerz'FLAT REVIEW PRESENTER: Handlers set up.TN)?rr�InputEventHandler�toggle_flat_review_moder�TOGGLE_FLAT_REVIEW�go_home�REVIEW_HOME�go_end�
REVIEW_END�go_bottom_left�REVIEW_BOTTOM_LEFT�go_previous_line�REVIEW_PREVIOUS_LINE�present_line�REVIEW_CURRENT_LINE�go_next_line�REVIEW_NEXT_LINE�
spell_line�REVIEW_SPELL_CURRENT_LINE�
phonetic_line�REVIEW_PHONETIC_CURRENT_LINE�go_end_of_line�REVIEW_END_OF_LINE�go_previous_item�REVIEW_PREVIOUS_ITEM�present_item�REVIEW_CURRENT_ITEM�go_next_item�REVIEW_NEXT_ITEM�
spell_item�REVIEW_SPELL_CURRENT_ITEM�
phonetic_item�REVIEW_PHONETIC_CURRENT_ITEM�go_previous_character�REVIEW_PREVIOUS_CHARACTER�present_character�REVIEW_CURRENT_CHARACTER�spell_character�REVIEW_SPELL_CURRENT_CHARACTER�unicode_current_character� REVIEW_UNICODE_CURRENT_CHARACTER�go_next_character�REVIEW_NEXT_CHARACTER�present_object�REVIEW_CURRENT_ACCESSIBLE�go_above�REVIEW_ABOVE�go_below�REVIEW_BELOW�
show_contents�FLAT_REVIEW_SHOW_CONTENTS�copy_to_clipboard�FLAT_REVIEW_COPY�append_to_clipboard�FLAT_REVIEW_APPEND�say_all�SAY_ALL_FLAT_REVIEW�toggle_restrict�TOGGLE_RESTRICT_FLAT_REVIEWrr/r0�r$r=s  r%rYz#FlatReviewPresenter._setup_handlers�sx�����
�)�)��,�,��+�+�
-�	
���4�5�
�)�)�����$�$�
&�	
���*�+�
�)�)�����#�#�
%�	
���)�*�
�)�)��#�#��+�+�
-�	
���0�1�
�)�)��%�%��-�-�
/�	
���2�3�
�)�)��!�!��,�,�
.�	
���1�2�
�)�)��!�!��)�)�
+�	
���.�/�
�)�)�����2�2�
4�	
���6�7�
�)�)��"�"��5�5�
7�	
���9�:�
�)�)��#�#��+�+�
-�	
���/�0�
�)�)��%�%��-�-�
/�	
���2�3�
�)�)��!�!��,�,�
.�	
���1�2�
�)�)��!�!��)�)�
+�	
���.�/�
�)�)�����2�2�
4�	
���6�7�
�)�)��"�"��5�5�
7�	
���9�:�
�)�)��*�*��2�2�
4�	
���7�8�
�)�)��&�&��1�1�
3�	
���6�7�
�)�)��$�$��7�7�
9�	
���;�<�
�)�)��.�.��9�9�
;�	
���=�>�
�)�)��&�&��.�.�
0�	
���3�4�
�)�)��#�#��2�2�
4�	
���7�8�
�)�)��
�
��%�%�
'�	
���+�,�
�)�)��
�
��%�%�
'�	
���+�,�
�)�)��"�"��2�2�
4�	
���,�-�
�)�)��&�&��)�)�
+�	
���.�/�
�)�)��(�(��+�+�
-�	
���0�1�
�)�)�����,�,�
.�	
���0�1�
�)�)��$�$��4�4�
6�	
���8�9�
8��
���5�+�+�S�$�7r'c
��tj�|_|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjd	tj
tj|jjd
�d��|jjtjd	tj
tj|jjd�d��|jjtjd	tj
tj|jjd
�d��|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjd tj
tj|jjd!�d��|jjtjd tj
tj|jjd"�d��|jjtjd tj
tj|jjd#�d��|jjtjd$tj
tj|jjd%���|jjtjd&tj
tj|jjd'���|jjtjd&tj
tj|jjd(���|jjtjd&tj
tj|jjd)���|jjtjd&tj
tj|jjd*���d+}tjtj|d,�y-).z7Sets up the flat-review-presenter desktop key bindings.�KP_SubtractrJ�KP_Addrs��KP_HomerKr_�KP_Upr`rrbrc��
KP_Page_Uprar^�KP_LeftrerH�KP_Beginrfrhriro�KP_RightrgrI�KP_Endrjrd�KP_Downrkrlrm�KP_Page_Downrnrrprqrrrtz/FLAT REVIEW PRESENTER: Desktop bindings set up.TN)
r
rr �add�
KeyBinding�defaultModifierMask�NO_MODIFIER_MASKrrM�ORCA_MODIFIER_MASKrr/r0r�s  r%r[z+FlatReviewPresenter._setup_desktop_bindingsAsd��"-�!8�!8�!:������"�"��"�"���/�/��,�,����"�"�#@�A�	
C�	D�	
���"�"��"�"���/�/��,�,����"�"�#<�=��
�	�	
���"�"��"�"���/�/��.�.����"�"�#6�7�	
9�	:�	
���"�"��"�"���/�/��,�,����"�"�#>�?�	
A�	B�	
���"�"��"�"���/�/��,�,����"�"�#=�>��
�	�	
���"�"��"�"���/�/��,�,����"�"�#B�C��
�	�	
���"�"��"�"���/�/��,�,����"�"�#E�F��
�	�	
���"�"��"�"���/�/��,�,����"�"�#:�;�	
=�	>�	
���"�"��"�"���/�/��.�.����"�"�#5�6�	
8�	9�	
���"�"��"�"���/�/��,�,����"�"�#>�?�	
A�	B�	
���"�"��"�"���/�/��.�.����"�"�#7�8�	
:�	;�	
���"�"��"�"���/�/��,�,����"�"�#=�>��
�	�	
���"�"��"�"���/�/��,�,����"�"�#B�C��
�	�	
���"�"��"�"���/�/��,�,����"�"�#E�F��
�	�	
���"�"��"�"���/�/��.�.����"�"�#C�D�	
F�	G�	
���"�"��"�"���/�/��,�,����"�"�#:�;�	
=�	>�	
���"�"��"�"���/�/��.�.����"�"�#7�8�	
:�	;�	
���"�"��"�"���/�/��,�,����"�"�#C�D�	
F�	G�	
���"�"��"�"���/�/��.�.����"�"�#;�<�	
>�	?�	
���"�"��"�"���/�/��,�,����"�"�#B�C��
�	�	
���"�"��"�"���/�/��,�,����"�"�#G�H��
�	�	
���"�"��"�"���/�/��,�,����"�"�#I�J��
�	�	
���"�"��"�"���/�/��,�,����"�"�#?�@�	
B�	C�	
���"�"��"�"���/�/��,�,����"�"�#8�9�	
;�	<�	
���"�"��"�"���/�/��,�,����"�"�#:�;�	
=�	>�	
���"�"��"�"���/�/��,�,����"�"�#<�=�	
?�	@�	
���"�"��"�"���/�/��,�,����"�"�#D�E�	
G�	H�@��
���5�+�+�S�$�7r'c
��tj�|_|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjd	tj
tj|jjd
�d��|jjtjd	tj
tj|jjd�d��|jjtjd	tj
tj|jjd
�d��|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjd tj
tj|jjd!�d��|jjtjd tj
tj|jjd"�d��|jjtjd tj
tj|jjd#�d��|jjtjd$tj
tj|jjd%���|jjtjd&tj
tj|jjd'���|jjtjd&tj
tj|jjd(���|jjtjd&tj
tj|jjd)���|jjtjd&tj
tj|jjd*���d+}tjtj|d,�y-).zBSets up and returns the flat-review-presenter laptop key bindings.�prJ�	semicolonrsr��ur_rK�ir`rrbrcr��orar^�jrerH�krfrhriro�lrgrI�mrjrd�commarkrlrm�periodrnrrprqrrrtz.FLAT REVIEW PRESENTER: Laptop bindings set up.TN)r
rr!r�r�r�r�rrM�ORCA_CTRL_MODIFIER_MASKr�rr/r0r�s  r%r\z*FlatReviewPresenter._setup_laptop_bindingssc��!,� 7� 7� 9������!�!��"�"���/�/��.�.����"�"�#@�A�	
C�	D�	
���!�!��"�"���/�/��.�.����"�"�#<�=��
�	�	
���!�!��"�"���/�/��.�.����"�"�#>�?�	
A�	B�	
���!�!��"�"���/�/��3�3����"�"�#6�7�	
9�	:�	
���!�!��"�"���/�/��.�.����"�"�#=�>��
�	�	
���!�!��"�"���/�/��.�.����"�"�#B�C��
�	�	
���!�!��"�"���/�/��.�.����"�"�#E�F��
�	�	
���!�!��"�"���/�/��.�.����"�"�#:�;�	
=�	>�	
���!�!��"�"���/�/��3�3����"�"�#5�6�	
8�	9�	
���!�!��"�"���/�/��.�.����"�"�#>�?�	
A�	B�	
���!�!��"�"���/�/��3�3����"�"�#7�8�	
:�	;�	
���!�!��"�"���/�/��.�.����"�"�#=�>��
�	�	
���!�!��"�"���/�/��.�.����"�"�#B�C��
�	�	
���!�!��"�"���/�/��.�.����"�"�#E�F��
�	�	
���!�!��"�"���/�/��3�3����"�"�#C�D�	
F�	G�	
���!�!��"�"���/�/��.�.����"�"�#:�;�	
=�	>�	
���!�!��"�"���/�/��3�3����"�"�#7�8�	
:�	;�	
���!�!��"�"���/�/��.�.����"�"�#C�D�	
F�	G�	
���!�!��"�"���/�/��3�3����"�"�#;�<�	
>�	?�	
���!�!��"�"���/�/��.�.����"�"�#B�C��
�	�	
���!�!��"�"���/�/��.�.����"�"�#G�H��
�	�	
���!�!��"�"���/�/��.�.����"�"�#I�J��
�	�	
���!�!��"�"���/�/��.�.����"�"�#?�@�	
B�	C�	
���!�!��"�"���/�/��,�,����"�"�#8�9�	
;�	<�	
���!�!��"�"���/�/��,�,����"�"�#:�;�	
=�	>�	
���!�!��"�"���/�/��,�,����"�"�#<�=�	
?�	@�	
���!�!��"�"���/�/��,�,����"�"�#D�E�	
G�	H�?��
���5�+�+�S�$�7r'c�
�|jr(d}tjtj|d�yd}tjtj|d�|�"t	j
�j
�}|j|�|�ytj
�jd�tjk7r|jtj�|j|||j �y)zStarts flat review.z-FLAT REVIEW PRESENTER: Already in flat reviewTNz+FLAT REVIEW PRESENTER: Starting flat review�speechVerbosityLevel)rrr/r0rr�getActiveScriptr@rrr�VERBOSITY_LEVEL_BRIEF�presentMessager�FLAT_REVIEW_START�_item_presentationr8)r$r<�eventr=s    r%�startzFlatReviewPresenter.start�s����=�=�A�C����u�/�/��d�;��;��
���5�+�+�S�$�7��>�#�.�.�0�@�@�B�F��"�"�6�*��=���&�&�(�3�3�4J�K��,�,�-��!�!�(�"<�"<�=������v�/F�/F�Gr'c�D�|j�(d}tjtj|d�yd}tjtj|d�d|_t	j
�j
�}t	j
�j|tj��|�|�ytj
�jd�tjk7r|jtj�|j!|�y)zQuits flat review.Nz)FLAT REVIEW PRESENTER: Not in flat reviewTz+FLAT REVIEW PRESENTER: Quitting flat reviewr,r�)rrr/r0r
rr9r3�FOCUS_TRACKINGrrrr�r�r�FLAT_REVIEW_STOP�
updateBraille)r$r<r�r=�focuss     r%�quitzFlatReviewPresenter.quit�s����=�=� �=�C����u�/�/��d�;��;��
���5�+�+�S�$�7���
��(�(�*�=�=�?��� � �"�6�6�u�=�C_�C_�6�`��=�F�N���&�&�(�3�3�4J�K��,�,�-��!�!�(�";�";�<����U�#r'c�n�|j�r|j||�y|j||�y)z9Toggles between flat review mode and focus tracking mode.T)r)r�r��r$r<r�s   r%rvz+FlatReviewPresenter.toggle_flat_review_modes0���>�>���I�I�f�e�$���
�
�6�5�!�r'c���|j|�|_|jjtjj
�|j
||�|j�|_y)z,Moves to the top left of the current window.T)	r@r�goBeginr	r2�WINDOWr�r7r8r�s   r%rxzFlatReviewPresenter.go_homesX���2�2�6�:��
��
�
���k�1�1�8�8�9����&�%�(�"(�"=�"=�"?���r'c���|j|�|_|jjtjj
�|j
||�|j�|_y)z0Moves to the bottom right of the current window.T)	r@r�goEndr	r2r�r�r7r8r�s   r%rzzFlatReviewPresenter.go_endsX���2�2�6�:��
��
�
���K�/�/�6�6�7����&�%�(�"(�"=�"=�"?���r'c�J�|j|�|_|jjtjj
�|jj
tjj�|j||�|j�|_
y)z/Moves to the bottom left of the current window.T)r@rr�r	r2r�r��LINEr�r7r8r�s   r%r|z"FlatReviewPresenter.go_bottom_left(sv���2�2�6�:��
��
�
���K�/�/�6�6�7��
�
���k�1�1�6�6�7����&�%�(�"(�"=�"=�"?���r'c��|j|�|_|jjtjj
tjj�r'|j||�|j�|_	y)zMoves to the previous line.T)
r@r�
goPreviousr	r2r��	WRAP_LINEr�r7r8r�s   r%r~z$FlatReviewPresenter.go_previous_line2�f���2�2�6�:��
��=�=�#�#�K�$7�$7�$<�$<�k�>Q�>Q�>[�>[�\����f�e�,�&,�&A�&A�&C�F�#�r'c�*�|j||d�y)�Presents the current line.rT��_line_presentationr�s   r%r�z FlatReviewPresenter.present_line;���	
�����q�1�r'c��|j|�|_|jjtjj
tjj�r'|j||�|j�|_	y)zMoves to the next line.T)
r@r�goNextr	r2r�r�r�r7r8r�s   r%r�z FlatReviewPresenter.go_next_lineAsf���2�2�6�:��
��=�=���� 3� 3� 8� 8�+�:M�:M�:W�:W�X����f�e�,�&,�&A�&A�&C�F�#�r'c�*�|j||d�y)z+Presents the current line letter by letter.r�Tr�r�s   r%r�zFlatReviewPresenter.spell_lineJr�r'c�*�|j||d�y)z8Presents the current line letter by letter phonetically.r�Tr�r�s   r%r�z!FlatReviewPresenter.phonetic_linePr�r'c���|j|�|_|jjtjj
�|j
||�|j�|_y)z+Moves to the beginning of the current line.T�	r@rr�r	r2r�r�r7r8r�s   r%�go_start_of_linez$FlatReviewPresenter.go_start_of_lineV�X���2�2�6�:��
��
�
���K�/�/�4�4�5����v�u�-�"(�"=�"=�"?���r'c���|j|�|_|jjtjj
�|j
||�|j�|_y)zMoves to the end of the line.Tr�r�s   r%r�z"FlatReviewPresenter.go_end_of_line_r�r'c��|j|�|_|jjtjj
tjj�r'|j||�|j�|_	y)z#Moves to the previous item or word.T)
r@rr�r	r2�WORDr�r�r7r8r�s   r%r�z$FlatReviewPresenter.go_previous_itemhr�r'c�,�|j|||d�y)�Presents the current item/word.rT)r�)r$r<r��target_cursor_cells    r%r�z FlatReviewPresenter.present_itemqs��	
�����/A�1�E�r'c��|j|�|_|jjtjj
tjj�r'|j||�|j�|_	y)zMoves to the next item or word.T)
r@rr�r	r2r�r�r�r7r8r�s   r%r�z FlatReviewPresenter.go_next_itemwsf���2�2�6�:��
��=�=���� 3� 3� 8� 8�+�:M�:M�:W�:W�X����f�e�,�&,�&A�&A�&C�F�#�r'c�@�|j|||jd�y)z0Presents the current item/word letter by letter.r�T�r�r8r�s   r%r�zFlatReviewPresenter.spell_item��!��	
�����v�/F�/F��J�r'c�@�|j|||jd�y)z8Presents the current word letter by letter phonetically.r�Trr�s   r%r�z!FlatReviewPresenter.phonetic_item�rr'c��|j|�|_|jjtjj
tjj�r'|j||�|j�|_	y)z Moves to the previous character.T)
r@rr�r	r2�CHARr�r�r7r8r�s   r%r�z)FlatReviewPresenter.go_previous_character�sf���2�2�6�:��
��=�=�#�#�K�$7�$7�$<�$<�k�>Q�>Q�>[�>[�\��"�"�6�5�1�&,�&A�&A�&C�F�#�r'c�*�|j||d�y)�Presents the current character.rT��_character_presentationr�s   r%r�z%FlatReviewPresenter.present_character����	
�$�$�V�U�A�6�r'c��|j|�|_|jjtjj
tjj�r'|j||�|j�|_	y)zMoves to the next character.T)
r@rr�r	r2rr�r�r7r8r�s   r%r�z%FlatReviewPresenter.go_next_character�sf���2�2�6�:��
��=�=���� 3� 3� 8� 8�+�:M�:M�:W�:W�X��"�"�6�5�1�&,�&A�&A�&C�F�#�r'c�*�|j||d�y)z,Presents the current character phonetically.r�Trr�s   r%r�z#FlatReviewPresenter.spell_character�r	r'c�*�|j||d�y)z/Presents the current character's unicode value.r�Trr�s   r%r�z-FlatReviewPresenter.unicode_current_character�r	r'c��|j|�|_|jjtjj
tjj�r|j|||j�y)zMoves to the character above.T)	r@r�goAbover	r2rr�r�r8r�s   r%r�zFlatReviewPresenter.go_above��]���2�2�6�:��
��=�=� � ��!4�!4�!9�!9�;�;N�;N�;X�;X�Y����f�e�V�-D�-D�E�r'c��|j|�|_|jjtjj
tjj�r|j|||j�y)zMoves to the character below.T)	r@r�goBelowr	r2rr�r�r8r�s   r%r�zFlatReviewPresenter.go_below�rr'c�b�|j|�|_|jj�S)z&Returns the current accessible object.)r@rr4r�s   r%�get_current_objectz&FlatReviewPresenter.get_current_object�s)���2�2�6�:��
��}�}�1�1�3�3r'c�P�|j|�|_t|tj�s+|j|jj
�d��tj�j|jj
�tj��y)z'Presents the current accessible object.T)�
speechonlyr,)r@r�
isinstancer�BrailleEvent�
presentObjectr4r
rr3r5r�s   r%r�z"FlatReviewPresenter.present_object�s���2�2�6�:��
��%��!9�!9�:�� � ����!C�!C�!E�RV� �W�� � �"�6�6��M�M�.�.�0�}�7P�7P�	7�	R�r'c�d�|j|�|_|jjd�S)�>Attempts to synthesize a left click on the current accessible.r�r@r�clickCurrentr�s   r%�left_click_on_objectz(FlatReviewPresenter.left_click_on_object��+���2�2�6�:��
��}�}�)�)�!�,�,r'c�d�|j|�|_|jjd�S)rr�rr�s   r%�right_click_on_objectz)FlatReviewPresenter.right_click_on_object�rr'c�b�|j|�|_|jj�S)z3Routes the mouse pointer to the current accessible.)r@r�routeToCurrentr�s   r%�route_pointer_to_objectz+FlatReviewPresenter.route_pointer_to_object�s)���2�2�6�:��
��}�}�+�+�-�-r'c�p�|j|�|_|jj�\}}||gS)zAReturns the braille regions and region with focus being reviewed.)r@r�getCurrentBrailleRegions)r$r<r��regions�focused_regions     r%�get_braille_regionsz'FlatReviewPresenter.get_braille_regions�s8���2�2�6�:��
�"&�-�-�"H�"H�"J������(�(r'c�\�g}|j|�|_|jjtjj
�|jj
tjj�d}|��|j|jd��|jjtjjtjj�s	|S|jj
tjj�d}|���|S)z:Returns a list of textual lines representing the contents.r�
)r@rr�r	r2r��
getCurrentr��append�rstripr�r�)r$r<r��lines�strings     r%�_get_all_linesz"FlatReviewPresenter._get_all_lines�s������2�2�6�:��
��
�
���k�1�1�8�8�9����)�)�+�*=�*=�*B�*B�C�A�F��� ��L�L����t�,�-��=�=�'�'��(;�(;�(@�(@�+�BU�BU�B_�B_�`�����]�]�-�-�k�.A�.A�.F�.F�G��J�F�	� �
�r'c��|j||�D]?}|j�r�|j||jj	|����Ay)z)Speaks the contents of the entire window.�r/T)r0�isspace�speakMessage�speechGenerator�voice)r$r<r�r/s    r%r�zFlatReviewPresenter.say_all�sV���)�)�&�%�8�	Y�F��>�>�#��#�#�F�F�,B�,B�,H�,H�PV�,H�,W�X�	Y�r'c��d}tjtj|d�dj|j	||��}t
j}t|||�|_|jj�y)z8Displays the entire flat review contents in a text view.z(FLAT REVIEW PRESENTER: Showing contents.Tr*)
rr/r0�joinr0r�FLAT_REVIEW_CONTENTS�FlatReviewContextGUIr"�show_gui)r$r<r�r=�text�titles      r%r�z!FlatReviewPresenter.show_contentssj��9��
���5�+�+�S�$�7��y�y��,�,�V�U�;�<���.�.��(����=��	��	�	����r'c�
�|j�s |jtj�y|jj|jjd��|jtj�y)z2Copies the string just presented to the clipboard.Tr*)	r)r�r�FLAT_REVIEW_NOT_IN�	utilities�setClipboardTextrr-�FLAT_REVIEW_COPIEDr�s   r%r�z%FlatReviewPresenter.copy_to_clipboardsa���~�~���!�!�(�"=�"=�>�����)�)�$�*@�*@�*G�*G��*M�N����h�9�9�:�r'c�
�|j�s |jtj�y|jj|jjd��|jtj�y)z3Appends the string just presented to the clipboard.Tr*)	r)r�rr?r@�appendTextToClipboardrr-�FLAT_REVIEW_APPENDEDr�s   r%r�z'FlatReviewPresenter.append_to_clipboardsa���~�~���!�!�(�"=�"=�>�����.�.�t�/E�/E�/L�/L�T�/R�S����h�;�;�<�r'c�h�|j|_tj�jd|j�|jr |j	t
j�n|j	t
j�|j�rd|_	|j�y)z? Toggles the restricting of flat review to the current object. rNT)rrr�
setSettingr�r�FLAT_REVIEW_RESTRICTED�FLAT_REVIEW_UNRESTRICTEDr)rr�r�s   r%r�z#FlatReviewPresenter.toggle_restrict$s|��"�^�^�+����#�#�%�0�0�1I�4�>�>�Z��>�>��!�!�(�"A�"A�B��!�!�(�"C�"C�D��>�>�� �D�M��J�J�L�r'c��|j|�|_|jjtjj
�dxsd}|jj|��}t|tj�s�|r|dk(r |jtj�n�|j�r |jtj�n�|j!�r|dks|dkDr|j||�n[|dk(r|j#|�nD|dk(r|j%|�n-|j&j)|�}|j||�t+j,�j/|jj1�t*j2��|j5�||_y)	r�rrr2r*r�r�r,T)r@rr+r	r2r�r5r6rrrr4r�BLANKr3�WHITE_SPACE�isupper�spellCurrentItem�phoneticSpellCurrentItemr@�adjustForRepeatsr
rr3r4r5�updateBrailleReviewr)r$r<r��speech_type�line_stringr6s      r%r�z&FlatReviewPresenter._line_presentation5sk���2�2�6�:��
��m�m�.�.�{�/B�/B�/G�/G�H��K�Q�r���&�&�,�,�K�,�@���%��!9�!9�:��+��"5��#�#�H�N�N�3��$�$�&��#�#�H�$8�$8�9��$�$�&�K�!�O�{�Q���#�#�K��7���!��'�'��4���!��/�/��<�$�.�.�?�?��L���#�#�K��7�� � �"�6�6��M�M�.�.�0�}�7P�7P�	7�	R��"�"�$�!,���r'c�V�|j|�|_|jjtjj
�dxsd}|jj|��}t|tj��s?|r|dk(r!|jtj��n|jjtjj�dxsd}|dk(r |jtj�n�|j�r |jtj �n�|j#�r|dk(r|j||�n`|dk(r|j%|�nI|dk(r|j'|�n2|dk(r-|j(j+|�}|j||�t-j.�j1|jj3�t,j4��|j7|�||_y	)
r�rrr2r*rr�r�r,T)r@rr+r	r2r�r5r6rrrr4rrKr�r3rLrMrNrOr@rPr
rr3r4r5rQr)r$r<r�r�rR�word_stringr6rSs        r%r�z&FlatReviewPresenter._item_presentationQs����2�2�6�:��
��m�m�.�.�{�/B�/B�/G�/G�H��K�Q�r���&�&�,�,�K�,�@���%��!9�!9�:��+��"5��#�#�H�N�N�3�"�m�m�6�6�{�7J�7J�7O�7O�P�QR�S�Y�WY���$�&��'�'����7� �(�(�*��'�'��(<�(<�=� �(�(�*�{�a�/?��'�'��U�;� �A�%��+�+�K�8� �A�%��3�3�K�@� �A�%�"(�"2�"2�"C�"C�K�"P�K��'�'��U�;�� � �"�6�6��M�M�.�.�0�}�7P�7P�	7�	R��"�"�#5�6�!,���r'c�&�|j|�|_|jjtjj
�dxsd}t
|tj�s�|s |jtj�n�|jjtjj�dxsd}|dk(r%|dk7r |jtj�n?|dk(r|j|�n(|dk(r|j|�n|j|�t!j"�j%|jj'�t j(��|j+�||_y)rrrr*r�r�r,T)r@rr+r	r2rrrrr4rrKr��speakUnicodeCharacterrO�speakCharacterr
rr3r4r5rQr)r$r<r�rR�char_stringrSs      r%rz+FlatReviewPresenter._character_presentationps8���2�2�6�:��
��m�m�.�.�{�/B�/B�/G�/G�H��K�Q�r���%��!9�!9�:���#�#�H�N�N�3�"�m�m�6�6�{�7J�7J�7O�7O�P�QR�S�Y�WY���$�&�;�!�+;��'�'����7� �A�%��0�0��=� �A�%��3�3�K�@��)�)�+�6�� � �"�6�6��M�M�.�.�0�}�7P�7P�	7�	R��"�"�$�!,���r'�N)FT)F)NN)Nr)r)rr)6�__name__�
__module__�__qualname__�__doc__r&r)r@rFrWrrBrYr[r\r�r�rvrxrzr|r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�rr r#r(r0r�r�r�r�r�r�r�r�r'r%rr2s��?��)�
3�j%� �*�&�R8�hM8�^M8�^H�.$�,�����������������������4�	�-�-�.�)���
�	�	��"�8�>r'rc�(�eZdZdZd�Zd�Zd�Zd�Zy)r:z6Presents the entire flat review context in a text viewc�@�||_|j||�|_yrZ)�_script�_create_dialogr")r$r<r=r<s    r%r&zFlatReviewContextGUI.__init__�s������'�'��t�4��	r'c�n�tj|dtjjtjtj
jf�}|jdd�tj�}|jtjjtjj�tj�}|j|�|j|j��tj |��}|j#tj$j&�|j)|�|j+d�|j-d�|j/�j1|ddd�|j3d|j4�|S)zCreates the dialog.Ni iX)�bufferTr�response)r�Dialog�DialogFlags�MODAL�STOCK_CLOSE�ResponseType�CLOSE�set_default_size�ScrolledWindow�
set_policy�
PolicyType�	AUTOMATIC�
TextBuffer�set_text�place_cursor�get_start_iter�TextView�
set_wrap_mode�WrapModer�r��set_hexpand�set_vexpand�get_content_area�
pack_start�connect�on_response)r$r=r<�dialog�scrolled_window�
textbuffer�textviews       r%rcz#FlatReviewContextGUI._create_dialog�s8�����E� ��O�O�1�1� �_�_�c�.>�.>�.D�.D�E�G��	����S�)��,�,�.���"�"�3�>�>�#;�#;�S�^�^�=U�=U�V��^�^�%�
����D�!����
� 9� 9� ;�<��<�<�z�2�����s�|�|�0�0�1����H�%��#�#�D�)��#�#�D�)����!�,�,�_�d�D�!�L����z�4�#3�#3�4��
r'c�t�|tjjk(r|jj	�yy)z0Handler for the 'response' signal of the dialog.N)rrkrlr"�destroy)r$rrfs   r%r~z FlatReviewContextGUI.on_response�s-���s�'�'�-�-�-��I�I����.r'c���|jj�tjj}|dk(rtj�}|jj|�y)zShows the dialog.rN)r"�show_allr�lastInputEvent�	timestampr�get_current_event_time�present_with_time)r$�
time_stamps  r%r;zFlatReviewContextGUI.show_gui�sL��	
�	�	�����.�.�8�8�
���?��3�3�5�J��	�	�#�#�J�/r'N)r[r\r]r^r&rcr~r;r_r'r%r:r:�s��@�5��6 �0r'r:c��tS)z!Returns the Flat Review Presenter)�
_presenterr_r'r%�getPresenterr��s
���r')r^�__id__�__version__�__date__�
__copyright__�__license__�gi�require_version�
gi.repositoryrrrrrr	r
rrr
rrrrrrr:r�r�r_r'r%�<module>r�s���*&�������7�
���	�����5�%� ���������������U�U�n"/0�/0�d!�
"�
�r'

Zerion Mini Shell 1.0