]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/MDIWindows.py
reformat the overview string
[wxWidgets.git] / wxPython / demo / MDIWindows.py
CommitLineData
9c67cbec 1
8fa876ca 2import wx
02b800ce
RD
3import os
4import sys
9c67cbec
RD
5
6#----------------------------------------------------------------------
7
8fa876ca 8class TestPanel(wx.Panel):
9c67cbec
RD
9 def __init__(self, parent, log):
10 self.log = log
8fa876ca 11 wx.Panel.__init__(self, parent, -1)
9c67cbec 12
8fa876ca
RD
13 b1 = wx.Button(self, -1, "MDI demo")
14 self.Bind(wx.EVT_BUTTON, self.ShowMDIDemo, b1)
9c67cbec 15
8fa876ca 16 b2 = wx.Button(self, -1, "MDI with SashWindows demo")
3cfc1d66 17 self.Bind(wx.EVT_BUTTON, self.ShowMDISashDemo, b2)
9c67cbec 18
8fa876ca 19 box = wx.BoxSizer(wx.VERTICAL)
d14a1e28 20 box.Add((20, 30))
8fa876ca
RD
21 box.Add(b1, 0, wx.ALIGN_CENTER|wx.ALL, 15)
22 box.Add(b2, 0, wx.ALIGN_CENTER|wx.ALL, 15)
1e4a197e 23 self.SetAutoLayout(True)
9c67cbec
RD
24 self.SetSizer(box)
25
26
02b800ce
RD
27 # These are spawned as new processes because on Mac there can be
28 # some problems related to having regular frames and MDI frames in
29 # the same app.
9c67cbec 30 def ShowMDIDemo(self, evt):
095315e2
RD
31 exe, spawn = self.GetPyExecutable()
32 spawn(os.P_NOWAIT, exe, exe, "MDIDemo.py")
9c67cbec
RD
33
34 def ShowMDISashDemo(self, evt):
095315e2
RD
35 exe, spawn = self.GetPyExecutable()
36 spawn(os.P_NOWAIT, exe, exe, "MDISashDemo.py")
37
486afba9
RD
38 # TODO: This hack can be removed once we fix the way the Python
39 # app bundles are generated so that they are not bundling and
40 # pointing to an otherwise unused and non-GUI-friendly version of
41 # Python on OS X.
095315e2
RD
42 def GetPyExecutable(self):
43 if 'wxMac' in wx.PlatformInfo:
44 # sys.executable will be wrong if running the demo from
486afba9
RD
45 # an app bundle. But the bundle is always using a system
46 # framework so just hardcode the path to it.
47 if sys.version[:3] == "2.4":
48 return '/usr/local/bin/pythonw', os.spawnl
49 else:
50 return '/usr/bin/pythonw', os.spawnl
095315e2
RD
51 else:
52 return sys.executable, os.spawnl
53
9c67cbec
RD
54#----------------------------------------------------------------------
55
56def runTest(frame, nb, log):
57 win = TestPanel(nb, log)
58 return win
59
60#----------------------------------------------------------------------
61
62
63
64overview = """<html><body>
65<h2><center>Multiple Document Interface</center></h2>
66
67Although Microsoft has deprecated the MDI model, wxWindows still supports
8fa876ca
RD
68it. Here are a couple samples of how to use it - one straightforward, the other
69showing how the MDI interface can be integrated into a SashWindow interface.
9c67cbec
RD
70
71</body></html>
72"""
1fded56b
RD
73
74
1fded56b
RD
75if __name__ == '__main__':
76 import sys,os
77 import run
8eca4fef 78 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])