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

�

g
fP4���dZdZdZdZdZdZddlZejdd	�ejd
d�ejdd�dd
lm	Z	ddlm
Z
ddlmZddlmZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddlmZGd�d�ZGd�d �Ze�Zd!�Zy)"zModule for learn modez$Id$z
$Revision$z$Date$zQCopyright (c) 2005-2008 Sun Microsystems Inc.Copyright (c) 2016-2023 Igalia, S.L.�LGPL�N�Atspiz2.0�Gdkz3.0�Gtk)r)r)�GObject)r�)�cmdnames)�debug)�	guilabels)�input_event)�keybindings)�messages)�
orca_state)�script_manager)�settings)�settings_manager)�AXObjectc�h�eZdZdZd�Zd�Zdd�Zdd�Zd�Zd�Z	dd	�Z
dd
�Zdd�Zdd�Z
dd
�Zdd�Zy)�LearnModePresenterz%Provides implementation of learn modec�~�|jd�|_tj�|_d|_d|_y)NTF)�get_handlers�	_handlersr
�KeyBindings�	_bindings�
_is_active�_gui��selfs �;/usr/lib/python3/dist-packages/orca/learn_mode_presenter.py�__init__zLearnModePresenter.__init__8s2���*�*�4�0���$�0�0�2��������	�c��|jS)z#Returns True if we're in learn mode)rrs r�	is_activezLearnModePresenter.is_active>s�����r!c��|rCd}tjtj|d�|j�|jS|jj�r|j�|jS)z-Returns the learn-mode-presenter keybindings.z*LEARN MODE PRESENTER: Refreshing bindings.T)r
�printMessage�
LEVEL_INFO�_setup_bindingsr�isEmpty)r�refresh�
is_desktop�msgs    r�get_bindingszLearnModePresenter.get_bindingsCsd���>�C����u�/�/��d�;�� � �"��~�~���^�^�
#�
#�
%�� � �"��~�~�r!c��|r7d}tjtj|d�|j�|jS)z*Returns the learn-mode-presenter handlers.z*LEARN MODE PRESENTER: Refreshing handlers.T)r
r%r&�_setup_handlersr)rr)r+s   rrzLearnModePresenter.get_handlersOs:���>�C����u�/�/��d�;�� � �"��~�~�r!c���i|_tj|jtj
�|jd<d}t
jtj|d�y)z6Sets up the learn-mode-presenter input event handlers.�enterLearnModeHandlerz&LEARN MODE PRESENTER: Handlers set up.TN)	rr�InputEventHandler�startr	�ENTER_LEARN_MODEr
r%r&�rr+s  rr.z"LearnModePresenter._setup_handlersYsY�����
�)�)��
�
��)�)�
+�	
���.�/�
7��
���5�+�+�S�$�7r!c
�P�tj�|_|jjtjdtj
tj|jjd���d}tjtj|d�y)z.Sets up the learn-mode-presenter key bindings.�hr0z&LEARN MODE PRESENTER: Bindings set up.TN)r
rr�add�
KeyBinding�defaultModifierMask�ORCA_MODIFIER_MASKr�getr
r%r&r4s  rr'z"LearnModePresenter._setup_bindingsfs{��%�0�0�2���������"�"���/�/��.�.����"�"�#:�;�	
=�	>�7��
���5�+�+�S�$�7r!Nc�v�|jr(d}tjtj|d�y|�"t	j
�j
�}|�]|jtj�|jtj�|jtj�d}tjtj|d�tjj!t"j$�d}tjtj|d�d|_y)zStarts learn mode.z6LEARN MODE PRESENTER: Start called when already activeTz'LEARN MODE PRESENTER: Grabbing keyboardz#LEARN MODE PRESENTER: Is now active)rr
r%r&r�
getManager�getActiveScript�presentMessager�VERSION�speakMessage�LEARN_MODE_START_SPEECH�displayBrailleMessage�LEARN_MODE_START_BRAILLEr�Device�
grab_keyboardr�device�r�script�eventr+s    rr2zLearnModePresenter.startus����?�?�J�C����u�/�/��d�;���>�#�.�.�0�@�@�B�F����!�!�(�"2�"2�3����� @� @�A��(�(��)J�)J�K�7��
���5�+�+�S�$�7�
���"�"�:�#4�#4�5�3��
���5�+�+�S�$�7����r!c��|js(d}tjtj|d�y|�"t	j
�j
�}|�|jtj�d}tjtj|d�tjjtj�d}tjtj|d�d|_y)zQuits learn mode.z7LEARN MODE PRESENTER: Quit called when already inactiveTz)LEARN MODE PRESENTER: Ungrabbing keyboardz%LEARN MODE PRESENTER: Is now inactiveF)rr
r%r&rr=r>r?r�LEARN_MODE_STOPrrE�ungrab_keyboardrrGrHs    r�quitzLearnModePresenter.quit�s������K�C����u�/�/��d�;���>�#�.�.�0�@�@�B�F����!�!�(�":�":�;�9��
���5�+�+�S�$�7�
���$�$�Z�%6�%6�7�5��
���5�+�+�S�$�7����r!c�t�|jsyt|tj�syt	j
�j
�}|j|�|j�r>|j�dk(r+|j��|j|j�|jdk(r|jd|��y|jdk(r|js|j||�y|jdvr|js|j!||�y|j#|�y)	z*Handles the event if learn mode is active.F�N�Escape)rIrJT�F1)�F2�F3)r�
isinstancer�
KeyboardEventrr=r>�
speakKeyEvent�isPrintableKey�
getClickCount�
getHandler�phoneticSpellCurrentItem�event_stringrN�	modifiers�	show_help�list_orca_shortcuts�present_command)rrJrIs   r�handle_eventzLearnModePresenter.handle_event�s�������%��!:�!:�;���*�*�,�<�<�>�����U�#����!�e�&9�&9�&;�q�&@����!�)��+�+�E�,>�,>�?�����)��I�I�T��I�/������%�e�o�o��N�N�6�5�)������-�e�o�o��$�$�V�U�3�����U�#�r!c�
�t|tj�sy|j�}|�y|jrI|j
r=t
j�j�}|j|j
�y)z$Presents the command bound to event.T)
rUrrVrZ�learnModeEnabled�descriptionrr=r>r?)rrJ�handlerrIs    rr`z"LearnModePresenter.present_command�sl���%��!:�!:�;���"�"�$���?���#�#��(;�(;�#�.�.�0�@�@�B�F��!�!�'�"5�"5�6�r!c�
�|�tj}tj�j	d�}|t
jk(}d}i}|�|jdk(�r	|j�j�}||tj<|t|�z
}|j�j|��j�}||tj<|t|�z
}|j!�j|��j�}||tj"<|t|�z
}|j%�j|��j�}||tj&<|t|�z
}|j)�j|��j�}||tj*<|t|�z
}|j-�j|��j�}||tj.<|t|�z
}|j1�j|��j�}||tj2<|t|�z
}|j5�j|��j�}||tj6<|t|�z
}|j9�j|��j�}||tj:<|t|�z
}|j=�j|��j�}||tj><|t|�z
}|jA�j|��j�}||tjB<|t|�z
}|jE�j|��j�}||tjF<|t|�z
}|jI�j|��j�}||tjJ<|t|�z
}tMjN|�}n�tQjR|jT�xstLjV}	|jY�j�}|j[|j]�j��|r|||	<tMj^t|�|	�}|s|ja|�y|jc||�tjdtjfg}
ti|||
|�|_5|jjjm�y)z1Shows a simple gui listing Orca's bound commands.�keyboardLayoutrrS)r*T)7r�lastNonModifierKeyEventrr=�
getSettingr�GENERAL_KEYBOARD_LAYOUT_DESKTOPr\�getDefaultKeyBindings�getBoundBindingsr�KB_GROUP_DEFAULT�len�getLearnModePresenterr,�KB_GROUP_LEARN_MODE�getWhereAmIPresenter�KB_GROUP_WHERE_AM_I�getSpeechAndVerbosityManager�KB_GROUP_SPEECH_VERBOSITY�getSleepModeManager�KB_GROUP_SLEEP_MODE�getFlatReviewPresenter�KB_GROUP_FLAT_REVIEW�getObjectNavigator�KB_GROUP_OBJECT_NAVIGATION�getTableNavigator�KB_GROUP_TABLE_NAVIGATION�getSystemInformationPresenter�KB_GROUP_SYSTEM_INFORMATION�getNotificationPresenter�KB_GROUP_NOTIFICATIONS�getBookmarks�KB_GROUP_BOOKMARKS�getMouseReviewer�KB_GROUP_MOUSE_REVIEW�getActionPresenter�KB_GROUP_ACTIONSr�shortcutsFoundOrcar�get_name�app�APPLICATION_NO_NAME�getAppKeyBindings�extend�getToolkitKeyBindings�shortcutsFoundAppr?rN�KB_HEADER_FUNCTION�KB_HEADER_KEY_BINDING�CommandListGUIr�show_gui)rrIrJ�layoutr*�items�bindings�bound�title�app_name�column_headerss           rr_z&LearnModePresenter.list_orca_shortcuts�s����=��6�6�E�!�,�,�.�9�9�:J�K���x�G�G�G�
������=�E�.�.�$�6��0�0�2�C�C�E�E�38�H�Y�/�/�0��S��Z��E��0�0�2�?�?�%�@�'�'7�'7�'9�
�6;�H�Y�2�2�3��S��Z��E��/�/�1�>�>�%�?�'�'7�'7�'9�
�6;�H�Y�2�2�3��S��Z��E��7�7�9�F�F�%�G�'�'7�'7�'9�
�<A�H�Y�8�8�9��S��Z��E��.�.�0�=�=�%�>�'�'7�'7�'9�
�6;�H�Y�2�2�3��S��Z��E��1�1�3�@�@�%�A�'�'7�'7�'9�
�7<�H�Y�3�3�4��S��Z��E��-�-�/�<�<�%�=�'�'7�'7�'9�
�=B�H�Y�9�9�:��S��Z��E��,�,�.�;�;�%�<�'�'7�'7�'9�
�<A�H�Y�8�8�9��S��Z��E��8�8�:�G�G�%�H�'�'7�'7�'9�
�>C�H�Y�:�:�;��S��Z��E��3�3�5�B�B�%�C�'�'7�'7�'9�
�9>�H�Y�5�5�6��S��Z��E��'�'�)�6�6�%�7�'�'7�'7�'9�
�5:�H�Y�1�1�2��S��Z��E��+�+�-�:�:�%�;�'�'7�'7�'9�
�8=�H�Y�4�4�5��S��Z��E��-�-�/�<�<�%�=�'�'7�'7�'9�
�38�H�Y�/�/�0��S��Z��E��/�/��6�E��(�(����4�T��8T�8T�H��,�,�.�?�?�A�E��L�L��5�5�7�H�H�J�K��%*���"��.�.�s�5�z�8�D�E���!�!�%�(���	�	�&�%� �#�6�6�	�8W�8W�X��"�6�5�.�(�K��	��	�	����r!c���|j||�d}|r|d|��z
}tjtjj�|tj��y)zDisplays Orca's documentation.z	help:orca�/T)rNr�show_urir�Screen�get_default�get_current_event_time)rrIrJ�page�uris     rr^zLearnModePresenter.show_help2sS��	
�	�	�&�%� �����Q�t�f�:��C����S�Z�Z�+�+�-�s�C�4N�4N�4P�Q�r!)FT)F)NN�N)NN�)�__name__�
__module__�__qualname__�__doc__r r#r,rr.r'r2rNrar`r_r^�r!rrr5sC��/���

��8�
8��2�.�<� ]�~r!rc�(�eZdZdZd�Zd�Zd�Zd�Zy)r�z,Shows a list of commands and their bindings.c�P�||_d|_|j|||�|_yr�)�_script�_model�_create_dialogr)rrIr�r��
bindings_dicts     rr zCommandListGUI.__init__?s&���������'�'��~�}�M��	r!c���tj|dtjjtjtj
jf�}|jdd�tj�}|j�}|j|�tj�}|j|�tj�}|jd�|jd�|j|�t|�t j"gz}	t%|�D]V\}
}tj&�}tj(|||
��}
|j+|
�|s�F|
j-|
��Xtj.|	�|_|j3�D]m\}}|s�	|j0j5d|dg�}|D]B}|j0j5||j6j8|j;�g��D�o|j=|j0�|j?�|jAd|jB�|S)z!Creates the commands-list dialog.Ni�i T)�textr��response)"r�Dialog�DialogFlags�MODAL�STOCK_CLOSE�ResponseType�CLOSE�set_default_size�Grid�get_content_arear7�ScrolledWindow�TreeView�set_hexpand�set_vexpandrnr�TYPE_STRING�	enumerate�CellRendererText�TreeViewColumn�
append_column�set_sort_column_id�	TreeStorer�r��appendrerd�asString�	set_model�
expand_all�connect�on_response)rr�r�r��dialog�grid�content_area�scrolled_window�tree�cols�i�header�cell�column�groupr��
group_iter�bindings                  rr�zCommandListGUI._create_dialogDs������E� ��O�O�1�1� �_�_�c�.>�.>�.D�.D�E�G��	����c�*��x�x�z���.�.�0��������,�,�.������!��|�|�~���������������D�!��>�"�g�&9�&9�%:�:��"�>�2�	-�I�A�v��'�'�)�D��'�'���1�=�F����v�&���)�)�!�,�	-��m�m�T�*���,�2�2�4�	b�O�E�8������+�+�D�5�"�+�>�J�#�
b�����"�"�:����0K�0K�W�M]�M]�M_�/`�a�
b�		b�	
���t�{�{�#��������z�4�#3�#3�4��
r!c�t�|tjjk(r|jj	�yy)z"Handler for the 'response' signal.N)rr�r�r�destroy)rr�r�s   rr�zCommandListGUI.on_responseos0���s�'�'�-�-�-��I�I�����.r!c���|jj�tjj}|dk(rtj�}|jj|�y)zShows the dialog.rN)r�show_allr�lastInputEvent�	timestamprr��present_with_time)r�
time_stamps  rr�zCommandListGUI.show_guivsL��	
�	�	�����.�.�8�8�
���?��3�3�5�J��	�	�#�#�J�/r!N)r�r�r�r�r r�r�r�r�r!rr�r�<s��6�N�
)�V�0r!r�c��tS)z Returns the Learn Mode Presenter)�
_presenterr�r!r�getPresenterr��s
���r!)r��__id__�__version__�__date__�
__copyright__�__license__�gi�require_version�
gi.repositoryrrrrr�r	r
rrr
rrrrr�	ax_objectrrr�r�r�r�r!r�<module>r�s���*�������7�
���	�����7�E�"�����5�%� �����5�%� ���!�������������E�E�NA0�A0�H �
!�
�r!

Zerion Mini Shell 1.0