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

�

g
fG���dZdZdZdZdZdZ	ddlZddlZdd	l	m
Z
dd
l	mZddl	mZddl	m
Z
dd
l	mZddl	mZGd�d�Ze�Zd�Zy#e$rdZY�FwxYw)z(Module for presenting system informationz$Id$z
$Revision$z$Date$zyCopyright (c) 2005-2008 Sun Microsystems Inc.Copyright (c) 2016-2024 Igalia, S.L.Copyright (c) 2024 GNOME Foundation Inc.�LGPL�N�)�cmdnames)�debug)�input_event)�keybindings)�messages)�settings_managerc�R�eZdZdZd�Zdd�Zd
d�Zd�Zd�Zdd�Z	dd	�Z
dd
�Zdd�Zy)�SystemInformationPresenterz0Provides commands to present system information.c�b�|jd�|_tj�|_y)NT)�get_handlers�	_handlersr�KeyBindings�	_bindings)�selfs �C/usr/lib/python3/dist-packages/orca/system_information_presenter.py�__init__z#SystemInformationPresenter.__init__2s$���*�*�4�0���$�0�0�2���c��|rCd}tjtj|d�|j�|jS|jj�r|j�|jS)z5Returns the system-information-presenter keybindings.z2SYSTEM INFORMATION PRESENTER: Refreshing bindings.T)r�printMessage�
LEVEL_INFO�_setup_bindingsr�isEmpty)r�refresh�
is_desktop�msgs    r�get_bindingsz'SystemInformationPresenter.get_bindings6sd���F�C����u�/�/��d�;�� � �"��~�~���^�^�
#�
#�
%�� � �"��~�~�rc��|r7d}tjtj|d�|j�|jS)z2Returns the system-information-presenter handlers.z2SYSTEM INFORMATION PRESENTER: Refreshing handlers.T)rrr�_setup_handlersr)rrrs   rrz'SystemInformationPresenter.get_handlersBs:���F�C����u�/�/��d�;�� � �"��~�~�rc�8�i|_tj|jtj
�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|jtj�|jd<d}tjtj|d�y)z>Sets up the system-information-presenter input event handlers.�presentTimeHandler�presentDateHandler�present_battery_status�present_cpu_and_memory_usagez.SYSTEM INFORMATION PRESENTER: Handlers set up.TN)rr�InputEventHandler�present_timer�PRESENT_CURRENT_TIME�present_date�PRESENT_CURRENT_DATEr$�PRESENT_BATTERY_STATUSr%�PRESENT_CPU_AND_MEMORY_USAGErrr�rrs  rr z*SystemInformationPresenter._setup_handlersLs������
�)�)��!�!��-�-�
/�	
���+�,�
�)�)��!�!��-�-�
/�	
���+�,�
�)�)��+�+��/�/�
1�	
���/�0�
�)�)��1�1��5�5�
7�	
���5�6�
?��
���5�+�+�S�$�7rc
��tj�|_|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd�d��|jjtjdtj
tj|jjd�d��d	}tjtj|d
�y)z6Sets up the system-information-presenter key bindings.�tr"rr#��r$r%z.SYSTEM INFORMATION PRESENTER: Bindings set up.TN)rrr�add�
KeyBinding�defaultModifierMask�ORCA_MODIFIER_MASKr�getrrrr-s  rrz*SystemInformationPresenter._setup_bindingshse��%�0�0�2���������"�"���/�/��.�.����"�"�#7�8��
�	�	
������"�"���/�/��.�.����"�"�#7�8��
�	�	
������"�"���/�/��.�.����"�"�#;�<��
�	�	
������"�"���/�/��.�.����"�"�#A�B��
�	�?��
���5�+�+�S�$�7rNc��tj�jd�}|jt	j
|t	j���y)zPresents the current time.�presentTimeFormatT�r
�
getManager�
getSetting�presentMessage�time�strftime�	localtime)r�script�event�time_formats    rr'z'SystemInformationPresenter.present_time��A��'�1�1�3�>�>�?R�S�����d�m�m�K����9I�J�K�rc��tj�jd�}|jt	j
|t	j���y)zPresents the current date.�presentDateFormatTr9)rr@rA�data_formats    rr)z'SystemInformationPresenter.present_date�rCrc��trtj�s |jtj�ytj�}|j
r1tj|jz�dtj��}n0tj|jz�dtj��}|j|�y)zPresents the battery status.T� )
�psutil�sensors_batteryr<r	�BATTERY_STATUS_UNKNOWN�
power_plugged�
BATTERY_LEVEL�percent�BATTERY_PLUGGED_IN_TRUE�BATTERY_PLUGGED_IN_FALSE)rr@rA�batteryrs     rr$z1SystemInformationPresenter.present_battery_status�s����6�1�1�3��!�!�(�"A�"A�B���(�(�*��� � ��+�+�g�o�o�=�>�a��@`�@`�?a�b�C��+�+�g�o�o�=�>�a��@a�@a�?b�c�C����c�"�rc��t� |jtj�yt	tj
��}tj�}t	|j�}|jdkDr1tj|jdz|jdz�}n0tj|jdz|jdz�}tj||fz�d|��}|j|�y)z"Presents the cpu and memory usage.Ti@iz. )
rIr<r	�CPU_AND_MEMORY_USAGE_UNKNOWN�round�cpu_percent�virtual_memoryrN�total�
memoryUsageGB�used�
memoryUsageMB�CPU_AND_MEMORY_USAGE_LEVELS)rr@rA�	cpu_usage�memory�memory_percent�detailsrs        rr%z7SystemInformationPresenter.present_cpu_and_memory_usage�s����>��!�!�(�"G�"G�H���&�,�,�.�/�	��&�&�(���f�n�n�-���<�<�)�#��,�,�V�[�[�I�-F����Xa�Hb�c�G��,�,�V�[�[�I�-F����Xa�Hb�c�G��5�5��N�8S�S�T�TV�W^�V_�`�����c�"�r)FT)F�N)
�__name__�
__module__�__qualname__�__doc__rrrr rr'r)r$r%�rrrr/s3��:�3�
��8�8&8�P��� rrc��tSr`)�
_presenterrerr�getPresenterrh�s���r)rd�__id__�__version__�__date__�
__copyright__�__license__rI�ModuleNotFoundErrorr=r1rrrrr	r
rrgrhrerr�<module>rosy��,/�������;�
������������Q�Q�h(�
)�
���E��
�F��s�A�A�A

Zerion Mini Shell 1.0