/usr/lib/python3/dist-packages/DistUpgrade/__pycache__
Edit: /usr/lib/python3/dist-packages/DistUpgrade/__pycache__/ReleaseNotesViewer.cpython-310.pyc (5015B)
o
>Ic @ s d dl mZ d dl mZmZmZ d dlZd dlZdd ZG dd dejZ e
dkrDe Ze e
d Zee e e dS dS )
)Pango)GtkGObjectGdkNc C s t jdrd| g}nt jdrd| g}nt jdr!d| g}nd| g}t dkr;d t jv r;d
dt jd g| }nt dkrSdt jv rSd
d
ddt jd 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_USERsudoz-u
PKEXEC_UIDz-H#N)ospathexistsgetuidenviron
subprocessPopen)urlcommand r @/usr/lib/python3/dist-packages/DistUpgrade/ReleaseNotesViewer.pyopen_url! s
r c @ sD e Zd Zdd Zdd Zdd Zdd Zd d
Zdd Zd
d Z dS )ReleaseNotesViewerc C s t j | d| _d| _| dd | d | td t
| _| | j | j
| | d| j | d| j | d| j | dS ) zInit the ReleaseNotesViewer as an Inheritance of the Gtk.TextView.
Load the notes into the buffer and make links clickableFTeditable monospacezbutton-press-eventzmotion-notify-eventzvisibility-notify-eventN)r __init__hoveringfirstset_propertyset_cursor_visiblemodify_fontr FontDescriptionr
TextBufferbuffer
set_bufferset_textconnectbutton_press_eventmotion_notify_eventvisibility_notify_eventsearch_links)selfnotesr r r r 6 s
zReleaseNotesViewer.__init__c C s0 | j jddtjjd}||_| j ||| dS )z@Apply the tag that marks links to the specified buffer selectionNblue)
foreground underline)r!
create_tagr UnderlineSINGLEr apply_tag)r) startendr tagr r r tag_linkK s
zReleaseNotesViewer.tag_linkc C s | j d} |dtjjd}|sdS |\}}| } | r,||}|dv r+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_offsetforward_searchr TextSearchFlagsVISIBLE_ONLYcopyforward_charget_textr5 )r) iterretmatch_start match_end match_tmptextr r r r r( R s.
zReleaseNotesViewer.search_linksc C s |j dkrdS z | j \}}W n ty Y nw | | kr$dS | tjjt |j
t |j\}}| ||}|
}|D ]} t| dd}
|
dkrTt|
dS qAdS )zcallback for mouse click eventsr6 Fr N )buttonr! get_selection_bounds
ValueError
get_offsetwindow_to_buffer_coordsr TextWindowTypeWIDGETintxyget_iter_at_locationget_tagsgetattrr )r) text_vieweventr2 r3 rR rS rC tagsr4 r r r r r% q s*
z%ReleaseNotesViewer.button_press_eventc C sD | tjjt|jt|j\}}| || | tjj
dS )z{callback for the mouse movement event, that calls the
check_hovering method with the mouse postition coordiantesF)rN r rO rP rQ rR rS check_hovering
get_windowTEXTget_pointer)r) rW rX rR rS r r r r&