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

�

g
f�2���dZdZdZdZdZdZddlZddlZejdd	�dd
l	m
Z
ddl	mZdd
lm
Z
ddlmZddlmZddlmZddlmZddlmZddlmZGd�d�ZGd�d�Ze�Zd�Zy)z Module for notification messagesz$Id$z
$Revision$z$Date$zLCopyright (c) 2023 Igalia, S.L.Copyright (c) 2010 Informal Informatica LTDA.�LGPL�N�Gtkz3.0)�GObject)r�)�cmdnames)�debug)�	guilabels)�input_event)�keybindings)�messages)�
orca_statec�j�eZdZdZd�Zdd�Zdd�Zd�Zd�Zd�Z	d�Z
d	�Zdd�Zdd�Z
dd
�Zdd�Zd�Zy
)�NotificationPresenterz,Provides access to the notification history.c��d|_|jd�|_tj�|_d|_g|_d|_y)NT�7���)	�_gui�get_handlers�	_handlersr�KeyBindings�	_bindings�	_max_size�_notifications�_current_index��selfs �=/usr/lib/python3/dist-packages/orca/notification_presenter.py�__init__zNotificationPresenter.__init__3sD����	��*�*�4�0���$�0�0�2������!��� ���c��|rCd}tjtj|d�|j�|jS|jj�r|j�|jS)z/Returns the notification-presenter keybindings.z,NOTIFICATION PRESENTER: Refreshing bindings.T)r�printMessage�
LEVEL_INFO�_setup_bindingsr�isEmpty)r�refresh�
is_desktop�msgs    r�get_bindingsz"NotificationPresenter.get_bindings@sd���@�C����u�/�/��d�;�� � �"��~�~���^�^�
#�
#�
%�� � �"��~�~�rc��|r7d}tjtj|d�|j�|jS)z,Returns the notification-presenter handlers.z,NOTIFICATION PRESENTER: Refreshing handlers.T)rr!r"�_setup_handlersr)rr%r's   rrz"NotificationPresenter.get_handlersLs:���@�C����u�/�/��d�;�� � �"��~�~�rc�<�d|dg}tjtj|d�tt	|j
�|jz
dzd�}|j
|d|_|j
j|tj�g�y)z2Adds message to the list of notification messages.z NOTIFICATION PRESENTER: Adding 'z'.TrrN)	r�printTokensr"�max�lenrr�append�time)r�message�tokens�	to_removes    r�save_notificationz'NotificationPresenter.save_notificationVs���5�g�t�D��
���%�*�*�F�D�9���D�/�/�0�4�>�>�A�A�E�q�I�	�"�1�1�)�*�=������"�"�G�T�Y�Y�[�#9�:rc�n�d}tjtj|d�g|_d|_y)zClears the notifications list.z&NOTIFICATION PRESENTER: Clearing list.TrN)rr!r"rr�rr's  r�
clear_listz NotificationPresenter.clear_list_s1��7��
���5�+�+�S�$�7� ��� ��rc�8�i|_tj|jtj
�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|jtj�|jd<d}tjtj|d�y)z8Sets up the notification-presenter input event handlers.�present_last_notification�present_next_notification�present_previous_notification�show_notification_listz(NOTIFICATION PRESENTER: Handlers set up.TN)rr
�InputEventHandler�_present_last_notificationr�NOTIFICATION_MESSAGES_LAST�_present_next_notification�NOTIFICATION_MESSAGES_NEXT�_present_previous_notification�NOTIFICATION_MESSAGES_PREVIOUS�_show_notification_list�NOTIFICATION_MESSAGES_LISTrr!r"r6s  rr*z%NotificationPresenter._setup_handlersgs������
�)�)��/�/��3�3�
5�	
���2�3�
�)�)��/�/��3�3�
5�	
���2�3�
�)�)��3�3��7�7�
9�	
���6�7�
�)�)��,�,��3�3�
5�	
���/�0�
9��
���5�+�+�S�$�7rc
��tj�|_|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���d}tjtj|d�y)	z0Sets up the notification-presenter key bindings.�r9r:r;r<z(NOTIFICATION PRESENTER: Bindings set up.TN)rrr�add�
KeyBinding�defaultModifierMask�NO_MODIFIER_MASKr�getrr!r"r6s  rr#z%NotificationPresenter._setup_bindings�s_��%�0�0�2���������"�"���/�/��,�,����"�"�#>�?�	
A�	B�	
������"�"���/�/��,�,����"�"�#>�?�	
A�	B�	
������"�"���/�/��,�,����"�"�#B�C�	
E�	F�	
������"�"���/�/��,�,����"�"�#;�<�	
>�	?�9��
���5�+�+�S�$�7rc�J�tj�|z
}|dkrtj|�S|dkr#t|dz�}tj|�S|dkr#t|dz�}tj
|�St|dz�}tj|�S)N�<ii�Q)r0r�
secondsAgo�round�
minutesAgo�hoursAgo�daysAgo)r�	timestamp�diff�minutes�hours�dayss      r�_timestamp_to_stringz*NotificationPresenter._timestamp_to_string�s����y�y�{�Y�&���"�9��&�&�t�,�,��$�;��D�2�I�&�G��&�&�w�/�/��%�<��$��+�&�E��$�$�U�+�+��T�E�\�"������%�%rNc�*�|js |jtj�yd}t	j
tj|d�|jd\}}|�d|j|���}|j|�d|_y)zPresents the last notification.Tz5NOTIFICATION PRESENTER: Presenting last notification.r� )	r�presentMessager�NOTIFICATION_NO_MESSAGESrr!r"rYr)r�script�eventr'r1rT�strings       rr>z0NotificationPresenter._present_last_notification�s����"�"��!�!�(�"C�"C�D��E��
���5�+�+�S�$�7�!�0�0��4�����9�A�d�7�7�	�B�C�D�����f�%� ���rc��|js |jtj�yd|j��}tjt
j|d�|jdk(r<|jtj�|j|j\}}n7	|jdz
}|j|\}}|xjdzc_|�d|j|���}|j|�y#t$red}tjt
j|d�|jtj�|j|j\}}Y��wxYw)z#Presents the previous notification.TzINOTIFICATION PRESENTER: Presenting previous notification. Current index: rr�6NOTIFICATION PRESENTER: Handling IndexError exception.r[)rr\rr]rrr!r"�NOTIFICATION_LIST_TOP�
IndexErrorrY�rr^r_r'r1rT�indexr`s        rrBz4NotificationPresenter._present_previous_notification�sb���"�"��!�!�(�"C�"C�D���"�1�1�2�
4�	�	���5�+�+�S�$�7����!�#��!�!�(�"@�"@�A�!%�!4�!4�T�5H�5H�!I��G�Y�
N��+�+�a�/��%)�%8�%8��%?�"����#�#�q�(�#��9�A�d�7�7�	�B�C�D�����f�%����
N�N���"�"�5�#3�#3�S�$�?��%�%�h�&D�&D�E�%)�%8�%8��9L�9L�%M�"���	
N���-6D�A+E9�8E9c��|js |jtj�yd|j��}tjt
j|d�|jdk(r<|jtj�|j|j\}}n7	|jdz}|j|\}}|xjdz
c_|�d|j|���}|j|�y#t$red}tjt
j|d�|jtj�|j|j\}}Y��wxYw)zPresents the next notification.TzENOTIFICATION PRESENTER: Presenting next notification. Current index: rrrbr[)rr\rr]rrr!r"�NOTIFICATION_LIST_BOTTOMrdrYres        rr@z0NotificationPresenter._present_next_notification�sb���"�"��!�!�(�"C�"C�D���"�1�1�2�
4�	�	���5�+�+�S�$�7����"�$��!�!�(�"C�"C�D�!%�!4�!4�T�5H�5H�!I��G�Y�
N��+�+�a�/��%)�%8�%8��%?�"����#�#�q�(�#��9�A�d�7�7�	�B�C�D�����f�%����
N�N���"�"�5�#3�#3�S�$�?��%�%�h�&G�&G�H�%)�%8�%8��9L�9L�%M�"���	
N�rgc��|js |jtj�yd}t	j
tj|d�t|j�D��cgc]\}}||j|�f��}}}tjt|j��}tjtjg}t||||�|_|jj!�ycc}}w)z0Opens a dialog with a list of the notifications.Tz2NOTIFICATION PRESENTER: Showing notification list.)rr\rr]rr!r"�reversedrYr	�notifications_countr.�NOTIFICATIONS_COLUMN_HEADER�NOTIFICATIONS_RECEIVED_TIME�NotificationListGUIr�show_gui)	rr^r_r'r1rT�rows�title�column_headerss	         rrDz-NotificationPresenter._show_notification_lists����"�"��!�!�(�"C�"C�D��B��
���5�+�+�S�$�7�/7�t�7J�7J�.K�M�*����$�3�3�I�>�?�M��M��-�-�c�$�2E�2E�.F�G��#�?�?�#�?�?�A��'���~�t�L��	��	�	������Ms�,Dc��d|_y)z1Handler for the 'destroyed' signal of the dialog.N)rrs r�on_dialog_destroyedz)NotificationPresenter.on_dialog_destroyeds����	r)FT)F�N)�__name__�
__module__�__qualname__�__doc__rr(rr4r7r*r#rYr>rBr@rDru�rrrr0sI��6�!�
��;�!�8�8"8�H&� � �@�@�&rrc�(�eZdZdZd�Zd�Zd�Zd�Zy)roz-The dialog containing the notifications list.c�P�||_d|_|j|||�|_yrv)�_script�_model�_create_dialogr)rr^rrrsrqs     rrzNotificationListGUI.__init__"s&���������'�'��~�t�D��	rc	��tj|dtjjtjtj
jtjtj
jf�}|jdd�tj�}|j�}|j|�tj�}|j|�tj�}|jd�|j!d�|j|�t#|�t$j&gz}	t)|�D]V\}
}tj*�}tj,|||
��}
|j/|
�|s�F|
j1|
��Xtj2|	�|_|D]M}|j4j7d�}t)|�D]"\}
}|j4j9||
|��$�O|j;|j4�|j=d|j>�|S)NiXi�T)�text�response) r�Dialog�DialogFlags�MODAL�STOCK_CLEAR�ResponseType�APPLY�STOCK_CLOSE�CLOSE�set_default_size�Grid�get_content_arearH�ScrolledWindow�TreeView�set_hexpand�set_vexpandr.r�TYPE_STRING�	enumerate�CellRendererText�TreeViewColumn�
append_column�set_sort_column_id�	ListStorerr/�	set_value�	set_model�connect�on_response)rrrrsrq�dialog�grid�content_area�scrolled_window�tree�cols�i�header�cell�column�row�row_iters                rr�z"NotificationListGUI._create_dialog's������E� ��O�O�1�1� �_�_�c�.>�.>�.D�.D� �_�_�c�.>�.>�.D�.D�F�G��
	����S�)��x�x�z���.�.�0��������,�,�.������!��|�|�~���������������D�!��>�"�g�&9�&9�%:�:��"�>�2�	-�I�A�v��'�'�)�D��'�'���1�=�F����v�&���)�)�!�,�	-��m�m�T�*����	9�C��{�{�)�)�$�/�H�$�S�>�
9���4����%�%�h��4�8�
9�	9�
	
���t�{�{�#����z�4�#3�#3�4��
rc���|tjjk(r|jj	�y|tjj
k(r�|j��|jj�t�j�|jjtj�tjd�|jj	�yyy)z&The handler for the 'response' signal.Nr)rr�r�r�destroyr�r�clear�getPresenterr7r~r\rr]r0�sleep)rr�r�s   rr�zNotificationListGUI.on_responseMs����s�'�'�-�-�-��I�I������s�'�'�-�-�-�$�+�+�2I��K�K�����N�%�%�'��L�L�'�'��(I�(I�J��J�J�q�M��I�I����3J�-rc���|jj�tjj}|dk(rtj�}|jj|�y)z$Shows the notifications list dialog.rN)r�show_allr
�lastInputEventrTr�get_current_event_time�present_with_time)r�
time_stamps  rrpzNotificationListGUI.show_gui[sL��	
�	�	�����.�.�8�8�
���?��3�3�5�J��	�	�#�#�J�/rN)rwrxryrzrr�r�rpr{rrroros��7�E�
$�L �0rroc��tS)z"Returns the Notification Presenter)�
_presenterr{rrr�r�es
���r)rz�__id__�__version__�__date__�
__copyright__�__license__r0�gi�require_version�
gi.repositoryrrrGrrr	r
rrr
rror�r�r{rr�<module>r�s���0'�������@�
����	�����5�%� �!���������m�m�^C0�C0�J#�
$�
�r

Zerion Mini Shell 1.0