%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/DistUpgrade/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/DistUpgrade/__pycache__/ReleaseNotesViewer.cpython-312.pyc

�

>I�c���.�ddlmZddlmZmZmZddlZddlZd�ZGd�dej�Z	e
dk(r`ej�Ze	e
d�j��Zej!e�ej#�ej$�yy)	�)�Pango)�Gtk�GObject�GdkNc� �tjjd�rd|g}nLtjjd�rd|g}n(tjjd�rd|g}nd|g}tj�dk(r,d	tjvrd
dtjd	g|z}nFtj�dk(r/dtjvrd
d
ddtjdzg|z}tj|�y)z#Open the specified URL in a browserz/usr/bin/xdg-openzxdg-openz/usr/bin/exo-openzexo-openz/usr/bin/gnome-openz
gnome-openz
x-www-browserr�	SUDO_USER�sudoz-u�
PKEXEC_UIDz-H�#N)�os�path�exists�getuid�environ�
subprocess�Popen)�url�commands  �@/usr/lib/python3/dist-packages/DistUpgrade/ReleaseNotesViewer.py�open_urlr!s���
�w�w�~�~�)�*��s�#��	�����+�	,��s�#��	�����-�	.���%��"�C�(��	�y�y�{�a��K�2�:�:�5��4����K�!8�9�G�C��	�����	�l�b�j�j�8��4������L�1�1�3�5<�=�����W��c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�ReleaseNotesViewerc�R�tjj|�d|_d|_|j	dd�|jd�|j
tjd��tj�|_|j|j�|jj|�|jd|j�|jd|j �|jd|j"�|j%�y)	z�Init the ReleaseNotesViewer as an Inheritance of the Gtk.TextView.
           Load the notes into the buffer and make links clickableFT�editable�	monospacezbutton-press-eventzmotion-notify-eventzvisibility-notify-eventN)r�__init__�hovering�first�set_property�set_cursor_visible�modify_fontr�FontDescriptionr�
TextBuffer�buffer�
set_buffer�set_text�connect�button_press_event�motion_notify_event�visibility_notify_event�search_links)�self�notess  rrzReleaseNotesViewer.__init__6s���	��� � ��&���
���
����*�e�,�����&�����.�.�{�;�<��n�n�&���������$������U�#����)�4�+B�+B�C����*�D�,D�,D�E����.��0L�0L�M����rc��|jjddtjj��}||_|jj
|||�y)z@Apply the tag that marks links to the specified buffer selectionN�blue)�
foreground�	underline)r%�
create_tagr�	Underline�SINGLEr�	apply_tag)r-�start�endr�tags     r�tag_linkzReleaseNotesViewer.tag_linkKsJ���k�k�$�$�T�f�/4���/E�/E�%�G����������c�5�#�.rc��|jjd�}	|jdtjj
d�}|sy|\}}|j
�}	|j�r|j|�}|dvrnn|j
�}�8|j|�}|j|||�|}��)zlSearch for http URLs in the buffer and call the tag_link method
           for each one to tag them as linksrzhttp://N)� �)�]�
�	)
r%�get_iter_at_offset�forward_searchr�TextSearchFlags�VISIBLE_ONLY�copy�forward_char�get_textr:)r-�iter�ret�match_start�	match_end�	match_tmp�textrs        rr,zReleaseNotesViewer.search_linksRs����{�{�-�-�a�0����%�%�i�&)�&9�&9�&F�&F�&*�,�C���'*�$�[�)�!���(�I���)�)�+�$�-�-�i�8�D��:�:���%�N�N�,�	���&�&�y�1�C��M�M�+�y�#�6��D�1rc��|jdk7ry	|jj�\}}|j�|j�k7ry|jtjjt|j�t|j��\}}|j||�}|j�}|D]!}	t|	dd�}
|
dk7s�t|
�yy#t$rY��wxYw)zcallback for mouse click events�FrN�)�buttonr%�get_selection_bounds�
get_offset�
ValueError�window_to_buffer_coordsr�TextWindowType�WIDGET�int�x�y�get_iter_at_location�get_tags�getattrr)r-�	text_view�eventr7r8rYrZrH�tagsr9rs           rr)z%ReleaseNotesViewer.button_press_eventqs����<�<�1���	��;�;�;�;�=�L�U�C����!�S�^�^�%5�5���-�-�c�.@�.@�.G�.G�.1�%�'�'�l�C����L�J���A��(�(��A�.���}�}����	�C��#�u�d�+�C��b�y���
��		���	��	�s�C.�.	C:�9C:c�>�|jtjjt	|j
�t	|j��\}}|j||�|jtjj�j�y)z{callback for the mouse movement event, that calls the
           check_hovering method with the mouse postition coordiantesF)rUrrVrWrXrYrZ�check_hovering�
get_window�TEXT�get_pointer)r-r^r_rYrZs     rr*z&ReleaseNotesViewer.motion_notify_event�sp���0�0��1C�1C�1J�1J�14�U�W�W��s�5�7�7�|�M���1����A�q�!�����*�*�/�/�0�<�<�>�rc��|jtjj�}|j	�\}}}}|jtjj||�\}}	|j||	�y)z�callback if the widgets gets visible (e.g. moves to the foreground)
           that calls the check_hovering method with the mouse position
           coordinatesF)rcrrVrdrerUrWrb)
r-r^r_�window�screen�wx�wy�mod�bx�bys
          rr+z*ReleaseNotesViewer.visibility_notify_event�sq���%�%�c�&8�&8�&=�&=�>�� &� 2� 2� 4����R���4�4����%�%�r�2�/���R����B��#�rc��d}|j||�}|j�}|D]}t|dd�}|dk7s�d}n||jk7s|jr�d|_||_|jrn|jtjj�jtjjtjj��y|jtjj�jtjjtjj��yy)zRCheck if the mouse is above a tagged link and if yes show
           a hand cursorFrNrPT)r[r\r]rrrcrrVrd�
set_cursorr�Cursor�new�
CursorType�HAND2�LEFT_PTR)r-rYrZ�	_hoveringrHr`r9rs        rrbz!ReleaseNotesViewer.check_hovering�s����	��(�(��A�.���}�}����	�C��#�u�d�+�C��b�y� �	��		���
�
�%�����D�J�%�D�M��}�}����� 2� 2� 7� 7�8�C�C��J�J�N�N�3�>�>�#7�#7�8�:����� 2� 2� 7� 7�8�C�C��J�J�N�N�3�>�>�#:�#:�;�=�*4rN)
�__name__�
__module__�__qualname__rr:r,r)r*r+rb�rrrr5s%���*/��>�6�	�=rr�__main__z"../DistUpgrade/ReleaseAnnouncement)�
gi.repositoryrrrrrrr�TextViewrrv�Window�win�open�read�rv�add�show_all�mainryrr�<module>r�s���6 �+�+�	���(D=����D=�N�z��
�#�*�*�,�C�	�D�!E�F�K�K�M�	N�B��G�G�B�K��L�L�N��C�H�H�J�
r

Zerion Mini Shell 1.0