New wxHtml stuff, including a TagHandler for placing wxPython widgets

on the html page.

Some other tweaks and fixes


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
1999-09-17 05:55:00 +00:00
parent 2819545569
commit e166644c53
19 changed files with 2097 additions and 82 deletions

View File

@@ -1,7 +1,10 @@
from wxPython.wx import *
from wxPython.html import *
from wxPython.lib.sizers import *
import sys, os
from wxPython.wx import *
from wxPython.html import *
from wxPython.lib.sizers import *
import wxPython.lib.wxpTag
#----------------------------------------------------------------------
@@ -55,35 +58,64 @@ class TestHtmlPanel(wxPanel):
EVT_BUTTON(self, 1205, self.OnForward)
subbox.Add(btn, 1)
btn = wxButton(self, 1206, "View Source")
EVT_BUTTON(self, 1206, self.OnViewSource)
subbox.Add(btn, 1)
self.box.Add(subbox)
# A button with this ID is created on the widget test page.
EVT_BUTTON(self, wxID_OK, self.OnOk)
self.OnShowDefault(None)
def OnSize(self, event):
size = self.GetClientSize()
self.box.Layout(size)
def OnShowDefault(self, event):
self.html.LoadPage("data/test.htm")
name = os.path.join(os.path.split(sys.argv[0])[0], 'data/test.htm')
self.html.LoadPage(name)
def OnLoadFile(self, event):
pass
dlg = wxFileDialog(self, wildcard = '*.htm*', style=wxOPEN)
if dlg.ShowModal():
path = dlg.GetPath()
self.html.LoadPage(path)
dlg.Destroy()
def OnWithWidgets(self, event):
pass
os.chdir(os.path.split(sys.argv[0])[0])
name = os.path.join(os.path.split(sys.argv[0])[0], 'data/widgetTest.htm')
self.html.LoadPage(name)
#self.html.SetPage(_widgetTest)
def OnOk(self, event):
self.log.WriteText("It works!\n")
def OnBack(self, event):
if not self.html.HistoryBack():
wxMessageBox("No more items in history!")
def OnForward(self, event):
if not self.html.HistoryForward():
wxMessageBox("No more items in history!")
def OnViewSource(self, event):
from wxPython.lib.dialogs import wxScrolledMessageDialog
source = self.html.GetParser().GetSource()
dlg = wxScrolledMessageDialog(self, source, 'HTML Source')
dlg.ShowModal()
dlg.Destroy()
#----------------------------------------------------------------------
def runTest(frame, nb, log):
@@ -104,3 +136,28 @@ It is not intended to be a high-end HTML browser. If you're looking for somethi
"""
_widgetTest = '''\
<html><body>
The widgets on this page were created dynamically on the fly by a custom
wxTagHandler found in wxPython.lib.wxpTag.
<hr>
<center>
<wxp class="wxButton" width="50%">
<param name="label" value="It works!">
<param name="id" value="wxID_OK">
</wxp>
</center>
<hr>
after
</body></html>
'''