]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/ClickableHtmlWindow.py
3 sorry no documentation...
9 from wxPython
.wx
import *
10 from wxPython
.html
import *
12 class wxPyClickableHtmlWindow(wxHtmlWindow
):
14 Class for a wxHtmlWindow which responds to clicks on links by opening a
15 browser pointed at that link, and to shift-clicks by copying the link
18 def __init__(self
,parent
,ID
,**kw
):
19 apply(wxHtmlWindow
.__init
__,(self
,parent
,ID
),kw
)
21 def OnLinkClicked(self
,link
):
22 self
.link
= wxTextDataObject(link
.GetHref())
23 if link
.GetEvent().ShiftDown():
24 if wxTheClipboard
.Open():
25 wxTheClipboard
.SetData(self
.link
)
26 wxTheClipboard
.Close()
28 dlg
= wxMessageDialog(self
,"Couldn't open clipboard!\n",wxOK
)
33 if 0: # Chris's original code...
34 if sys
.platform
not in ["windows",'nt'] :
35 #TODO: A MORE APPROPRIATE COMMAND LINE FOR Linux
36 #[or rather, non-Windows platforms... as of writing,
37 #this MEANS Linux, until wxPython for wxMac comes along...]
38 command
= "/usr/bin/netscape"
41 command
= "%s \"%s\"" % (command
,
45 else: # My alternative
47 webbrowser
.open(link
.GetHref())