CasperSecurity

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

o

>I�c��@s�ddlmZddlmZmZmZddlZddlZdd�ZGdd�dej�Z	e
dkrDe��Ze	e
d	����Ze�e�e��e��dSdS)
�)�Pango)�Gtk�GObject�GdkNcCs�tj�d�rd|g}ntj�d�rd|g}ntj�d�r!d|g}nd|g}t��dkr;d	tjvr;d
dtjd	g|}nt��dkrSdtjvrSd
d
ddtjdg|}t�|�dS)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�command�r�@/usr/lib/python3/dist-packages/DistUpgrade/ReleaseNotesViewer.py�open_url!s 


��rc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�ReleaseNotesViewercCs�tj�|�d|_d|_|�dd�|�d�|�t�d��t	�
�|_|�|j�|j�
|�|�d|j�|�d|j�|�d|j�|��dS)	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�notesrrrr6s

zReleaseNotesViewer.__init__cCs0|jjddtjjd�}||_|j�|||�dS)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�tagrrr�tag_linkKs

�zReleaseNotesViewer.tag_linkcCs�|j�d�}	|�dtjjd�}|sdS|\}}|��}	|��r,|�|�}|dvr+nnn|��}q|�|�}|�	|||�|}q)zlSearch for http URLs in the buffer and call the tag_link method
           for each one to tag them as linksr�zhttp://N)� �)�]�
�	)
r!�get_iter_at_offset�forward_searchr�TextSearchFlags�VISIBLE_ONLY�copy�forward_char�get_textr5)r)�iter�ret�match_start�	match_end�	match_tmp�textrrrrr(Rs.�
��

�zReleaseNotesViewer.search_linkscCs�|jdkrdSz	|j��\}}Wn	tyYnw|��|��kr$dS|�tjjt	|j
�t	|j��\}}|�||�}|�
�}|D]}	t|	dd�}
|
dkrTt|
�dSqAdS)zcallback for mouse click eventsr6FrN�)�buttonr!�get_selection_bounds�
ValueError�
get_offset�window_to_buffer_coordsr�TextWindowType�WIDGET�int�x�y�get_iter_at_location�get_tags�getattrr)r)�	text_view�eventr2r3rRrSrC�tagsr4rrrrr%qs*
�
���z%ReleaseNotesViewer.button_press_eventcCsD|�tjjt|j�t|j��\}}|�||�|�tjj	��
�dS)z{callback for the mouse movement event, that calls the
           check_hovering method with the mouse postition coordiantesF)rNrrOrPrQrRrS�check_hovering�
get_window�TEXT�get_pointer)r)rWrXrRrSrrrr&�s
�z&ReleaseNotesViewer.motion_notify_eventc
CsD|�tjj�}|��\}}}}|�tjj||�\}}	|�||	�dS)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[rrOr\r]rNrPrZ)
r)rWrX�window�screen�wx�wy�mod�bx�byrrrr'�s
�z*ReleaseNotesViewer.visibility_notify_eventcCs�d}|�||�}|��}|D]}t|dd�}|dkrd}nq||jks'|jrTd|_||_|jrB|�tjj��	t
j�t
j
j��dS|�tjj��	t
j�t
j
j��dSdS)zRCheck if the mouse is above a tagged link and if yes show
           a hand cursorFrNrIT)rTrUrVrrr[rrOr\�
set_cursorr�Cursor�new�
CursorType�HAND2�LEFT_PTR)r)rRrS�	_hoveringrCrYr4rrrrrZ�s(����z!ReleaseNotesViewer.check_hoveringN)
�__name__�
__module__�__qualname__rr5r(r%r&r'rZrrrrr5s	r�__main__z"../DistUpgrade/ReleaseAnnouncement)�
gi.repositoryrrrrr
rr�TextViewrrl�Window�win�open�read�rv�add�show_all�mainrrrr�<module>s
�
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY