2 Xinloe -- A Python-Based Non-Linear Ogg Editor
3 Copyright (C) 2004 Arc Riley <arc@Xiph.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 class MainFrame(wxFrame
):
28 wxFrame
.__init
__(self
, None, -1, 'Xinloe', size
=(620,400))
30 self
.CreateStatusBar()
31 self
.SetStatusText("Ready.")
33 self
.mainWin
= MainWindow(self
)
37 toolBar
= self
.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER|wxTB_FLAT|wxTB_TEXT
)
39 items
=(('&File',(('&New', 'Create a new project', self
.OnNewWindow
, 'filenew'),
40 ('&Open', 'Open a saved project', self
.OnToolClick
, 'fileopen'),
41 ('&Close', 'Close Project', self
.CloseWindow
))),
42 ('&Edit',(('Cu&t', 'Move the selected text or item(s) to the clipboard', self
.OnToolClick
, 'editcut'),
43 ('&Copy', 'Copy the selected text or item(s) to the clipboard', self
.OnToolClick
, 'editcopy'),
44 ('&Paste', 'Paste the clipboard contents', self
.OnToolClick
, 'editpaste'))),
45 ('&Stream',(('Sta&rt', 'Move active cursor to head of the project',
46 self
.OnToolClick
, 'player_start'),
47 ('&Rewind', 'Move active cursor to start of the chain',
48 self
.OnToolClick
, 'player_rew'),
49 ('&Play', 'Stream from active cursor',
50 self
.OnToolClick
, 'player_play'),
51 ('&Stop', 'Stop streaming from active cursor',
52 self
.OnToolClick
, 'player_stop'),
53 ('&Forward', 'Move active cursor to the end of the chain',
54 self
.OnToolClick
, 'player_fwd'),
55 ('&End', 'Move active cursor to tail of the project',
56 self
.OnToolClick
, 'player_end'))))
64 menu
.Append(i
, t
[0], t
[1])
65 EVT_MENU(self
, i
, t
[2])
68 toolBar
.AddLabelTool(i
, t
[0].replace('&',''), geticon(t
[3]), longHelp
=t
[1])
70 toolBar
.AddSimpleTool(i
, geticon(t
[3]), t
[0].replace('&',''), t
[1])
71 EVT_TOOL(self
, i
, t
[2])
72 EVT_TOOL_RCLICKED(self
, i
, self
.OnToolRClick
)
74 menu
.AppendSeparator()
76 menuBar
.Append(menu
, m
[0])
77 toolBar
.AddSeparator()
79 self
.SetMenuBar(menuBar
)
81 EVT_MENU_HIGHLIGHT_ALL(self
, self
.OnMenuHighlight
)
83 def OnMenuHighlight(self
, event
):
84 # Show how to get menu item imfo from this event handler
85 id = event
.GetMenuId()
86 item
= self
.GetMenuBar().FindItemById(id)
90 event
.Skip() # but in this case just call Skip so the default is done
92 def CloseWindow(self
, event
):
95 def OnToolClick(self
, event
):
96 tb
= self
.GetToolBar()
97 #tb.EnableTool(10, not tb.GetToolEnabled(10))
99 def OnToolRClick(self
, event
):
102 def OnNewWindow(self
, evt
):
103 self
.mainWin
.workWin
.NewProject()
105 def OnExit(self
, evt
):
108 class MyCanvas(wxScrolledWindow
):
109 def __init__(self
, win
):
110 wxScrolledWindow
.__init
__(self
, win
)
111 self
.SetBackgroundColour('White')
113 class MainWindow(wxSplitterWindow
):
114 def __init__(self
, parent
):
115 wxSplitterWindow
.__init
__(self
, parent
, -1)
118 self
.workWin
= WorkPanel(self
)
121 self
.bottomWin
= BottomWindow(self
)
123 self
.SetMinimumPaneSize(5)
124 self
.SplitHorizontally(self
.workWin
, self
.bottomWin
, 200)
127 class BottomWindow(wxSplitterWindow
):
128 def __init__(self
, parent
):
129 wxSplitterWindow
.__init
__(self
, parent
, -1)
132 self
.sandboxWin
= SandboxPanel(self
)
135 self
.infoboxWin
= InfoboxPanel(self
)
137 self
.SetMinimumPaneSize(5)
138 self
.SplitVertically(self
.sandboxWin
, self
.infoboxWin
, 250)
143 import wx
# This module uses the new wx namespace
144 #print "wx.VERSION_STRING = ", wx.VERSION_STRING
148 #----------------------------------------------------------------------------
151 class RunApp(wx
.App
):
153 wx
.App
.__init
__(self
, 0)
156 wx
.InitAllImageHandlers()
157 wx
.Log_SetActiveTarget(wx
.LogStderr())
162 self
.SetTopWindow(win
)
166 def OnCloseFrame(self
, evt
):
167 if hasattr(self
, "window") and hasattr(self
.window
, "ShutdownDemo"):
168 self
.window
.ShutdownDemo()