]>
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.
5 # 12/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
7 # o Removed wx prefix from class name,
8 # updated reverse renamer
12 sorry no documentation...
18 import wx
.html
as html
20 class PyClickableHtmlWindow(html
.HtmlWindow
):
22 Class for a wxHtmlWindow which responds to clicks on links by opening a
23 browser pointed at that link, and to shift-clicks by copying the link
26 def __init__(self
,parent
,ID
,**kw
):
27 apply(html
.HtmlWindow
.__init
__,(self
,parent
,ID
),kw
)
29 def OnLinkClicked(self
,link
):
30 self
.link
= wx
.TextDataObject(link
.GetHref())
31 if link
.GetEvent().ShiftDown():
32 if wx
.TheClipboard
.Open():
33 wx
.TheClipboard
.SetData(self
.link
)
34 wx
.TheClipboard
.Close()
36 dlg
= wx
.MessageDialog(self
,"Couldn't open clipboard!\n",wx
.OK
)
41 if 0: # Chris's original code...
42 if sys
.platform
not in ["windows",'nt'] :
43 #TODO: A MORE APPROPRIATE COMMAND LINE FOR Linux
44 #[or rather, non-Windows platforms... as of writing,
45 #this MEANS Linux, until wxPython for wxMac comes along...]
46 command
= "/usr/bin/netscape"
49 command
= "%s \"%s\"" % (command
,
53 else: # My alternative
55 webbrowser
.open(link
.GetHref())