+
    j                     f    ^ RI Ht ^ RI HtHtHt ^ RIt^ RItR t ! R R]P                  4      t	R# )    )Pango)GtkGObjectGdkNc                   \         P                  P                  R4      '       d   RV .pMX\         P                  P                  R4      '       d   RV .pM.\         P                  P                  R4      '       d   RV .pMRV .p\         P                  ! 4       ^ 8X  d8   R\         P                  9   d#   R	R
\         P                  R,          .V,           pMX\         P                  ! 4       ^ 8X  d?   R\         P                  9   d*   R	RR
R\         P                  R,          ,           .V,           p\
        P                  ! V4       R# )z#Open the specified URL in a browserz/usr/bin/xdg-openzxdg-openz/usr/bin/exo-openzexo-openz/usr/bin/gnome-openz
gnome-openzx-www-browser	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     
ww~~)**s#	+	,	,s#	-	.	.%"C(	yy{aK2::54K!89GC		lbjj84L1135<=W    c                   J   a  ] tR t^5t o R tR tR tR tR tR t	R t
RtV tR	# )
ReleaseNotesViewerc                X   \         P                   P                  V 4       RV n        RV n        V P	                  RR4       V P                  R4       V P                  \        P                  ! R4      4       \        P                  ! 4       V n        V P                  V P                  4       V P                  P                  V4       V P                  RV P                  4       V P                  RV P                   4       V P                  RV P"                  4       V P%                  4        R# )	zzInit the ReleaseNotesViewer as an Inheritance of the Gtk.TextView.
Load the notes into the buffer and make links clickableFTeditable	monospacezbutton-press-eventzmotion-notify-eventzvisibility-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   &&r   r   ReleaseNotesViewer.__init__6   s     	  &
*e,&..{;<nn&$U#)4+B+BC*D,D,DE.0L0LMr   c                    V P                   P                  RR\        P                  P                  R7      pW4n        V P                   P                  WAV4       R# )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_linkReleaseNotesViewer.tag_linkK   sF    kk$$Tf/4/E/E % Gc#.r   c                   V P                   P                  ^ 4      p VP                  R\        P                  P
                  R4      pV'       g   R# Vw  r4VP                  4       p VP                  4       '       d   VP                  V4      pVR9   d   MMMVP                  4       pKD  VP                  V4      pV P                  W4V4       TpK  )zaSearch for http URLs in the buffer and call the tag_link method
for each one to tag them as linkszhttp://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textr   s   &       r   r,   ReleaseNotesViewer.search_linksR   s     {{--a0%%i&)&9&9&F&F&*,C '*$[!(I))++$--i8D:: ; %NN,	&&y1CMM+#6Dr   c                   VP                   ^8w  d   R#  V P                  P                  4       w  r4VP                  4       VP                  4       8w  d   R#  V P                  \        P                  P                  \        VP                  4      \        VP                  4      4      w  rVV P                  WV4      pVP                  4       pV F%  p	\        V	RR4      p
V
R8w  g   K  \        V
4        R# 	  R#   \         d     Li ; i)zcallback for mouse click eventsFr   N )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eventr8   r9   r[   r\   rJ   tagsr:   r   s   &&&        r   r)   %ReleaseNotesViewer.button_press_eventq   s    <<1	;;;;=LU !S^^%55 6 --c.@.@.G.G.1%''lCLJ((. }}C#ud+Cby	   		s   C8 8DDc                <   VP                  \        P                  P                  \	        VP
                  4      \	        VP                  4      4      w  r4V P                  W44       V P                  \        P                  P                  4      P                  4        R# )zpcallback for the mouse movement event, that calls the
check_hovering method with the mouse postition coordiantesF)rW   r   rX   rY   rZ   r[   r\   check_hovering
get_windowTEXTget_pointer)r-   r`   ra   r[   r\   s   &&&  r   r*   &ReleaseNotesViewer.motion_notify_event   sl     001C1C1J1J14UWWs577|MA!**//0<<>r   c                    VP                  \        P                  P                  4      pVP	                  4       w  rErgVP                  \        P                  P                  WV4      w  rV P                  W4       R# )zcallback if the widgets gets visible (e.g. moves to the foreground)
that calls the check_hovering method with the mouse position
coordinatesF)rf   r   rX   rg   rh   rW   rY   re   )
r-   r`   ra   windowscreenwxwymodbxbys
   &&&       r   r+   *ReleaseNotesViewer.visibility_notify_event   sg     %%c&8&8&=&=> & 2 2 4R44%%r/B#r   c                   RpV P                  W4      pVP                  4       pV F  p\        VRR4      pVR8w  g   K  Rp M	  W0P                  8w  g   V P                  '       d   RV n        W0n        V P                  '       dp   V P                  \        P                  P                  4      P                  \        P                  P                  \        P                  P                  4      4       R# V P                  \        P                  P                  4      P                  \        P                  P                  \        P                  P                  4      4       R# R# )zGCheck if the mouse is above a tagged link and if yes show
a hand cursorFr   NrR   T)r]   r^   r_   r   r   rf   r   rX   rg   
set_cursorr   Cursornew
CursorTypeHAND2LEFT_PTR)r-   r[   r\   	_hoveringrJ   rb   r:   r   s   &&&     r   re   !ReleaseNotesViewer.check_hovering   s     	((. }}C#ud+Cby 		  %DJ%M}}} 2 2 7 78CCJJNN3>>#7#78:  2 2 7 78CCJJNN3>>#:#:;= *4r   )r%   r   r   N)__name__
__module____qualname____firstlineno__r   r;   r,   r)   r*   r+   re   __static_attributes____classdictcell__)__classdict__s   @r   r   r   5   s-     */>6	= =r   r   )
gi.repositoryr   r   r   r   r   r   r   TextViewr    r   r   <module>r      s-   6   + + 	 (D= D=r   