projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Warning fix.
[wxWidgets.git]
/
wxPython
/
demo
/
Main.py
diff --git
a/wxPython/demo/Main.py
b/wxPython/demo/Main.py
index 560bd0951f1ff873aadcabca9da3d15bb7efd187..b6a429c4a59f5a42841e72909259b3200ebf40f9 100644
(file)
--- a/
wxPython/demo/Main.py
+++ b/
wxPython/demo/Main.py
@@
-36,8
+36,8
@@
import images
# For debugging
##wx.Trap();
# For debugging
##wx.Trap();
-##print "wx.VERSION_STRING =
", wx.VERSION_STRING
-##print
os.getpid();
+##print "wx.VERSION_STRING =
%s (%s)" % (wx.VERSION_STRING, wx.USE_UNICODE and 'unicode' or 'ansi')
+##print
"pid:", os.getpid()
##raw_input("Press Enter...")
##raw_input("Press Enter...")
@@
-47,9
+47,11
@@
import images
_treeList = [
# new stuff
('Recent Additions/Updates', [
_treeList = [
# new stuff
('Recent Additions/Updates', [
- 'FoldPanelBar',
- 'GIFAnimationCtrl',
- 'HyperLinkCtrl',
+ 'AnalogClock',
+ 'CheckListCtrlMixin',
+ 'RichTextCtrl',
+ 'Treebook',
+ 'Toolbook',
]),
# managed windows == things with a (optional) caption you can close
]),
# managed windows == things with a (optional) caption you can close
@@
-80,7
+82,6
@@
_treeList = [
# dialogs from libraries
('More Dialogs', [
'ImageBrowser',
# dialogs from libraries
('More Dialogs', [
'ImageBrowser',
- 'MultipleChoiceDialog',
'ScrolledMessageDialog',
]),
'ScrolledMessageDialog',
]),
@@
-91,7
+92,6
@@
_treeList = [
'CheckBox',
'CheckListBox',
'Choice',
'CheckBox',
'CheckListBox',
'Choice',
- 'Choicebook',
'ComboBox',
'Gauge',
'Grid',
'ComboBox',
'Gauge',
'Grid',
@@
-100,9
+100,7
@@
_treeList = [
'ListCtrl',
'ListCtrl_virtual',
'ListCtrl_edit',
'ListCtrl',
'ListCtrl_virtual',
'ListCtrl_edit',
- 'Listbook',
'Menu',
'Menu',
- 'Notebook',
'PopupMenu',
'PopupWindow',
'RadioBox',
'PopupMenu',
'PopupWindow',
'RadioBox',
@@
-124,9
+122,17
@@
_treeList = [
'TreeCtrl',
'Validator',
]),
'TreeCtrl',
'Validator',
]),
+
+ ('"Book" Controls', [
+ 'Choicebook',
+ 'Listbook',
+ 'Notebook',
+ 'Toolbook',
+ 'Treebook',
+ ]),
('Custom Controls', [
('Custom Controls', [
- 'AnalogClock
Window
',
+ 'AnalogClock',
'ColourSelect',
'Editor',
'GenericButtons',
'ColourSelect',
'Editor',
'GenericButtons',
@@
-146,6
+152,7
@@
_treeList = [
#'RightTextCtrl', deprecated as we have wxTE_RIGHT now.
'Calendar',
'CalendarCtrl',
#'RightTextCtrl', deprecated as we have wxTE_RIGHT now.
'Calendar',
'CalendarCtrl',
+ 'CheckListCtrlMixin',
'ContextHelp',
'DatePickerCtrl',
'DynamicSashWindow',
'ContextHelp',
'DatePickerCtrl',
'DynamicSashWindow',
@@
-159,14
+166,15
@@
_treeList = [
'HtmlWindow',
'HyperLinkCtrl',
'IntCtrl',
'HtmlWindow',
'HyperLinkCtrl',
'IntCtrl',
- 'MediaCtrl',
'MVCTree',
'MaskedEditControls',
'MaskedNumCtrl',
'MVCTree',
'MaskedEditControls',
'MaskedNumCtrl',
- 'MimeTypesManager',
+ 'MediaCtrl',
+ 'MultiSplitterWindow',
'PyCrust',
'PyPlot',
'PyShell',
'PyCrust',
'PyPlot',
'PyShell',
+ 'RichTextCtrl',
'ScrolledPanel',
'SplitTree',
'StyledTextCtrl_1',
'ScrolledPanel',
'SplitTree',
'StyledTextCtrl_1',
@@
-230,7
+238,9
@@
_treeList = [
'DrawXXXList',
'FileHistory',
'FontEnumerator',
'DrawXXXList',
'FileHistory',
'FontEnumerator',
+ 'GLCanvas',
'Joystick',
'Joystick',
+ 'MimeTypesManager',
'MouseGestures',
'OGL',
'PrintFramework',
'MouseGestures',
'OGL',
'PrintFramework',
@@
-240,11
+250,6
@@
_treeList = [
'Unicode',
]),
'Unicode',
]),
- # need libs not coming with the demo
- ('Samples using an external library', [
- 'GLCanvas',
- ]),
-
('Check out the samples dir too', [
]),
('Check out the samples dir too', [
]),
@@
-455,7
+460,7
@@
try:
'fore:#000000,back:#FFFFFF,face:Courier New,size:9')
else:
self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
'fore:#000000,back:#FFFFFF,face:Courier New,size:9')
else:
self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
- 'fore:#000000,back:#FFFFFF,face:Courier,size:
12
')
+ 'fore:#000000,back:#FFFFFF,face:Courier,size:
9
')
# Clear styles and revert to default.
self.StyleClearAll()
# Clear styles and revert to default.
self.StyleClearAll()
@@
-801,7
+806,8
@@
class DemoModules:
def LoadDict(self, modID):
if self.name != __name__:
source = self.modules[modID][1]
def LoadDict(self, modID):
if self.name != __name__:
source = self.modules[modID][1]
- description = self.modules[modID][3]
+ #description = self.modules[modID][3]
+ description = self.modules[modID][2]
try:
self.modules[modID][0] = {}
try:
self.modules[modID][0] = {}
@@
-937,7
+943,7
@@
class DemoErrorPanel(wx.Panel):
self.box = wx.BoxSizer(wx.VERTICAL)
# Main Label
self.box = wx.BoxSizer(wx.VERTICAL)
# Main Label
- self.box.Add(wx.StaticText(self, -1, "An error has occured while trying to run the demo")
+ self.box.Add(wx.StaticText(self, -1, "An error has occur
r
ed while trying to run the demo")
, 0, wx.ALIGN_CENTER | wx.TOP, 10)
# Exception Information
, 0, wx.ALIGN_CENTER | wx.TOP, 10)
# Exception Information
@@
-1080,8
+1086,7
@@
class DemoTaskBarIcon(wx.TaskBarIcon):
def OnTaskBarChange(self, evt):
def OnTaskBarChange(self, evt):
- names = [ "WXPdemo", "WXP", "Mondrian", "Test2m",
- "Blom08m", "Blom10m", "Blom15m" ]
+ names = [ "WXPdemo", "Mondrian", "Pencil", "Carrot" ]
name = names[self.imgidx]
getFunc = getattr(images, "get%sImage" % name)
name = names[self.imgidx]
getFunc = getattr(images, "get%sImage" % name)
@@
-1210,6
+1215,7
@@
class wxPythonDemo(wx.Frame):
self.SetMenuBar(self.mainmenu)
self.finddata = wx.FindReplaceData()
self.SetMenuBar(self.mainmenu)
self.finddata = wx.FindReplaceData()
+ self.finddata.SetFlags(wx.FR_DOWN)
if 0:
# This is another way to set Accelerators, in addition to
if 0:
# This is another way to set Accelerators, in addition to
@@
-1405,7
+1411,7
@@
class wxPythonDemo(wx.Frame):
# o The RunTest() for all samples must now return a window that can
# be palced in a tab in the main notebook.
# o The RunTest() for all samples must now return a window that can
# be palced in a tab in the main notebook.
- # o If an error occurs (or has occured before) an error tab is created.
+ # o If an error occurs (or has occur
r
ed before) an error tab is created.
if module is not None:
wx.LogMessage("Running demo module...")
if module is not None:
wx.LogMessage("Running demo module...")
@@
-1527,9
+1533,7
@@
class wxPythonDemo(wx.Frame):
self.nb.SetSelection(1)
self.finddlg = wx.FindReplaceDialog(self, self.finddata, "Find",
self.nb.SetSelection(1)
self.finddlg = wx.FindReplaceDialog(self, self.finddata, "Find",
- wx.FR_NOUPDOWN |
- wx.FR_NOMATCHCASE |
- wx.FR_NOWHOLEWORD)
+ wx.FR_NOMATCHCASE | wx.FR_NOWHOLEWORD)
self.finddlg.Show(True)
self.finddlg.Show(True)
@@
-1542,13
+1546,22
@@
class wxPythonDemo(wx.Frame):
self.nb.SetSelection(1)
end = editor.GetLastPosition()
textstring = editor.GetRange(0, end).lower()
self.nb.SetSelection(1)
end = editor.GetLastPosition()
textstring = editor.GetRange(0, end).lower()
- start = editor.GetSelection()[1]
findstring = self.finddata.GetFindString().lower()
findstring = self.finddata.GetFindString().lower()
- loc = textstring.find(findstring, start)
+ backward = not (self.finddata.GetFlags() & wx.FR_DOWN)
+ if backward:
+ start = editor.GetSelection()[0]
+ loc = textstring.rfind(findstring, 0, start)
+ else:
+ start = editor.GetSelection()[1]
+ loc = textstring.find(findstring, start)
if loc == -1 and start != 0:
# string not found, start at beginning
if loc == -1 and start != 0:
# string not found, start at beginning
- start = 0
- loc = textstring.find(findstring, start)
+ if backward:
+ start = end
+ loc = textstring.rfind(findstring, 0, start)
+ else:
+ start = 0
+ loc = textstring.find(findstring, start)
if loc == -1:
dlg = wx.MessageDialog(self, 'Find String Not Found',
'Find String Not Found in Demo File',
if loc == -1:
dlg = wx.MessageDialog(self, 'Find String Not Found',
'Find String Not Found in Demo File',
@@
-1675,18
+1688,33
@@
class wxPythonDemo(wx.Frame):
class MySplashScreen(wx.SplashScreen):
def __init__(self):
class MySplashScreen(wx.SplashScreen):
def __init__(self):
- bmp = wx.Image(opj("bitmaps/splash.
gif
")).ConvertToBitmap()
+ bmp = wx.Image(opj("bitmaps/splash.
png
")).ConvertToBitmap()
wx.SplashScreen.__init__(self, bmp,
wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
wx.SplashScreen.__init__(self, bmp,
wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
-
3
000, None, -1)
+
5
000, None, -1)
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.Bind(wx.EVT_CLOSE, self.OnClose)
+ self.fc = wx.FutureCall(2000, self.ShowMain)
+
def OnClose(self, evt):
def OnClose(self, evt):
+ # Make sure the default handler runs too so this window gets
+ # destroyed
+ evt.Skip()
self.Hide()
self.Hide()
+
+ # if the timer is still running then go ahead and show the
+ # main frame now
+ if self.fc.IsRunning():
+ self.fc.Stop()
+ self.ShowMain()
+
+
+ def ShowMain(self):
frame = wxPythonDemo(None, "wxPython: (A Demonstration)")
frame.Show()
frame = wxPythonDemo(None, "wxPython: (A Demonstration)")
frame.Show()
- evt.Skip() # Make sure the default handler runs too...
-
+ if self.fc.IsRunning():
+ self.Raise()
+
class MyApp(wx.App):
def OnInit(self):
class MyApp(wx.App):
def OnInit(self):
@@
-1705,7
+1733,7
@@
class MyApp(wx.App):
# initialization, finally creating and showing the main
# application window(s). In this case we have nothing else to
# do so we'll delay showing the main frame until later (see
# initialization, finally creating and showing the main
# application window(s). In this case we have nothing else to
# do so we'll delay showing the main frame until later (see
- #
OnClose
above) so the users can see the SplashScreen effect.
+ #
ShowMain
above) so the users can see the SplashScreen effect.
splash = MySplashScreen()
splash.Show()
splash = MySplashScreen()
splash.Show()