Deprecated PyShell and PyShellWindow, added a snapshot of PyCrust.

Added the new virtual list capabilities to wxListCtrl.

Other odds and ends.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-08-14 19:19:48 +00:00
parent 6443de0263
commit c7e7022c2c
35 changed files with 3771 additions and 1641 deletions

View File

@@ -23,6 +23,8 @@ import images
_treeList = [
('New since last release', ['ContextHelp',
'PyCrust',
'VirtualListCtrl'
]),
('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
@@ -58,10 +60,10 @@ _treeList = [
('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
'FileBrowseButton', 'GenericButtons', 'wxEditor',
'PyShellWindow', 'ColourSelect', 'ImageBrowser',
'infoframe', 'ColourDB',
'ColourSelect', 'ImageBrowser',
'infoframe', 'ColourDB', 'PyCrust',
]),
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),

16
wxPython/demo/PyCrust.py Normal file
View File

@@ -0,0 +1,16 @@
from wxPython.lib.PyCrust import PyCrustShell, PyCrustEditor, PyCrustVersion
#----------------------------------------------------------------------
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % PyCrustVersion.version
def runTest(frame, nb, log):
shell = PyCrustShell.Shell(nb, intro)
return shell.editor
#----------------------------------------------------------------------
overview = PyCrustShell.__doc__

View File

@@ -1,21 +0,0 @@
from wxPython.wx import *
from wxPython.lib.shell import PyShell
#----------------------------------------------------------------------
def runTest(frame, nb, log):
testGlobals = {'hello' : 'How are you?'}
win = PyShell(nb, globals=testGlobals)
win.Show(true)
return win
#----------------------------------------------------------------------
overview = """
A simple GUI version of the interactive interpreter.
"""

View File

@@ -1,15 +0,0 @@
from wxPython.lib.pyshell import PyShellWindow
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = PyShellWindow(nb, -1)
return win
#----------------------------------------------------------------------
import wxPython.lib.pyshell
overview = wxPython.lib.pyshell.__doc__

View File

@@ -0,0 +1,51 @@
from wxPython.wx import *
#----------------------------------------------------------------------
class TestVirtualList(wxListCtrl):
def __init__(self, parent, log):
wxListCtrl.__init__(self, parent, -1,
style=wxLC_REPORT|wxLC_VIRTUAL|wxLC_HRULES|wxLC_VRULES)
self.log = log
self.InsertColumn(0, "First")
self.InsertColumn(1, "Second")
self.InsertColumn(2, "Third")
self.SetColumnWidth(0, 175)
self.SetColumnWidth(1, 175)
self.SetColumnWidth(2, 175)
self.SetItemCount(1000000)
def OnGetItemText(self, item, col):
return "Item %d, column %d" % (item, col)
def OnGetItemImage(self, item):
return 0
def OnGetItemAttr(self, item):
return None
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestVirtualList(nb, log)
return win
#----------------------------------------------------------------------
overview = """\
"""

View File

@@ -22,39 +22,39 @@ musicdata = {
4 : ("Gloria Estefan", "Here We Are", "Rock"),
5 : ("Linda Ronstadt", "Don't Know Much", "Rock"),
6 : ("Michael Bolton", "How Am I Supposed To Live Without You", "Blues"),
7 : ("Paul Young", "Oh Girl", "Rock"),
8 : ("Paula Abdul", "Opposites Attract", "Rock"),
9 : ("Richard Marx", "Should've Known Better", "Rock"),
10: ("Rod Stewart", "Forever Young", "Rock"),
11: ("Roxette", "Dangerous", "Rock"),
12: ("Sheena Easton", "The Lover In Me", "Rock"),
13: ("Sinead O'Connor", "Nothing Compares 2 U", "Rock"),
14: ("Stevie B.", "Because I Love You", "Rock"),
15: ("Taylor Dayne", "Love Will Lead You Back", "Rock"),
16: ("The Bangles", "Eternal Flame", "Rock"),
17: ("Wilson Phillips", "Release Me", "Rock"),
18: ("Billy Joel", "Blonde Over Blue", "Rock"),
19: ("Billy Joel", "Famous Last Words", "Rock"),
20: ("Billy Joel", "Lullabye (Goodnight, My Angel)", "Rock"),
21: ("Billy Joel", "The River Of Dreams", "Rock"),
22: ("Billy Joel", "Two Thousand Years", "Rock"),
23: ("Janet Jackson", "Alright", "Rock"),
24: ("Janet Jackson", "Black Cat", "Rock"),
25: ("Janet Jackson", "Come Back To Me", "Rock"),
26: ("Janet Jackson", "Escapade", "Rock"),
27: ("Janet Jackson", "Love Will Never Do (Without You)", "Rock"),
28: ("Janet Jackson", "Miss You Much", "Rock"),
29: ("Janet Jackson", "Rhythm Nation", "Rock"),
30: ("Janet Jackson", "State Of The World", "Rock"),
31: ("Janet Jackson", "The Knowledge", "Rock"),
32: ("Spyro Gyra", "End of Romanticism", "Jazz"),
33: ("Spyro Gyra", "Heliopolis", "Jazz"),
34: ("Spyro Gyra", "Jubilee", "Jazz"),
35: ("Spyro Gyra", "Little Linda", "Jazz"),
36: ("Spyro Gyra", "Morning Dance", "Jazz"),
37: ("Spyro Gyra", "Song for Lorraine", "Jazz"),
38: ("Yes", "Owner Of A Lonely Heart", "Rock"),
39: ("Yes", "Rhythm Of Love", "Rock"),
## 7 : ("Paul Young", "Oh Girl", "Rock"),
## 8 : ("Paula Abdul", "Opposites Attract", "Rock"),
## 9 : ("Richard Marx", "Should've Known Better", "Rock"),
## 10: ("Rod Stewart", "Forever Young", "Rock"),
## 11: ("Roxette", "Dangerous", "Rock"),
## 12: ("Sheena Easton", "The Lover In Me", "Rock"),
## 13: ("Sinead O'Connor", "Nothing Compares 2 U", "Rock"),
## 14: ("Stevie B.", "Because I Love You", "Rock"),
## 15: ("Taylor Dayne", "Love Will Lead You Back", "Rock"),
## 16: ("The Bangles", "Eternal Flame", "Rock"),
## 17: ("Wilson Phillips", "Release Me", "Rock"),
## 18: ("Billy Joel", "Blonde Over Blue", "Rock"),
## 19: ("Billy Joel", "Famous Last Words", "Rock"),
## 20: ("Billy Joel", "Lullabye (Goodnight, My Angel)", "Rock"),
## 21: ("Billy Joel", "The River Of Dreams", "Rock"),
## 22: ("Billy Joel", "Two Thousand Years", "Rock"),
## 23: ("Janet Jackson", "Alright", "Rock"),
## 24: ("Janet Jackson", "Black Cat", "Rock"),
## 25: ("Janet Jackson", "Come Back To Me", "Rock"),
## 26: ("Janet Jackson", "Escapade", "Rock"),
## 27: ("Janet Jackson", "Love Will Never Do (Without You)", "Rock"),
## 28: ("Janet Jackson", "Miss You Much", "Rock"),
## 29: ("Janet Jackson", "Rhythm Nation", "Rock"),
## 30: ("Janet Jackson", "State Of The World", "Rock"),
## 31: ("Janet Jackson", "The Knowledge", "Rock"),
## 32: ("Spyro Gyra", "End of Romanticism", "Jazz"),
## 33: ("Spyro Gyra", "Heliopolis", "Jazz"),
## 34: ("Spyro Gyra", "Jubilee", "Jazz"),
## 35: ("Spyro Gyra", "Little Linda", "Jazz"),
## 36: ("Spyro Gyra", "Morning Dance", "Jazz"),
## 37: ("Spyro Gyra", "Song for Lorraine", "Jazz"),
## 38: ("Yes", "Owner Of A Lonely Heart", "Rock"),
## 39: ("Yes", "Rhythm Of Love", "Rock"),
}
import images
@@ -72,7 +72,7 @@ class TestListCtrlPanel(wxPanel):
idx1 = self.il.Add(bmp)
self.list = wxListCtrl(self, tID,
style=wxLC_REPORT|wxSUNKEN_BORDER)
style=wxLC_REPORT|wxSUNKEN_BORDER)#|wxLC_VRULES|wxLC_HRULES)
self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
# Why doesn't this show up on MSW???
@@ -103,6 +103,10 @@ class TestListCtrlPanel(wxPanel):
item.SetTextColour(wxBLUE)
self.list.SetItem(item)
item = self.list.GetItem(4)
item.SetTextColour(wxRED)
self.list.SetItem(item)
self.currentItem = 0
EVT_SIZE(self, self.OnSize)
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
@@ -159,7 +163,9 @@ class TestListCtrlPanel(wxPanel):
def ColumnSorter(self, key1, key2):
item1 = musicdata[key1][self.col]
item2 = musicdata[key2][self.col]
if item1 == item2: return 0
# when the items are identical, compare someting else to make the sort key unique...
if item1 == item2: return key1 - key2
elif item1 < item2: return -1
else: return 1

View File

@@ -30,7 +30,6 @@ wxStyledTextEditor also supports setting markers in the margin...
you want in your application. Cut, Copy, Paste, Drag and Drop of
text works, as well as virtually unlimited Undo and Redo
capabilities, (right click to try it out.)
"""
if wxPlatform == '__WXMSW__':
@@ -168,6 +167,22 @@ def runTest(frame, nb, log):
ed.SetStyling(10, wxSTC_INDIC1_MASK)
ed.SetStyling(10, wxSTC_INDIC2_MASK | wxSTC_INDIC1_MASK)
# some test stuff...
if 1:
print "GetTextLength(): ", ed.GetTextLength(), len(ed.GetText())
print "GetText(): ", repr(ed.GetText())
print
print "GetStyledText(98, 104): ", repr(ed.GetStyledText(98, 104)), len(ed.GetStyledText(98, 104))
print
print "GetCurLine(): ", repr(ed.GetCurLine())
print
print "GetLine(1): ", repr(ed.GetLine(1))
print
ed.SetSelection(25, 35)
print "GetSelectedText(): ", repr(ed.GetSelectedText())
print "GetTextRange(25, 35): ", repr(ed.GetTextRange(25, 35))
ed.GotoPos(0)
return p

View File

@@ -33,6 +33,9 @@ class TestPanel(wxPanel):
size=(200, 100), style=wxTE_MULTILINE)
t3.SetInsertionPoint(0)
EVT_TEXT(self, 30, self.EvtText)
b = wxButton(self, -1, "Test Replace")
EVT_BUTTON(self, b.GetId(), self.OnTestReplace)
self.tc = t3
l4 = wxStaticText(self, -1, "Rich Text")
t4 = wxTextCtrl(self, 40, "If supported by the native control, this is red, and this is a different font.",
@@ -47,11 +50,11 @@ class TestPanel(wxPanel):
t4.SetStyle(63, 77, wxTextAttr("BLUE", wxNullColour, f))
## print 'a2', sys.getrefcount(f)
sizer = wxFlexGridSizer(cols=2, hgap=6, vgap=6)
sizer.AddMany([ l1, t1,
l2, t2,
l3, t3,
l4, t4,
sizer = wxFlexGridSizer(cols=3, hgap=6, vgap=6)
sizer.AddMany([ l1, t1, (0,0),
l2, t2, (0,0),
l3, t3, b,
l4, t4, (0,0),
])
border = wxBoxSizer(wxVERTICAL)
border.Add(sizer, 0, wxALL, 25)
@@ -68,6 +71,11 @@ class TestPanel(wxPanel):
event.Skip()
def OnTestReplace(self, evt):
self.tc.Replace(4, 8, "DOES")
#self.tc.Remove(4, 8)
#---------------------------------------------------------------------------
def runTest(frame, nb, log):