more changes to the demo

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-04-17 04:25:48 +00:00
parent 833a6790ad
commit 9bf69b7bb5
7 changed files with 300 additions and 89 deletions

View File

@@ -14,18 +14,22 @@ except:
#----------------------------------------------------------------------
class TestPanel(wxPanel):
def __init__(self, parent, log):
wxPanel.__init__(self, parent, -1)#, style=wxCLIP_CHILDREN)
class TestPanel(wxWindow):
def __init__(self, parent, log, frame=None):
wxWindow.__init__(self, parent, -1)#, style=wxCLIP_CHILDREN)
self.log = log
self.current = "http://alldunn.com/"
self.frame = frame
if frame:
self.titleBase = frame.GetTitle()
sizer = wxBoxSizer(wxVERTICAL)
btnSizer = wxBoxSizer(wxHORIZONTAL)
# Make a new class that derives from the WebBrowser class in the
# COM module imported above. This class also drives from wxWindow and
# implements the machinery needed to integrate the two things.
# COM module imported above. This class also derives from wxWindow and
# implements the machinery needed to integrate the two worlds.
theClass = MakeActiveXClass(browserModule.WebBrowser,
eventObj = self)
@@ -50,24 +54,44 @@ class TestPanel(wxPanel):
self.location = wxComboBox(self, wxNewId(), "", style=wxCB_DROPDOWN)
EVT_COMBOBOX(self, self.location.GetId(), self.OnLocationSelect)
EVT_KEY_UP(self.location, self.OnLocationKey)
#EVT_CHAR(self.location, self.IgnoreReturn)
btnSizer.Add(self.location, 1, wxEXPAND|wxALL, 5)
sizer.Add(btnSizer, 0, wxEXPAND)
sizer.Add(self.ie, 1, wxEXPAND)
self.ie.Navigate(self.current)
self.location.Append(self.current)
self.SetSizer(sizer)
self.SetAutoLayout(true)
def OnSize(self, evt):
self.Layout()
def __del__(self):
self.ie.Cleanup()
self.ie = None
def OnLocationSelect(self, evt):
pass
url = self.location.GetStringSelection()
self.log.write('OnLocationSelect: %s\n' % url)
self.ie.Navigate(url)
def OnLocationKey(self, evt):
if evt.KeyCode() == WXK_RETURN:
URL = self.location.GetValue()
self.location.Append(URL)
self.ie.Navigate(URL)
else:
evt.Skip()
def IgnoreReturn(self, evt):
print 'IgnoreReturn'
if evt.KeyCode() != WXK_RETURN:
evt.Skip()
def OnOpenButton(self, event):
dlg = wxTextEntryDialog(self, "Open Location",
@@ -100,12 +124,22 @@ class TestPanel(wxPanel):
self.current = URL
self.location.SetValue(URL)
def OnTitleChange(self, text):
self.log.write('OnTitleChange: %s\n' % text)
if self.frame:
self.frame.SetTitle(self.titleBase + ' -- ' + text)
def OnStatusTextChange(self, text):
self.log.write('OnStatusTextChange: %s\n' % text)
if self.frame:
self.frame.SetStatusText(text)
#----------------------------------------------------------------------
# for the demo framework...
def runTest(frame, nb, log):
win = TestPanel(nb, log)
win = TestPanel(nb, log, frame)
return win
@@ -120,7 +154,8 @@ if __name__ == '__main__':
wxFrame.__init__(self, None, -1, "ActiveX test -- Internet Explorer",
size=(640, 480),
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
self.tp = TestPanel(self, sys.stdout)
self.CreateStatusBar()
self.tp = TestPanel(self, sys.stdout, self)
def OnCloseWindow(self, event):
self.tp.ie.Cleanup()

View File

@@ -63,7 +63,7 @@ _treeList = [
class wxPythonDemo(wxFrame):
def __init__(self, parent, id, title):
wxFrame.__init__(self, parent, -1, title, size = (725, 550),
wxFrame.__init__(self, parent, -1, title, size = (800, 600),
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
self.cwd = os.getcwd()
@@ -185,7 +185,7 @@ class wxPythonDemo(wxFrame):
if _useSplitter:
if _useNestedSplitter:
splitter2.SplitHorizontally(self.nb, self.log)
splitter2.SetSashPosition(360, true)
splitter2.SetSashPosition(450, true)
splitter2.SetMinimumPaneSize(20)
splitter.SplitVertically(self.tree, splitter2)

View File

@@ -5,7 +5,7 @@
# Author: Lorne White (email: lwhite1@planet.eon.net)
#
# Created:
# Version 0.7 200/03/30
# Version 0.8 2000/04/16
# Licence: wxWindows license
#----------------------------------------------------------------------------
@@ -70,6 +70,7 @@ class TestPanel(wxPanel):
self.calend.hide_title = TRUE
self.calend.HideGrid()
self.calend.SetWeekColor('WHITE', 'BLACK')
# display routine
@@ -186,6 +187,7 @@ class TestPanel(wxPanel):
except:
set_days = [1, 5, 12]
self.calend.AddSelect([4, 11], 'BLUE', 'WHITE')
self.calend.SetSelDay(set_days)
self.calend.Refresh()
@@ -257,6 +259,8 @@ class CalenDlg(wxDialog):
self.calend.SetYear(start_year)
self.calend.HideTitle()
self.calend.ShowWeekEnd()
self.ResetDisplay()
self.Connect(self.calend.GetId(), -1, 2100, self.MouseClick)
@@ -303,6 +307,8 @@ class CalenDlg(wxDialog):
except:
set_days = [1, 5, 12]
self.calend.AddSelect([4, 11], 'BLUE', 'WHITE')
self.calend.SetSelDay(set_days)
self.calend.Refresh()
@@ -326,6 +332,9 @@ class CalendFrame(wxFrame):
self.calend = wxCalendar(self, -1)
self.calend.SetCurrentDay()
self.calend.grid_color = 'BLUE'
self.calend.SetBusType()
# self.calend.ShowWeekEnd()
self.ResetDisplay()
self.Connect(self.calend.GetId(), -1, 2100, self.MouseClick)
@@ -344,6 +353,8 @@ class CalendFrame(wxFrame):
except:
set_days = [1, 5, 12]
self.calend.AddSelect([2, 16], 'GREEN', 'WHITE')
self.calend.SetSelDay(set_days)
self.calend.Refresh()
@@ -525,20 +536,29 @@ class PrintCalend:
cal.font = self.font
cal.bold = self.bold
cal_size = wxSize(3.0, 2.0)
cal_size = wxSize(3.0, 3.0)
cal.SetSize(cal_size)
year, month = self.year, self.month
x = 1.0
for i in range(2):
y = 0.5
for j in range(3):
cal.SetCal(year, month) # current month
cal.SetPos(x, y)
cal.DrawCal(DC, self.sel_lst)
try:
set_days = test_days[month]
except:
set_days = [1, 5, 12]
cal.AddSelect([2, 16], 'GREEN', 'WHITE')
cal.DrawCal(DC, set_days)
year, month = self.IncMonth(year, month)
y = y + 2.5
y = y + 3.5
x = x + 4.0 # next colum
DC.EndDrawing()
@@ -695,8 +715,9 @@ def runTest(frame, nb, log):
overview = """\
This control provides a calendar control class for displaying and selecting dates. In addition, the class is extended and can now be used for printing/previewing.
Additional features include weekend highlighting and business type Monday-Sunday format.
See example for various methods used to set display month, year, and highlighted dates (different colour).
See example for various methods used to set display month, year, and highlighted dates (different font and background colours).
by Lorne White

View File

@@ -18,11 +18,15 @@ class TestComboBox(wxPanel):
wxComboBox(self, 500, "default value", wxPoint(80, 50), wxSize(95, -1),
sampleList, wxCB_DROPDOWN)
EVT_COMBOBOX(self, 500, self.EvtComboBox)
EVT_TEXT(self, 500, self.EvtText)
def EvtComboBox(self, event):
self.log.WriteText('EvtComboBox: %s\n' % event.GetString())
def EvtText(self, event):
self.log.WriteText('EvtText: %s\n' % event.GetString())
#---------------------------------------------------------------------------
def runTest(frame, nb, log):