<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[23962] branches/wx-port-alpha/trunk/WebKit/wx/bindings/python/samples/
simple.py</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/23962">23962</a></dd>
<dt>Author</dt> <dd>kevino</dd>
<dt>Date</dt> <dd>2007-07-03 16:03:33 -0700 (Tue, 03 Jul 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add some more functionality to the basic sample.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#brancheswxportalphatrunkWebKitwxbindingspythonsamplessimplepy">branches/wx-port-alpha/trunk/WebKit/wx/bindings/python/samples/simple.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="brancheswxportalphatrunkWebKitwxbindingspythonsamplessimplepy"></a>
<div class="modfile"><h4>Modified: branches/wx-port-alpha/trunk/WebKit/wx/bindings/python/samples/simple.py (23961 => 23962)</h4>
<pre class="diff"><span>
<span class="info">--- branches/wx-port-alpha/trunk/WebKit/wx/bindings/python/samples/simple.py        2007-07-03 22:51:56 UTC (rev 23961)
+++ branches/wx-port-alpha/trunk/WebKit/wx/bindings/python/samples/simple.py        2007-07-03 23:03:33 UTC (rev 23962)
</span><span class="lines">@@ -1,13 +1,113 @@
</span><span class="cx"> import wx
</span><span class="cx"> import wx.webview
</span><ins>+
+class TestPanel(wx.Panel):
+ def __init__(self, parent, log, frame=None):
+ wx.Panel.__init__(
+ self, parent, -1,
+ style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN|wx.NO_FULL_REPAINT_ON_RESIZE
+ )
+
+ self.log = log
+ self.current = "http://wxPython.org/"
+ self.frame = frame
</ins><span class="cx">
</span><ins>+ if frame:
+ self.titleBase = frame.GetTitle()
+
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+
+ self.webview = wx.webview.WebView(self, -1)
+
+
+ btn = wx.Button(self, -1, "Open", style=wx.BU_EXACTFIT)
+ self.Bind(wx.EVT_BUTTON, self.OnOpenButton, btn)
+ btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
+
+ btn = wx.Button(self, -1, "<--", style=wx.BU_EXACTFIT)
+ self.Bind(wx.EVT_BUTTON, self.OnPrevPageButton, btn)
+ btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
+
+ btn = wx.Button(self, -1, "-->", style=wx.BU_EXACTFIT)
+ self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, btn)
+ btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
+
+ btn = wx.Button(self, -1, "Stop", style=wx.BU_EXACTFIT)
+ self.Bind(wx.EVT_BUTTON, self.OnStopButton, btn)
+ btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
+
+ btn = wx.Button(self, -1, "Refresh", style=wx.BU_EXACTFIT)
+ self.Bind(wx.EVT_BUTTON, self.OnRefreshPageButton, btn)
+ btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
+
+ txt = wx.StaticText(self, -1, "Location:")
+ btnSizer.Add(txt, 0, wx.CENTER|wx.ALL, 2)
+
+ self.location = wx.ComboBox(
+ self, -1, "", style=wx.CB_DROPDOWN|wx.PROCESS_ENTER
+ )
+
+ self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, self.location)
+ self.location.Bind(wx.EVT_KEY_UP, self.OnLocationKey)
+ self.location.Bind(wx.EVT_CHAR, self.IgnoreReturn)
+ btnSizer.Add(self.location, 1, wx.EXPAND|wx.ALL, 2)
+
+ sizer.Add(btnSizer, 0, wx.EXPAND)
+ sizer.Add(self.webview, 1, wx.EXPAND)
+
+ self.webview.LoadURL(self.current)
+ self.location.Append(self.current)
+
+ self.SetSizer(sizer)
+
+ def OnLocationKey(self, evt):
+ if evt.GetKeyCode() == wx.WXK_RETURN:
+ URL = self.location.GetValue()
+ self.location.Append(URL)
+ self.webview.LoadURL(URL)
+ else:
+ evt.Skip()
+
+ def IgnoreReturn(self, evt):
+ if evt.GetKeyCode() != wx.WXK_RETURN:
+ evt.Skip()
+
+ def OnLocationSelect(self, evt):
+ url = self.location.GetStringSelection()
+ self.webview.LoadURL(url)
+
+ def OnOpenButton(self, event):
+ dlg = wx.TextEntryDialog(self, "Open Location",
+ "Enter a full URL or local path",
+ self.current, wx.OK|wx.CANCEL)
+ dlg.CentreOnParent()
+
+ if dlg.ShowModal() == wx.ID_OK:
+ self.current = dlg.GetValue()
+ self.webview.LoadURL(self.current)
+
+ dlg.Destroy()
+
+ def OnPrevPageButton(self, event):
+ self.webview.GoBack()
+
+ def OnNextPageButton(self, event):
+ self.webview.GoForward()
+
+ def OnStopButton(self, evt):
+ self.webview.Stop()
+
+ def OnRefreshPageButton(self, evt):
+ self.webview.Reload()
+
+
</ins><span class="cx"> class wkFrame(wx.Frame):
</span><span class="cx"> def __init__(self):
</span><span class="cx"> wx.Frame.__init__(self, None, -1, "WebKit in wxPython!")
</span><span class="cx">
</span><del>- self.webkit = wx.webview.WebView(self, -1)
- self.webkit.LoadURL("http://www.wxpython.org")
-
</del><ins>+ self.panel = TestPanel(self, -1)
+ self.panel.webview.LoadURL("http://www.wxwidgets.org/")
</ins><span class="cx">
</span><span class="cx"> class wkApp(wx.App):
</span><span class="cx"> def OnInit(self):
</span></span></pre>
</div>
</div>
</body>
</html>