forked from openlp/openlp
Initial commit of wxPython foundational classes
bzr-revno: 2
This commit is contained in:
parent
018a5ecae8
commit
ef646e6411
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Ignore compiled python files
|
||||
*.pyc
|
19
controller.py
Normal file
19
controller.py
Normal file
@ -0,0 +1,19 @@
|
||||
"""
|
||||
|
||||
wx.Notebook that contains controls from each module
|
||||
|
||||
"""
|
||||
|
||||
import wx
|
||||
|
||||
class Controller(wx.Notebook):
|
||||
"wx.Notebook for modules"
|
||||
|
||||
def __init__(self, parent, *args, **kwargs):
|
||||
"Notebook constructor"
|
||||
|
||||
wx.Notebook.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
self.AddPage(wx.Panel(self), "foo module")
|
||||
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
86
mainframe.py
Normal file
86
mainframe.py
Normal file
@ -0,0 +1,86 @@
|
||||
"""
|
||||
|
||||
wx.Frame for the main OpenLP.org window
|
||||
|
||||
"""
|
||||
|
||||
import wx
|
||||
|
||||
import mainpanel
|
||||
|
||||
class MainFrame(wx.Frame):
|
||||
"Main OpenLP.org frame"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"MainFrame constructor"
|
||||
|
||||
wx.Frame.__init__(self, *args, **kwargs)
|
||||
|
||||
MenuBar = wx.MenuBar()
|
||||
|
||||
FileMenu = wx.Menu()
|
||||
|
||||
item = FileMenu.Append(wx.ID_EXIT, text = "&Exit")
|
||||
self.Bind(wx.EVT_MENU, self.OnQuit, item)
|
||||
|
||||
item = FileMenu.Append(wx.ID_ANY, text = "&Open")
|
||||
self.Bind(wx.EVT_MENU, self.OnOpen, item)
|
||||
|
||||
item = FileMenu.Append(wx.ID_PREFERENCES, text = "&Preferences")
|
||||
self.Bind(wx.EVT_MENU, self.OnPrefs, item)
|
||||
|
||||
MenuBar.Append(FileMenu, "&File")
|
||||
|
||||
HelpMenu = wx.Menu()
|
||||
|
||||
item = HelpMenu.Append(wx.ID_HELP, "OpenLP.org &Help")
|
||||
self.Bind(wx.EVT_MENU, self.OnHelp, item)
|
||||
|
||||
# This gets put in the App menu on OS X
|
||||
item = HelpMenu.Append(wx.ID_ABOUT, "&About")
|
||||
self.Bind(wx.EVT_MENU, self.OnAbout, item)
|
||||
|
||||
MenuBar.Append(HelpMenu, "&Help")
|
||||
|
||||
self.SetMenuBar(MenuBar)
|
||||
|
||||
self.Panel = mainpanel.MainPanel(self)
|
||||
|
||||
self.Fit()
|
||||
|
||||
|
||||
def OnQuit(self,Event):
|
||||
self.Destroy()
|
||||
|
||||
|
||||
def OnAbout(self, event):
|
||||
dlg = wx.MessageDialog(self, "This is a small program to test\n"
|
||||
"the use of menus on Mac, etc.\n",
|
||||
"About Me", wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
def OnHelp(self, event):
|
||||
dlg = wx.MessageDialog(self, "This would be help\n"
|
||||
"If there was any\n", "Test Help", wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
def OnOpen(self, event):
|
||||
dlg = wx.MessageDialog(self, "This would be an open Dialog\n"
|
||||
"If there was anything to open\n", "Open File",
|
||||
wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
def OnPrefs(self, event):
|
||||
dlg = wx.MessageDialog(self, "This would be an preferences Dialog\n"
|
||||
"If there were any preferences to set.\n",
|
||||
"Preferences", wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
29
mainpanel.py
Normal file
29
mainpanel.py
Normal file
@ -0,0 +1,29 @@
|
||||
"""
|
||||
|
||||
wx.Panel for operator interface
|
||||
|
||||
"""
|
||||
|
||||
import wx
|
||||
|
||||
import controller
|
||||
import oos
|
||||
|
||||
class MainPanel(wx.Panel):
|
||||
"Operator interface"
|
||||
|
||||
def __init__(self, parent, *args, **kwargs):
|
||||
"Panel constructor"
|
||||
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
controlbook = controller.Controller(self)
|
||||
oospanel = oos.OrderOfService(self)
|
||||
|
||||
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
sizer.Add(oospanel, 0, wx.ALL, 10)
|
||||
sizer.Add(controlbook, 1, wx.TOP|wx.BOTTOM|wx.LEFT, 10)
|
||||
|
||||
self.SetSizerAndFit(sizer)
|
||||
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
30
oos.py
Normal file
30
oos.py
Normal file
@ -0,0 +1,30 @@
|
||||
"""
|
||||
|
||||
Order of Service panel
|
||||
|
||||
"""
|
||||
|
||||
# TODO: change this from a list box to our own custom widget to allow the
|
||||
# traditional OpenLP OOS entry with an icon
|
||||
|
||||
import wx
|
||||
|
||||
class OrderOfService(wx.Panel):
|
||||
"Order Of Service Panel"
|
||||
|
||||
def __init__(self, parent, *args, **kwargs):
|
||||
"Panel constructor"
|
||||
|
||||
wx.Panel.__init__(self, parent, *args, **kwargs)
|
||||
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.list = wx.ListBox(self, size=wx.Size(140, 250))
|
||||
|
||||
self.list.Append("foo")
|
||||
|
||||
sizer.Add(self.list, 1, wx.BOTTOM, 10)
|
||||
|
||||
self.SetSizerAndFit(sizer)
|
||||
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
44
openlp.py
Executable file
44
openlp.py
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
|
||||
Entry point for OpenLP wx.App
|
||||
|
||||
"""
|
||||
|
||||
import wx
|
||||
|
||||
import mainframe
|
||||
|
||||
|
||||
class OpenLP(wx.PySimpleApp):
|
||||
def OnInit(self):
|
||||
frame = mainframe.MainFrame(None, title="OpenLP.org")
|
||||
frame.Show()
|
||||
|
||||
import sys
|
||||
for f in sys.argv[1:]:
|
||||
self.OpenFileMessage(f)
|
||||
|
||||
return True;
|
||||
|
||||
|
||||
def OpenFileMessage(self, filename):
|
||||
|
||||
# TODO: OOS loading here
|
||||
# rename function, too
|
||||
|
||||
dlg = wx.MessageDialog(None,
|
||||
"This app was just asked to open:\n%s\n"%filename,
|
||||
"File Opened", wx.OK|wx.ICON_INFORMATION)
|
||||
|
||||
|
||||
def MacOpenFile(self, filename):
|
||||
self.OpenFileMessage(filename)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = OpenLP()
|
||||
app.MainLoop()
|
||||
|
||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
Loading…
Reference in New Issue
Block a user