%PDF- %PDF-
Mini Shell

Mini Shell

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

�

QKf'/����ddlZejdd�ddlmZddlmZddlmZddlmZddlmZdd	l	m
Z
Gd
�dej�Ze
dk(r�ej�Ze�Zej#�Zej'd
ej(j*��ej-d�ej/e�ej1�ej2�yy)�N�Gtkz3.0)r)�Gdk)�GObject)�Pango)�gettext)�open_urlc�D�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zy)�ChangelogViewerNc���tjj|�d|_d|_|j	dd�|jd�|j
d�|jd�|jd�|jd�tj�|_|j|j�|jd|j�|jd|j �|jd|j"�|jj%d|j&�|�|jj)|�y	y	)
z>Init the ChangelogViewer as an Inheritance of the Gtk.TextViewFT�editable�zbutton-press-eventzmotion-notify-eventzvisibility-notify-eventzinsert-textN)r�__init__�hovering�first�set_property�set_cursor_visible�set_right_margin�set_left_margin�set_pixels_above_lines�set_vexpandr�
TextBuffer�buffer�
set_buffer�connect�button_press_event�motion_notify_event�visibility_notify_event�
connect_after�on_insert_text�set_text)�self�	changelogs  �?/usr/lib/python3/dist-packages/UpdateManager/ChangelogViewer.pyrzChangelogViewer.__init__*s��	��� � ��&���
���
����*�e�,�����&����a� ����Q���#�#�A�&�������n�n�&���������$����)�4�+B�+B�C����*�D�,D�,D�E����.��0L�0L�M����!�!�-��1D�1D�E�� ��K�K� � ��+�!�c� �tj�|_tj�}|j	|�|jd|jd|�tj�}tj�}|j	td��|jd|jd|�tj�}|j	td��|jd|jd|�|jj|�|jj|�|jj|�|jj|�|jj�y)zLCreate the context menu to be displayed when links are right
        clicked�activate�openzOpen Link in BrowserzCopy Link to Clipboard�copyN)
r�Menu�menu�MenuItem�	set_labelr�handle_context_menu�_�add�show_all)r!�url�item_grey_link�item_seperator�item_open_link�item_copy_links      r#�create_context_menuz#ChangelogViewer.create_context_menuEs"���H�H�J��	������� � ��%������0�0�&�#�	
������������ � ��#9�!:�;������0�0�&�#�	
������� � ��#;�!<�=������0�0�&�#�	
�
	
�	�	�
�
�n�%��	�	�
�
�n�%��	�	�
�
�n�%��	�	�
�
�n�%��	�	���r$c�0�|dk(rt|�|dk(r�tjj�}tjjdd�}tjj||�}|j|d�|j�yy)z1Handle activate event for the links' context menur'r(�	CLIPBOARDF���N)rr�Display�get_default�Atom�internr�	Clipboard�get_for_displayr �store)r!�menuitem�actionr1�display�	selection�cbs       r#r-z#ChangelogViewer.handle_context_menucss���V���S�M��V��
�k�k�-�-�/�G�������U�;�I����.�.�w�	�B�B��K�K��R� ��H�H�J�r$c��|j�}|D]}t|dd�}|dk7s�y|jjddtj
j��}||_|jj|||�y)z@Apply the tag that marks links to the specified buffer selectionr1N��blue)�
foreground�	underline)	�get_tags�getattrr�
create_tagr�	Underline�SINGLEr1�	apply_tag)r!�start�endr1�tags�tags      r#�tag_linkzChangelogViewer.tag_linkrs����~�~����	�C��#�u�d�+�C��b�y��	��k�k�$�$��V�u���/E�/E�%�
����������c�5�#�.r$c���d}d}d}gd�}gd�}	gd�}
dg|
z}dg}d	||	z|
z|zd	fd
||	z|z|fd||	z|z|fd||	z|z|fd
||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fd||	z|z|fg}
|
D�]\}}}|j|j�t|�z
�}	|j|tj
j|�}|s�b|\}}|j�}|j�}	|j�rM|j|�}||vrnI|j�|j|�}||vrn#|j�nn|j�}�o||j|�z}|j|||�|}��y)zLSearch for http URLs in newly inserted text
        and tag them accordinglyzhttps://launchpad.net/bugs/zhttp://bugs.debian.org/z2http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-)� �	�
)�)�]�>)�,�!�:�.z.
zhttp://zLP#zlp#zLP: #zlp: #zLP:#zlp:#z	Malone: #zMalone:#z	Ubuntu: #zUbuntu:#z	Closes: #zCloses:#zcloses:#z	closes: #zCVE-N)�get_iter_at_offset�
get_offset�len�forward_searchr�TextSearchFlags�VISIBLE_ONLYr(�forward_char�get_text�
backward_charrU)r!r�iter_end�content�args�MALONE�DEBIAN�CVE�ws�brak�punct�dot�dot_cr�search_items�	start_str�end_list�
url_prefix�iter�ret�match_start�	match_end�match_suffix�	match_tmp�textr1s                         r#rzChangelogViewer.on_insert_texts���
/��*��B��
�������e�e�m�������T�	�E�)�F�2�I�>�
�B��I��O�V�,�
�B��I��O�V�,�
�b�4�i�#�o�v�.�
�b�4�i�#�o�v�.�
�R�$�Y��_�f�-�
�R�$�Y��_�f�-�
�"�t�)�c�/�6�2�
��d��S��&�1�
�"�t�)�c�/�6�2�
��d��S��&�1�
�"�t�)�c�/�6�2�
��d��S��&�1�
��d��S��&�1�
�"�t�)�c�/�6�2�
�R�$�Y��_�c�*�!
��(2>�&	!�-�Y��*��,�,��#�#�%��G��4��D���)�)��s�2�2�?�?������+.�(��i�(�~�~�/��%�N�N�,�	�� �-�-�/�(�1�1�)�<���8�+�!�"�.�.�0�(�1�1�)�<���8�+�!�!�/�/�1�� )��� 0�I��$!�<�#8�#8��#C�C���
�
�k�9�c�:� ��C�&	!r$c	�l�|jdk7r|jdk7ry	|jj�\}}|j�|j�k7ry|jtjjt|j�t|j��\}}	|j||�}|j�}|D]�}
t|
d�s�|jdk(rt!|
j"�y|jdk(s�F|j%|
j"�|j&j)dddd|j|j*�yy#t$rY��wxYw#t$r(|j||�\}	}|j�}Y��wxYw)zcallback for mouse click events��Fr1NT)�buttonr�get_selection_boundsrb�
ValueError�window_to_buffer_coordsr�TextWindowType�WIDGET�int�x�y�get_iter_at_locationrK�AttributeError�hasattrrr1r6r*�popup�time)r!�	text_view�eventrQrRr�r�ryrS�	over_textrTs           r#rz"ChangelogViewer.button_press_event�su���<�<�1������!2��	��;�;�;�;�=�L�U�C����!�S�^�^�%5�5���-�-����%�%�s�5�7�7�|�S����\�
���A�	#��,�,�Q��2�D��=�=�?�D��
	 �C��s�E�"��<�<�1�$��S�W�W�%���<�<�1�$��,�,�S�W�W�5��I�I�O�O��d�D�$����e�j�j�� �
	 ��'�	��	���	#� $� 9� 9�!�Q� ?��Y���=�=�?�D�	#�s#�E2�5"F�2	E?�>E?�.F3�2F3c�>�|jtjjt	|j
�t	|j��\}}|j||�|jtjj�j�y)zxcallback for the mouse movement event, that calls the
        check_hovering method with the mouse postition coordiantesF)r�rr�r�r�r�r��check_hovering�
get_window�TEXT�get_pointer)r!r�r�r�r�s     r#rz#ChangelogViewer.motion_notify_event�sq���0�0����%�%�s�5�7�7�|�S����\�
���1�	
���A�q�!�����*�*�/�/�0�<�<�>�r$c��|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)r�rr�r�r�r�r�r�)
r!r�r��window�screen�wx�wy�mod�bx�bys
          r#rz'ChangelogViewer.visibility_notify_eventss���%�%�c�&8�&8�&=�&=�>�� &� 2� 2� 4����R���4�4����%�%�r�2�
���R�	
���B��#�r$c��d}	|j||�}|j�}|D]}t|d�s�d}n||jk7s|j
r�d|_||_|jrn|j
tjj�jtjjtjj��y|j
tjj�jtjjtjj ��yy#t$r)|j||�\}}|j�}Y��ZwxYw)zOCheck if the mouse is above a tagged link and if yes show
        a hand cursorFr1TN)r�rKr�r�rrr�rr�r��
set_cursorr�Cursor�new�
CursorType�HAND2�LEFT_PTR)r!r�r��	_hoveringryrSr�rTs        r#r�zChangelogViewer.check_hoverings+���	�	#��,�,�Q��2�D��=�=�?�D��	�C��s�E�"� �	��	���
�
�%�����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�>�>�#:�#:�;��*4���	#� $� 9� 9�!�Q� ?��Y���=�=�?�D�	#�s�"E�.F�F)N)�__name__�
__module__�__qualname__rr6r-rUrrrrr��r$r#r
r
)s2��,�6�<
�/�M!�^& �P�
�r$r
�__main__�
versiontag)�weightz�

Version 6-14-0ubuntu1.9.04:

  * New upstream version. LP: #382918.
    Release notes at http://java.sun.com/javase/6/webnotes/ReleaseNotes.html.

)�gi�require_version�
gi.repositoryrrrrrr.�DistUpgrade.ReleaseNotesViewerr�TextViewr
r��Window�w�cv�
get_buffer�changesrM�Weight�BOLDr r/r0�mainr�r$r#�<module>r�s���:
�����5�%� ���!�� �3�B�c�l�l�B�J�z����
�
��A�	�	�B��m�m�o�G����|�E�L�L�,=�,=��>����	�	��E�E�"�I��J�J�L��C�H�H�J�%r$

Zerion Mini Shell 1.0