Rearranging and adding MediaManager class also redefined plugin Interface

bzr-revno: 9
This commit is contained in:
Timothy Ebenezer 2008-03-04 01:08:01 +00:00
parent 9e3b588641
commit 8e912248d5
11 changed files with 95 additions and 71 deletions

40
openlp.pyw Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env pythonw
"""
Entry point for OpenLP wx.App
"""
import wx
from openlp.ui 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)
if __name__ == '__main__':
app = OpenLP()
app.MainLoop()
# vim: autoindent shiftwidth=4 expandtab textwidth=80

0
openlp/__init__.py Normal file
View File

View File

View File

@ -6,7 +6,7 @@ The openlp.org Control Panel
import wx
import slidepanel
from openlp.controls import slidepanel
class ControlPanel(wx.Window):

View File

@ -0,0 +1,32 @@
import wx
class MediaManager(wx.Window):
def __init__(self, parent, *args, **kwargs):
wx.Window.__init__(self, parent, *args, **kwargs)
MainSizer = wx.BoxSizer(wx.VERTICAL)
MainSizer.AddSpacer(20)
if wx.Platform == "__WXMAC__":
self.Notebook = wx.Choicebook(self, size=wx.Size(200,200))
else:
self.Notebook = wx.Notebook(self, size=wx.Size(200,200))
MainSizer.Add(self.Notebook, proportion=1, flag=wx.EXPAND)
self.SetSizer(MainSizer)
self.SetAutoLayout(True)
self.Layout()
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_SIZE, self.OnSize)
def OnPaint(self, event):
DC = wx.PaintDC(self)
DC.SetFont(wx.Font(pointSize=9, family=wx.FONTFAMILY_MODERN, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL,underline=False,face="Tahoma"))
DC.GradientFillLinear(wx.Rect(1,1,self.GetSize().GetWidth()-2,DC.GetTextExtent("by")[1]+2), wx.Colour(220,220,220), wx.Colour(255,255,255))
DC.DrawText("Media Manager", 6, 2)
def OnSize(self, event):
self.Layout()

View File

@ -1,6 +1,6 @@
import wx
import slide
from openlp.controls import slide
class SlidePanel(wx.Window):

0
openlp/ui/__init__.py Normal file
View File

View File

@ -5,8 +5,9 @@ wx.Frame for the main OpenLP.org window
"""
import wx
import controlpanel
import canvas
from openlp.controls import controlpanel
from openlp.controls import canvas
from openlp.controls import mediamanager
class MainFrame(wx.Frame):
"Main OpenLP.org frame"
@ -40,19 +41,14 @@ class MainFrame(wx.Frame):
self.LiveSplitter.SetMinimumPaneSize(200)
self.PreviewSplitter.SetMinimumPaneSize(200)
self.MainSplitter.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.MainSplitterOnChanged)
self.LiveSplitter.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.LiveSplitterOnChanged)
self.PreviewSplitter.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.PreviewSplitterOnChanged)
self.Bind(wx.EVT_SIZE, self.OnSize)
MainSizer = wx.BoxSizer(wx.HORIZONTAL)
MediaManagerFrame = wx.Panel(self, size=wx.Size(200,200))
MediaManager = mediamanager.MediaManager(self, size=wx.Size(200,200))
OrderOfServiceFrame = wx.Panel(self, size=wx.Size(200,200))
self.SetSizer(MainSizer)
MainSizer.Add(MediaManagerFrame, flag=wx.EXPAND)
MainSizer.Add(MediaManager, flag=wx.EXPAND)
MainSizer.Add(self.MainSplitter, proportion=1, flag=wx.EXPAND)
MainSizer.Add(OrderOfServiceFrame, flag=wx.EXPAND)
@ -64,7 +60,12 @@ class MainFrame(wx.Frame):
self.SetAutoLayout(True)
self.Layout()
self.MainSplitter.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.MainSplitterOnChanged)
self.LiveSplitter.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.LiveSplitterOnChanged)
self.PreviewSplitter.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.PreviewSplitterOnChanged)
self.Bind(wx.EVT_SIZE, self.OnSize)
def MainSplitterOnChanged(self,event):
self.MainSplitter.SetSashPosition(self.MainSplitter.GetClientSize().GetWidth()/2,True)

View File

@ -1,68 +1,19 @@
"""
Custom classes for plugins
Base Plugin class
"""
import wx
# OOSItem should be extended into a plugin-specific object that encapsulates
# the data needed for that plugin to reference back to its internal data
# (like the songid or the path to a video file)
class OOSItem:
"'Order of Service' entry item"
def __init__(self):
"OOSItem constructor"
self.title = "Scaffold item"
def gettitle(self):
"Accessor for title"
return self.title
def golive(self, window):
"Display this item onscreen"
pass
def blank(self, window):
"Blank the screen, plugin is allowed to keep data ready"
pass
def stop(self, window):
"Stop this plugin and destroy any canvases"
pass
# OLPPlugin describes a base class which will be extended by the each particular
# plugin. The plugin provides a series of objects to the host application:
# * panel to add to the control interface (class Controller)
# * operations for `go live', `[un]blank', `stop'
class OLPPlugin(wx.Panel):
class Plugin(Interface):
"Plugin type"
def __init__(self, parent, *args, **kwargs):
"Panel constructor"
wx.Panel.__init__(self, parent, *args, **kwargs)
oospanel = oos.OrderOfService(self)
self.goblank = wx.RadioButton(self, label="Blank Screen",
style=wx.RB_GROUP)
self.golive = wx.RadioButton(self, label="Go Live")
blankersizer = wx.BoxSizer(wx.HORIZONTAL)
blankersizer.AddStretchSpacer()
blankersizer.Add(self.goblank, 0, wx.RIGHT|wx.ALIGN_CENTER, 10)
blankersizer.Add(self.golive, 0, wx.ALIGN_CENTER)
blankersizer.AddStretchSpacer()
mainsizer = wx.BoxSizer(wx.VERTICAL)
mainsizer.Add(oospanel, 1, wx.GROW|wx.BOTTOM, 10)
mainsizer.Add(blankersizer, 0, wx.GROW)
self.SetSizer(mainsizer)
def __init__(self, mediaManager, *args, **kwargs):
"Plugin constructor called with mediaManager argument which allows adding to the
mediaManager - generally adding a page to mediaManager.Notebook"
def GetName():
"Return the plugins name for future plugin manager"
# vim: autoindent shiftwidth=4 expandtab textwidth=80