KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/lib64/pygtk/2.0/demos/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/pygtk/2.0/demos/hypertext.pyc
mò
e‡8Hc@sVdZdkZdkZdeifd„ƒYZd„ZedjoeƒndS(søText Widget/Hypertext

Usually, tags modify the appearance of text in the view, e.g. making it
bold or colored or underlined. But tags are not restricted to appearance.
They can also affect the behavior of mouse and key presses, as this demo
shows.Nt
HypertextDemocBs’tZeZeiieiiƒZeiieii	ƒZ
dd„Zd„Z
d„Zd„Zd„Zd„Zd„Zd„Zd	„ZRS(
NcCsNtii|ƒy|i|iƒƒWn&tj
o|idd„ƒnX|i	|i
iƒ|iddƒ|i
dƒtiƒ}|itiƒ|id|iƒ|id|iƒ|id|iƒ|id|iƒ|iƒ}tiƒ}|ititiƒ|i|ƒ|i|ƒ|i|d	ƒ|iƒdS(
NtdestroycGs
tiƒS(N(tgtkt	main_quit(tw((t'/usr/lib64/pygtk/2.0/demos/hypertext.pyt<lambda>siÂiskey-press-eventsevent-aftersmotion-notify-eventsvisibility-notify-eventi(RtWindowt__init__tselft
set_screentparentt
get_screentAttributeErrortconnectt	set_titlet	__class__t__name__tset_default_sizetset_border_widthtTextViewtviewt
set_wrap_modet	WRAP_WORDtkey_press_eventtevent_aftertmotion_notify_eventtvisibility_notify_eventt
get_buffertbuffertScrolledWindowtswt
set_policytPOLICY_AUTOMATICtaddt	show_pagetshow_all(R	RRRR((RRs*


cCse|itiijp|itiijo5|iƒ}|i	|i
ƒƒ}|i
||ƒntS(N(teventtkeyvalRtgdktReturntKP_Entert	text_viewRRtget_iter_at_markt
get_inserttiterR	tfollow_if_linktFalse(R	R*R%RR-((RR0s
,c	Cså|itiijotSn|idjotSn|iƒ}y|i
ƒ\}}Wnt
j
on#X|iƒ|iƒjotSn|itit|iƒt|iƒƒ\}}|i||ƒ}|i||ƒtS(Ni(R%ttypeRR'tBUTTON_RELEASER/tbuttonR*RRtget_selection_boundststarttendt
ValueErrort
get_offsettwindow_to_buffer_coordstTEXT_WINDOW_WIDGETtinttxtytget_iter_at_locationR-R	R.(	R	R*R%RR-R4R;R<R5((RR9s $c
CsÏt}|iƒ}|i||ƒ}|i	ƒ}x5|D]-}	|	idƒ}|djot}Pq7q7W||ijo
||_n|io |itiƒi|iƒn|itiƒi|iƒdS(Ntpagei(R/thoveringR*RRR=R;R<R-tget_tagsttagsttagtget_dataR>tTrueR	thovering_over_linkt
get_windowRtTEXT_WINDOW_TEXTt
set_cursorthand_cursortregular_cursor(
R	R*R;R<RARR-R>R?RB((Rtset_cursor_if_appropriateUs
	

 cCsT|itit|iƒt|iƒƒ\}}|i	|||ƒ|i
iƒtS(N(
R*R8RR9R:R%R;R<R	RKtwindowtget_pointerR/(R	R*R%R<R;((RRks
$
cCsM|iiƒ\}}}|iti||ƒ\}}|i|||ƒt
S(N(R*RLRMtwxtwytmodR8RR9tbxtbyR	RKR/(R	R*R%RRRNRQRORP((RRtscCsE|iddddtiƒ}|id|ƒ|i|||ƒdS(sû Inserts a piece of text into the buffer, giving it the usual
            appearance of a hyperlink in a web browser: blue and underlined.
            Additionally, attaches some data on the tag, to make it recognizable
            as a link.
        t
foregroundtbluet	underlineR>N(Rt
create_tagtNonetpangotUNDERLINE_SINGLERBtset_dataR>tinsert_with_tagsR-ttext(R	RR-R\R>RB((Rtinsert_link{s
	cCs,|iddƒ|idƒ}|djo`|i|dƒ|i||ddƒ|i|dƒ|i||dd	ƒ|i|d
ƒn|d	jo-|i|ddƒ|i||d
dƒnc|djoU|iddt
iƒ}|i
|d|ƒ|i|dƒ|i||d
dƒndS(s™ Fills the buffer with text and interspersed links. In any real
            hypertext app, this method would parse a file to identify the links.
        tiisSome text to show that simple t	hypertextis can easily be realized with RAit.swA tag is an attribute that can be applied to some range of text. For example, a tag might be called "bold" and make the text inside the tag bold. However, the tag concept is more general than that tags don't have to affect appearance. They can instead affect the behavior of mouse and key presses, "lock" a range of text so the user can't edit it, or countless other things.
iÿÿÿÿsGo backtweightshypertext:
srmachine-readable text that is not sequential but is organized so that related items of information are connected.
N(Rtset_texttget_iter_at_offsetR-R>tinsertR	R]RVRWRXtWEIGHT_BOLDRBR[(R	RR>R-RB((RR#‡s(

	
	cCsX|iƒ}xE|D]=}|idƒ}|djo|i|i	ƒ|ƒPqqWdS(sÆ Looks at all tags covering the position of iter in the text view,
            and if one of them is a link, follow it by showing the page identified
            by the data attached to it.
        R>iN(
R-R@RARBRCR>R	R#R*R(R	R*R-RARBR>((RR.Šs
(Rt
__module__R/RERR'tCursortHAND2RItXTERMRJRWRRRRKRRR]R#R.(((RR
s									cCstƒtiƒdS(N(RRtmain(((RRj³st__main__(t__doc__RRXRRRjR(RjRXRR((Rt?s		Š	


Anon7 - 2021