Added AnalogClock class to library

Added NewNamespace sample to the demo
Other demo tweaks


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20273 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-04-18 21:10:28 +00:00
parent 0776fe07e4
commit e8e8026ec7
9 changed files with 370 additions and 75 deletions

View File

@@ -0,0 +1,79 @@
from wxPython.wx import *
from wxPython.lib.analogclock import AnalogClockWindow
#----------------------------------------------------------------------
class TestPanel(wxPanel):
def __init__(self, parent, log):
self.log = log
wxPanel.__init__(self, parent, -1)
c1 = AnalogClockWindow(self)
c1.SetBackgroundColour("RED")
c1.SetHandsColour("BLUE")
c1.SetTickMarkColours("WHITE")
c2 = AnalogClockWindow(self)
c2.SetBackgroundColour("WHITE")
c2.SetHandsColour("RED")
c2.SetTickMarkColours("BLUE")
c3 = AnalogClockWindow(self)
c3.SetBackgroundColour("BLUE")
c3.SetHandsColour("WHITE")
c3.SetTickMarkColours("RED")
c4 = AnalogClockWindow(self, style=wxRAISED_BORDER)
c4.SetTickMarkStyle(AnalogClockWindow.TICKS_CIRCLE)
c5 = AnalogClockWindow(self)
c5.SetTickMarkStyle(AnalogClockWindow.TICKS_NONE)
c6 = AnalogClockWindow(self, style=wxSUNKEN_BORDER)
# layout the clocks in a grid
gs = wxGridSizer(2, 3, 4, 4)
gs.Add(c1, 0, wxEXPAND)
gs.Add(c2, 0, wxEXPAND)
gs.Add(c3, 0, wxEXPAND)
gs.Add(c4, 0, wxEXPAND)
gs.Add(c5, 0, wxEXPAND)
gs.Add(c6, 0, wxEXPAND)
# put it in another sizer for a border
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(gs, 1, wxEXPAND|wxALL, 10)
self.SetSizer(sizer)
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2><center>AnalogClockWindow</center></h2>
This is a nice little clock class that was contributed to by several
members of the wxPython-users group.
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -26,11 +26,11 @@ import images
_treeList = [
# new stuff
('Recent Additions', [
'wxIntCtrl',
'wxPyColourChooser',
'wxScrolledPanel',
'ShapedWindow',
'NewNamespace',
'PopupMenu',
'AnalogClockWindow',
]),
# managed windows == things with a (optional) caption you can close
@@ -104,7 +104,8 @@ _treeList = [
('More Windows/Controls', [
#'wxFloatBar', deprecated
#'wxMVCTree', deprecated
#'wxRightTextCtrl', deprecated as we have wxTE_RIGHT now.
#'wxRightTextCtrl', deprecated as we have wxTE_RIGHT now.
'AnalogClockWindow',
'ColourSelect',
'ContextHelp',
'FancyText',
@@ -326,7 +327,8 @@ class wxPythonDemo(wxFrame):
aTable = wxAcceleratorTable([(wxACCEL_ALT, ord('X'), exitID),
(wxACCEL_CTRL, ord('H'), helpID),
(wxACCEL_CTRL, ord('F'), findID),
(wxACCEL_NORMAL, WXK_F3, findnextID)])
(wxACCEL_NORMAL, WXK_F3, findnextID)
])
self.SetAcceleratorTable(aTable)
@@ -366,7 +368,7 @@ class wxPythonDemo(wxFrame):
self.ovr = wxHtmlWindow(self.nb, -1, size=(400, 400))
self.nb.AddPage(self.ovr, self.overviewText)
else: # hopefully I can remove this hacky code soon, see bug #216861
else: # hopefully I can remove this hacky code soon, see SF bug #216861
panel = wxPanel(self.nb, -1, style=wxCLIP_CHILDREN)
self.ovr = wxHtmlWindow(panel, -1, size=(400, 400))
self.nb.AddPage(panel, self.overviewText)

View File

@@ -0,0 +1,47 @@
import os
import wx
from wx import html
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
hwin = html.HtmlWindow(self, -1)
hwin.LoadFile(os.path.join(os.path.dirname(wx.__file__), 'wx.html'))
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(hwin, 1, wx.EXPAND)
self.SetSizer(sizer)
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2><center>Using the New Namespace</center></h2>
This sample isn't really a demo, but rather a place to display the
introductory doc for using the new namespace.
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -281,37 +281,22 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
self.popupID4 = wxNewId()
self.popupID5 = wxNewId()
self.popupID6 = wxNewId()
self.popupID7 = wxNewId()
self.popupID8 = wxNewId()
self.popupID9 = wxNewId()
EVT_MENU(self, self.popupID1, self.OnPopupOne)
EVT_MENU(self, self.popupID2, self.OnPopupTwo)
EVT_MENU(self, self.popupID3, self.OnPopupThree)
EVT_MENU(self, self.popupID4, self.OnPopupFour)
EVT_MENU(self, self.popupID5, self.OnPopupFive)
EVT_MENU(self, self.popupID6, self.OnPopupSix)
EVT_MENU(self, self.popupID7, self.OnPopupSeven)
EVT_MENU(self, self.popupID8, self.OnPopupEIght)
EVT_MENU(self, self.popupID9, self.OnPopupNine)
# make a menu
menu = wxMenu()
# Show how to put an icon in the menu
item = wxMenuItem(menu, self.popupID1,"One")
item.SetBitmap(images.getSmilesBitmap())
menu.AppendItem(item)
# add some other items
menu.Append(self.popupID2, "Two")
# add some items
menu.Append(self.popupID1, "FindItem tests")
# menu.Append(self.popupID2, "Two")
menu.Append(self.popupID3, "ClearAll and repopulate")
menu.Append(self.popupID4, "DeleteAllItems")
menu.Append(self.popupID5, "GetItem")
menu.Append(self.popupID6, "Edit")
# make a submenu
sm = wxMenu()
sm.Append(self.popupID8, "sub item 1")
sm.Append(self.popupID9, "sub item 1")
menu.AppendMenu(self.popupID7, "Test Submenu", sm)
# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
@@ -331,8 +316,6 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
self.log.WriteText("Popup three\n")
self.list.ClearAll()
wxCallAfter(self.PopulateList)
#wxYield()
#self.PopulateList()
def OnPopupFour(self, event):
self.list.DeleteAllItems()
@@ -345,15 +328,6 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
self.list.EditLabel(self.currentItem)
def OnPopupSeven(self, event):
self.log.WriteText("Popup seven\n")
def OnPopupEIght(self, event):
self.log.WriteText("Popup eight\n")
def OnPopupNine(self, event):
self.log.WriteText("Popup nine\n")
def OnSize(self, event):
w,h = self.GetClientSizeTuple()
self.list.SetDimensions(0, 0, w, h)

View File

@@ -37,11 +37,6 @@ def runTest(frame, nb, log):
splitter.SetMinimumPaneSize(20)
splitter.SplitVertically(p1, p2, 100)
## splitter.SetSize((300,300))
## print splitter.GetSashPosition()
## splitter.SetSashPosition(100)
## print splitter.GetSashPosition()
return splitter
@@ -50,41 +45,16 @@ def runTest(frame, nb, log):
overview = """\
This class manages up to two subwindows. The current view can be split into two programmatically (perhaps from a menu command), and unsplit either programmatically or via the wxSplitterWindow user interface.
wxSplitterWindow()
-----------------------------------
Default constructor.
wxSplitterWindow(wxWindow* parent, wxWindowID id, int x, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style=wxSP_3D, const wxString& name = "splitterWindow")
Constructor for creating the window.
Parameters
-------------------
parent = The parent of the splitter window.
id = The window identifier.
pos = The window position.
size = The window size.
style = The window style. See wxSplitterWindow.
name = The window name.
This class manages up to two subwindows. The current view can be split
into two programmatically (perhaps from a menu command), and unsplit
either programmatically or via the wxSplitterWindow user interface.
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])