Ë
    >I¼cê  ã                   ó.  — d dl mZ d dl mZmZmZ d dlZd dlZd„ Z G d„ dej                  «      Z	e
dk(  r` ej                  «       Z e	 ed«      j                  «       «      Zej!                  e«       ej#                  «         ej$                  «        yy)	é    )ÚPango)ÚGtkÚGObjectÚGdkNc                 ó   — t         j                  j                  d«      rd| g}nLt         j                  j                  d«      rd| g}n(t         j                  j                  d«      rd| g}nd| g}t        j                  «       dk(  r,d	t         j                  v rd
dt         j                  d	   g|z   }nFt        j                  «       dk(  r/dt         j                  v rd
dddt         j                  d   z   g|z   }t        j                  |«       y)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-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   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	y)	ÚReleaseNotesViewerc                 óR  — t         j                   j                  | «       d| _        d| _        | j	                  dd«       | j                  d«       | j                  t        j                  d«      «       t        j                  «       | _        | j                  | j                  «       | j                  j                  |«       | j                  d| j                  «       | j                  d| j                   «       | j                  d| 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Ú	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   zReleaseNotesViewer.__init__6   sÖ   € ô 	�‰× Ñ  Ô&àˆŒØˆŒ
à×Ñ˜* eÔ,Ø×Ñ Ô&Ø×Ñœ×.Ñ.¨{Ó;Ô<Ü—n‘nÓ&ˆŒØ�‰˜Ÿ™Ô$Ø�‰×Ñ˜UÔ#Ø�‰Ð)¨4×+BÑ+BÔCØ�‰Ð*¨D×,DÑ,DÔEØ�‰Ð.°×0LÑ0LÔMà×ÑÕr   c                 ó¸   — | j                   j                  ddt        j                  j                  ¬«      }||_        | j                   j                  |||«       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_linkzReleaseNotesViewer.tag_linkK   sJ   € à�k‰k×$Ñ$ T°fÜ/4¯©×/EÑ/Eð %ó GˆàˆŒØ�‰×Ñ˜c 5¨#Õ.r   c                 ó€  — | j                   j                  d«      }	 |j                  dt        j                  j
                  d«      }|sy|\  }}|j                  «       }	 |j                  «       r|j                  |«      }|dv rnn|j                  «       }Œ8|j                  |«      }| j                  |||«       |}Œ£)zlSearch for http URLs in the buffer and call the tag_link method
           for each one to tag them as linksr   z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,   zReleaseNotesViewer.search_linksR   sÈ   € ð �{‰{×-Ñ-¨aÓ0ˆØà×%Ñ% iÜ&)×&9Ñ&9×&FÑ&FØ&*ó,ˆCñ Øà'*Ñ$ˆ[˜)Ø!Ÿ™Ó(ˆIØà×)Ñ)Ô+Ø$×-Ñ-¨iÓ8�DØÐ:Ñ:ØàØ%ŸN™NÓ,�	ð ð ×&Ñ& yÓ1ˆCØ�M‰M˜+ y°#Ô6àˆDð1 r   c                 óú  — |j                   dk7  ry	 | j                  j                  «       \  }}|j                  «       |j                  «       k7  ry| j                  t        j                  j                  t        |j                  «      t        |j                  «      «      \  }}| j                  ||«      }|j                  «       }|D ]!  }	t        |	dd«      }
|
dk7  sŒt        |
«        y y# t        $ r Y Œ¨w xY w)zcallback for mouse click eventsé   Fr   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Úeventr7   r8   rY   rZ   rH   Útagsr9   r   s              r   r)   z%ReleaseNotesViewer.button_press_eventq   sä   € à�<‰<˜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:Ã9C:c                 ó>  — |j                  t        j                  j                  t	        |j
                  «      t	        |j                  «      «      \  }}| j                  ||«       | j                  t        j                  j                  «      j                  «        y)z{callback for the mouse movement event, that calls the
           check_hovering method with the mouse postition coordiantesF)rU   r   rV   rW   rX   rY   rZ   Úcheck_hoveringÚ
get_windowÚTEXTÚget_pointer)r-   r^   r_   rY   rZ   s        r   r*   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×<Ñ<Ô>Ør   c                 ó   — |j                  t        j                  j                  «      }|j	                  «       \  }}}}|j                  t        j                  j                  ||«      \  }}	| 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)rc   r   rV   rd   re   rU   rW   rb   )
r-   r^   r_   ÚwindowÚscreenÚwxÚwyÚmodÚbxÚbys
             r   r+   z*ReleaseNotesViewer.visibility_notify_event•   sq   € ð ×%Ñ%¤c×&8Ñ&8×&=Ñ&=Ó>ˆØ &× 2Ñ 2Ó 4Ñˆ��R˜Ø×4Ñ4Ü×Ñ×%Ñ% r¨2ó/‰ˆˆRà×Ñ˜B Ô#Ør   c                 ó¨  — d}| j                  ||«      }|j                  «       }|D ]  }t        |dd«      }|dk7  sŒd} n || j                  k7  s| j                  röd| _        || _        | j                  rn| j                  t        j                  j                  «      j                  t        j                  j                  t        j                  j                  «      «       y| j                  t        j                  j                  «      j                  t        j                  j                  t        j                  j                  «      «       yy)zRCheck if the mouse is above a tagged link and if yes show
           a hand cursorFr   NrP   T)r[   r\   r]   r   r   rc   r   rV   rd   Ú
set_cursorr   ÚCursorÚnewÚ
CursorTypeÚHAND2ÚLEFT_PTR)r-   rY   rZ   Ú	_hoveringrH   r`   r9   r   s           r   rb   z!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§>¡>×#:Ñ#:Ó;õ=ð *4r   N)
Ú__name__Ú
__module__Ú__qualname__r   r:   r,   r)   r*   r+   rb   © r   r   r   r   5   s%   „ òò*/òò>ò6ò	ó=r   r   Ú__main__z"../DistUpgrade/ReleaseAnnouncement)Úgi.repositoryr   r   r   r   r   r   r   ÚTextViewr   rv   ÚWindowÚwinÚopenÚreadÚrvÚaddÚshow_allÚmainry   r   r   ú<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   