diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6d338714f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Ignore compiled python files +*.pyc diff --git a/controller.py b/controller.py new file mode 100644 index 000000000..0155037c1 --- /dev/null +++ b/controller.py @@ -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 diff --git a/mainframe.py b/mainframe.py new file mode 100644 index 000000000..6ff47e1b1 --- /dev/null +++ b/mainframe.py @@ -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 diff --git a/mainpanel.py b/mainpanel.py new file mode 100644 index 000000000..fdb88cf50 --- /dev/null +++ b/mainpanel.py @@ -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 diff --git a/oos.py b/oos.py new file mode 100644 index 000000000..26d3f58ee --- /dev/null +++ b/oos.py @@ -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 diff --git a/openlp.py b/openlp.py new file mode 100755 index 000000000..b349cc6d0 --- /dev/null +++ b/openlp.py @@ -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