]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/ClickableHtmlWindow.py
1 # 12/01/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace. Not tested though.
7 sorry no documentation...
13 import wx
.html
as html
15 class wxPyClickableHtmlWindow(html
.HtmlWindow
):
17 Class for a wxHtmlWindow which responds to clicks on links by opening a
18 browser pointed at that link, and to shift-clicks by copying the link
21 def __init__(self
,parent
,ID
,**kw
):
22 apply(html
.HtmlWindow
.__init
__,(self
,parent
,ID
),kw
)
24 def OnLinkClicked(self
,link
):
25 self
.link
= wx
.TextDataObject(link
.GetHref())
26 if link
.GetEvent().ShiftDown():
27 if wx
.TheClipboard
.Open():
28 wx
.TheClipboard
.SetData(self
.link
)
29 wx
.TheClipboard
.Close()
31 dlg
= wx
.MessageDialog(self
,"Couldn't open clipboard!\n",wx
.OK
)
36 if 0: # Chris's original code...
37 if sys
.platform
not in ["windows",'nt'] :
38 #TODO: A MORE APPROPRIATE COMMAND LINE FOR Linux
39 #[or rather, non-Windows platforms... as of writing,
40 #this MEANS Linux, until wxPython for wxMac comes along...]
41 command
= "/usr/bin/netscape"
44 command
= "%s \"%s\"" % (command
,
48 else: # My alternative
50 webbrowser
.open(link
.GetHref())