Added copyright to all files.

bzr-revno: 36
This commit is contained in:
Raoul Snyman 2008-10-23 19:49:13 +00:00
parent a1bc7f9e83
commit 8f8053d706
27 changed files with 5694 additions and 5649 deletions

View File

@ -0,0 +1,17 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""

View File

@ -0,0 +1,17 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""

View File

@ -1,31 +0,0 @@
import wx
class Canvas(wx.Window):
def __init__(self, parent, *args, **kwargs):
wx.Window.__init__(self, parent, *args, **kwargs)
self.SetBackgroundColour(wx.Colour(150,150,150))
self.Bind(wx.EVT_PAINT, self.OnPaint)
def OnPaint(self, event):
DC = wx.PaintDC(self)
if (self.GetSize().GetWidth()*3/4) > self.GetSize().GetHeight():
Height = self.GetSize().GetHeight()-40
Width = (Height*4)/3
x = (self.GetSize().GetWidth()-Width)/2
Rectangle = wx.Rect(x, 20, Width, Height)
else:
Width = self.GetSize().GetWidth()-40
Height = (Width*3)/4
y = (self.GetSize().GetHeight()-Height)/2
Rectangle = wx.Rect(20, y, Width, Height)
DC.SetBrush(wx.Brush(wx.Colour(0,0,0)))
DC.SetPen(wx.Pen(wx.Colour(255,255,255)))
if self.IsExposedRect(Rectangle):
DC.DrawRectangleRect(Rectangle)

View File

@ -1,65 +0,0 @@
"""
The openlp.org Control Panel
"""
import wx
from openlp.controls import slidepanel
class ControlPanel(wx.Window):
Title = ""
Heading1 = ""
Heading2 = ""
Loaded = False;
def __init__(self, parent, title, *args, **kwargs):
wx.Window.__init__(self, parent, *args, **kwargs)
MainSizer = wx.BoxSizer(wx.VERTICAL)
MainSizer.AddSpacer(60)
self.Title = title
self.SlidePanel = slidepanel.SlidePanel(self)
MainSizer.Add(self.SlidePanel, flag=wx.EXPAND)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.SetSizer(MainSizer)
self.SetAutoLayout(True)
self.Layout()
def OnPaint(self, event):
DC = wx.PaintDC(self)
DC.SetFont(wx.Font(pointSize=16, family=wx.FONTFAMILY_MODERN, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD,underline=False,face="Tahoma"))
DC.DrawText(text=self.Title,x=(self.GetSize().GetWidth()-DC.GetTextExtent(self.Title)[0])/2,y=0)
y = DC.GetTextExtent(self.Title)[1]
DC.SetFont(wx.Font(pointSize=12, family=wx.FONTFAMILY_MODERN, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_BOLD,underline=False,face="Tahoma"))
DC.SetBrush(wx.Brush(wx.Colour(55,102,255)))
DC.SetPen(wx.Pen(wx.Colour(55,102,255)))
fontHeight = DC.GetTextExtent("by")[1]
DC.DrawRectangle(0,y,self.GetSize().GetWidth(),fontHeight);
DC.SetTextForeground(wx.Colour(255,255,255))
if self.Heading1 == "":
DC.DrawText("No media item loaded",5,y)
else:
DC.DrawText(self.Heading1,5,y)
DC.SetFont(wx.Font(pointSize=10, family=wx.FONTFAMILY_MODERN, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL,underline=False,face="Tahoma"))
DC.DrawRectangle(0,fontHeight+y,self.GetSize().GetWidth(),fontHeight)
DC.DrawText(self.Heading2,5,fontHeight+y)
self.SlidePanel.Refresh()
def OnSize(self, event):
self.Layout()

View File

@ -1,32 +0,0 @@
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,80 +0,0 @@
import wx
class Slide(wx.Window):
SlideNum = 0
Selected = False
SlideText = ""
SlideType = ""
def __init__(self, parent, slideText, slideNum, slideType, *args, **kwargs):
wx.Window.__init__(self, parent, *args, **kwargs)
self.SlideText = slideText
self.SlideNum = slideNum
self.SlideType = slideType
self.Bind(wx.EVT_MOUSEDOWN, self.OnMouseDown)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def GetHeight(self):
DC = wx.ClientDC(self)
DC.SetFont(wx.Font(pointSize=8, family=wx.FONTFAMILY_MODERN, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL,underline=False,face="Tahoma"))
FontHeight = DC.GetTextExtent("by")[1]
Tokenizer = wx.StringTokenizer(self.SlideText,"\n")
ArrayString = wx.ArrayString()
while Tokenizer.HasMoreTokens():
Token = Tokenizer.GetNextToken()
ArrayString.Add(Token)
return FontHeight*(ArrayString.Count()+1)
def GetIndex(self):
return self.SlideNum
def SetSelected(self):
if not self.Selected:
self.Selected = True
Refresh()
def DropSelected(self):
if self.Selected:
self.Selected = False
Refresh()
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"))
if self.Selected:
Colour = wx.Colour(0,26,102)
else:
Colour = wx.Colour(55,102,255)
DC.SetBrush(wx.Brush(Colour))
DC.SetPen(wx.Pen(Colour))
FontHeight = DC.GetTextExtent("by")[1]
DC.DrawRectangle(0,0,self.GetParent().GetSize().GetWidth(),FontHeight)
DC.SetTextForeground(wx.Colour(255,255,255))
DC.DrawText(self.SlideType,5,0)
Tokenizer = wx.StringTokenizer(self.SlideText,"\n")
ArrayString = wx.ArrayString()
while Tokenizer.HasMoreTokens():
Token = Tokenizer.GetNextToken()
ArrayString.Add(Token)
self.SetSize(wx.Size(self.GetParent().GetSize().GetWidth(),FontHeight*(ArrayString.Count()+1)))
DC.SetBrush(wx.Brush(wx.Colour(255,255,255)))
DC.SetPen(wx.Pen(wx.Colour(255,255,255)))
DC.DrawRectangle(0,FontHeight,self.GetSize().GetWidth(),self.GetSize().GetHeight()-FontHeight)
DC.SetTextForeGround(wx.Colour(0,0,0))
for i in range(0,ArrayString.Count()):
DC.DrawText(ArrayString.Item(i),5,(i+1)*FontHeight)
def OnMouseDown(self, event):
self.GetParent().SetSelected(self.SlideNum)

View File

@ -1,30 +0,0 @@
import wx
from openlp.controls import slide
class SlidePanel(wx.Window):
SlideEnum = 1
NextY = 0
def __init__(self, parent, *args, **kwargs):
wx.Window.__init__(self, parent, *args, **kwargs)
def AddSlide(self, slideText, slideType):
slide = slide.Slide(self, pos=wx.Point(0,self.NextY+10), slideText=slideText, slideNum=self.SlideEnum, slideType=slideType)
self.SlideEnum = self.SlideEnum+1
self.NextY = self.NextY + slide.GetHeight()+10
self.SetVirtualSize(self.GetSize().GetWidth(),self.NextY)
self.SetScrollRate(1,1)
slide.Refresh()
def SetSelected(self, index):
WindowList = self.GetChildren()
for Node in WindowList:
Current = Node.GetData()
if Current.GetIndex() == index:
Current.SetSelected()
else:
Current.DropSelected()

View File

@ -1,2 +1,20 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from openlp.core.render import Renderer
from openlp.core.settingsmanager import SettingsManager

View File

@ -1,3 +1,21 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
# useful linear interpolation routines
def interp1(val1, val2, fraction):

View File

@ -1,3 +1,21 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import sys
from PyQt4 import QtGui, QtCore, Qt
@ -37,7 +55,7 @@ class Renderer:
if self._paint is not None:
self.scale_bg_image()
def scale_bg_image(self):
assert self._paint
assert self._paint
i=QtGui.QImage(self._bg_image_filename)
# rescale and offset
imw=i.width();imh=i.height()
@ -56,7 +74,7 @@ class Renderer:
self.background_offsetx=(dcw-neww)/2
self.background_offsety=(dch-newh)/2
self.img=QtGui.QPixmap.fromImage(i.scaled(QtCore.QSize(neww, newh), Qt.Qt.KeepAspectRatio))
def set_paint_dest(self, p):
self._paint=p
if self._bg_image_filename is not None:
@ -73,7 +91,7 @@ class Renderer:
verses_text=[]
for v in verses:
verses_text.append('\n'.join(v).lstrip()) # remove first \n
return verses_text
def render_screen(self, screennum):
print "render screen\n", screennum, self.words[screennum]
@ -82,7 +100,7 @@ class Renderer:
words=self.words[screennum]
retval=self._render_lines(words)
return retval
def set_text_rectangle(self, rect):
""" Sets the rectangle within which text should be rendered"""
self._rect=rect
@ -190,14 +208,14 @@ class Renderer:
endline+=1
return retval
def _render_lines(self, lines):
"""render a set of lines according to the theme, return bounding box"""
print "_render_lines", lines
bbox=self._render_lines_unaligned(lines)
t=self._theme
x=self._rect.left()
if t.VerticalAlign==0: # top align
@ -279,7 +297,7 @@ class Renderer:
else:
lastword-=1
thisline=' '.join(words[:lastword])
# print "This is how they split", lines
# print "Now render them"
startx=x
@ -288,7 +306,7 @@ class Renderer:
t=self._theme
align=t.HorizontalAlign
wrapstyle=t.WrapStyle
for linenum in range(len(lines)):
line=lines[linenum]
#find out how wide line is
@ -327,7 +345,7 @@ class Renderer:
self._get_extent_and_render(line, (x-self._outline_offset,y+self._outline_offset), dodraw=True, color = t.OutlineColor)
self._get_extent_and_render(line, (x+self._outline_offset,y-self._outline_offset), dodraw=True, color = t.OutlineColor)
self._get_extent_and_render(line, (x-self._outline_offset,y-self._outline_offset), dodraw=True, color = t.OutlineColor)
self._get_extent_and_render(line, tlcorner=(x,y), dodraw=True)
# print "Line %2d: Render '%s' at (%d, %d) wh=(%d,%d)"%( linenum, line, x, y,w,h)
y += h
@ -340,7 +358,7 @@ class Renderer:
p.setPen(QtGui.QPen(QtGui.QColor(0,255,0)))
p.drawRect(startx,starty,rightextent-startx,y-starty)
p.end()
brcorner=(rightextent,y)
return brcorner
@ -378,6 +396,6 @@ class Renderer:
return (w, h)

View File

@ -1,3 +1,21 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
class SettingsManager(object):
def __init__(self):
pass

View File

@ -1,3 +1,21 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import time
import sys
import os, os.path
@ -42,7 +60,7 @@ class TestRender_base:
# though This means that the py.test runs both test modules in
# sequence and the second one tries to create another application
# which gives us errors :(
def setup_class(self):
print "class setup", self
try:
@ -51,7 +69,7 @@ class TestRender_base:
except AttributeError: # didn't have one
print "No app"
self.app = None
print "Test app (should be None)"
if self.app is None:
print "App is None"
@ -59,7 +77,7 @@ class TestRender_base:
else:
print "class setup, app is", app
# self.app = QtGui.QApplication([])
def teardown_class(self):
print "class quit", self, self.app
self.app.quit()
@ -94,7 +112,7 @@ class TestRender_base:
self.expected_answer="Don't know yet"
self.answer=None
print "--------------- Setup Done -------------"
def teardown_method(self, method):
self.write_to_file(self.frame.GetPixmap(), "test_render")
@ -181,7 +199,7 @@ Line 3"""
print answer
self.write_to_file(self.frame.GetPixmap(), "split_test_%03d"% i)
print number, i, answer.x(), answer.y(), answer.width(), answer.height()
e=expected_answers[i]
assert(answer==QtCore.QRect(e[0],e[1],e[2],e[3]))
@ -197,7 +215,7 @@ Line 3"""
self.split_test(6, 1, [(0,0,180,378)])
self.split_test(8, 1, [(0,0,180,504)])
if __name__=="__main__":
t=TestRender()
t.setup_class()
t.setup_method(None)

View File

@ -1,3 +1,21 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from test_render import TestRender_base, whoami
import sys
import os
@ -32,7 +50,7 @@ And drives away his fear.
def teardown_method(self, method):
print "============ teardown =============", method, self.bmpname
if self.bmpname != None:
if self.bmpname != None:
assert (self.compare_DC_to_file(self.bmpname))
if self.expected_answer != None: # result=None => No result to check
assert self.expected_answer==self.answer
@ -58,7 +76,7 @@ And drives away his fear.
else:
print name, goldenfilename, "Images don't match"
return False
def test_theme_basic(self):
self.answer=self.r.render_screen(0)
self.bmpname=whoami()
@ -236,7 +254,7 @@ And drives away his fear.
self.answer=self.r.render_screen(0)
hoffset=self.r._shadow_offset+2*(self.r._outline_offset)
voffset=hoffset * (len(self.r.words[0])+1)
self.expected_answer= QtCore.QRect(0, 0, 559+hoffset, 342+voffset)
self.bmpname=whoami()
# }}}
@ -250,7 +268,7 @@ And drives away his fear.
self.answer=self.r.render_screen(0)
self.expected_answer= QtCore.QRect(0, 0, 499, 336)
self.bmpname=whoami()
if __name__=="__main__":
t=TestRenderTheme()

View File

@ -1,3 +1,21 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import os, os.path
import sys
mypath=os.path.split(os.path.abspath(__file__))[0]
@ -7,17 +25,17 @@ from openlp.utils import ConfigHelper
from openlp.database.BibleImpl import *
class BibleManager:
def __init__(self):
def __init__(self):
"""
Finds all the bibles defined for the system
Creates an Interface Object for each bible containing connection information
Throws Exception if no Bibles are found.
Init confirms the bible exists and stores the database path.
Init confirms the bible exists and stores the database path.
"""
#if bible != "niv" and bible !="message":
# raise Exception('Unsupported bible requested ' + bible)
self.biblelist = {}
self.biblePath = ConfigHelper.getBiblePath()
#print self.biblePath
@ -26,9 +44,9 @@ class BibleManager:
b = f.split('.')[0]
self.biblelist[b] = BibleImpl(b)
#print self.biblelist
def getBibles(self):
"""
Returns a list of Books of the bible
@ -37,21 +55,21 @@ class BibleManager:
for b , o in self.biblelist.iteritems():
r.append(b)
return r
def getBibleBooks(self,bible):
"""
Returns a list of the books of the bible
"""
return ["Gen","Exd","Matt","Mark"]
def getBookVerseCount(self, bible, book, chapter):
"""
Returns all the number of verses for a given
Returns all the number of verses for a given
book and chapter
"""
return 28
def getVerseText(self, bible,book, chapter, sverse, everse):
def getVerseText(self, bible,book, chapter, sverse, everse):
"""
Returns a list of verses for a given Book, Chapter and ranges of verses.
If the end verse(everse) is less then the start verse(sverse)

View File

@ -0,0 +1,18 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""

View File

@ -0,0 +1,18 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""

View File

@ -1,3 +1,21 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import random
import unittest
@ -9,7 +27,7 @@ sys.path.insert(0,(os.path.join(mypath, '..', '..','..')))
from openlp.database.BibleManager import *
class TestBibleManager(unittest.TestCase):
def setUp(self):
self.bm = BibleManager()
@ -25,15 +43,15 @@ class TestBibleManager(unittest.TestCase):
for c1 in c:
print c1
self.assert_(c1 in c)
def testGetBooks(self):
self.failUnless(self.bm.getBookVerseCount("NIV", "GEN", 1) == 28, "Wrong Book Count")
def testGetVerseText(self):
c = self.bm.getVerseText("NIV","GEN",1,2,1)
for c1 in c:
print c1
print c1
self.assert_(c1 in c)
if __name__ == '__main__':
unittest.main()

View File

@ -1 +1,19 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from theme import Theme

View File

@ -1,3 +1,21 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import os
import sys
mypath=os.path.split(os.path.abspath(__file__))[0]
@ -43,11 +61,11 @@ def test_read_theme():
assert(t.Shadow == 0)
assert(t.VerticalAlign == 0)
print "Tests passed"
def test_theme():
test_read_theme()
if __name__=="__main__":
test_read_theme()

View File

@ -1,9 +1,27 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import platform
ver = platform.python_version()
if ver >= '2.5':
from xml.etree.ElementTree import ElementTree, XML
from xml.etree.ElementTree import ElementTree, XML
else:
from elementtree import ElementTree, XML
from elementtree import ElementTree, XML
from PyQt4 import QtGui
@ -35,7 +53,7 @@ class Theme:
""" stores the info about a theme
attributes:
name : theme name
BackgroundType : 0 - solid color
1 - gradient color
2 - image
@ -48,7 +66,7 @@ class Theme:
for solid - N/A
BackgroundParameter3 : for image - N/A
for gradient - 0 -> vertical, 1 -> horizontal
FontName : name of font to use
FontColor : color for main font
FontProportion : point size of font
@ -102,13 +120,13 @@ class Theme:
# print "nope",
pass
elif DelphiColors.has_key(t):
# print "colour",
# print "colour",
val=DelphiColors[t]
else:
# print "last chance",
try:
val=int(t)
# print "int",
# print "int",
except ValueError:
# print "give up",
val=t
@ -118,7 +136,7 @@ class Theme:
val= QtGui.QColor((val>>16) & 0xFF, (val>>8)&0xFF, val&0xFF)
# print [val]
setattr(self,element.tag, val)
def __str__(self):
s=""

View File

@ -0,0 +1,18 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,21 @@
# -*- coding: utf-8 -*-
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
"""
This is the main window for openlp.org 2.0

View File

@ -0,0 +1,18 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""

View File

@ -1,92 +0,0 @@
"""
wx.Frame for the main OpenLP.org window
"""
import wx
from openlp.controls import controlpanel
from openlp.controls import canvas
from openlp.controls import mediamanager
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()
MenuBar.Append(FileMenu, "&File")
self.SetMenuBar(MenuBar)
self.MainSplitter = wx.SplitterWindow(self, size=self.GetClientSize(), style=wx.SP_3D)
self.PreviewSplitter = wx.SplitterWindow(self.MainSplitter, size=self.MainSplitter.GetClientSize(), style=wx.SP_3D)
self.LiveSplitter = wx.SplitterWindow(self.MainSplitter, size=self.MainSplitter.GetClientSize(), style=wx.SP_3D)
LiveControlPanel = controlpanel.ControlPanel(self.LiveSplitter,title="Live")
PreviewControlPanel = controlpanel.ControlPanel(self.PreviewSplitter,title="Preview")
LiveCanvas = canvas.Canvas(self.LiveSplitter)
PreviewCanvas = canvas.Canvas(self.PreviewSplitter)
self.MainSplitter.SplitVertically(self.PreviewSplitter, self.LiveSplitter)
self.LiveSplitter.SplitHorizontally(LiveControlPanel,LiveCanvas)
self.PreviewSplitter.SplitHorizontally(PreviewControlPanel,PreviewCanvas)
self.MainSplitter.SetMinimumPaneSize(200)
self.LiveSplitter.SetMinimumPaneSize(200)
self.PreviewSplitter.SetMinimumPaneSize(200)
MainSizer = wx.BoxSizer(wx.HORIZONTAL)
MediaManager = mediamanager.MediaManager(self, size=wx.Size(200,200))
OrderOfServiceFrame = wx.Panel(self, size=wx.Size(200,200))
self.SetSizer(MainSizer)
MainSizer.Add(MediaManager, flag=wx.EXPAND)
MainSizer.Add(self.MainSplitter, proportion=1, flag=wx.EXPAND)
MainSizer.Add(OrderOfServiceFrame, flag=wx.EXPAND)
self.CreateStatusBar(1)
self.SetStatusText("openlp.org")
MainSizer.SetSizeHints(self)
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)
def LiveSplitterOnChanged(self,event):
WindowList = self.LiveSplitter.GetChildren()
for Node in WindowList:
Node.Refresh()
def PreviewSplitterOnChanged(self,event):
WindowList = self.PreviewSplitter.GetChildren()
for Node in WindowList:
Node.Refresh()
def OnSize(self,event):
self.Layout()
self.MainSplitterOnChanged(event)
self.LiveSplitterOnChanged(event)
self.PreviewSplitterOnChanged(event)

View File

@ -1,12 +1,30 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import os
# Utility Helper to allow classes to find directories in a standard manner
def get_registry_value(reg, key, value_name):
k = _winreg.OpenKey(reg, key)
value = _winreg.QueryValueEx(k, value_name)[0]
_winreg.CloseKey(k)
return value
k = _winreg.OpenKey(reg, key)
value = _winreg.QueryValueEx(k, value_name)[0]
_winreg.CloseKey(k)
return value
def getConfigPath():
if os.name == 'nt':
@ -16,7 +34,7 @@ def getConfigPath():
path = get_registry_value(reg, key, "Common AppData")
elif os.name == 'posix':
path = os.path.join(os.getenv('HOME'), ".openlp.org")
if os.path.exists(path) == False :
if os.path.exists(path) == False :
raise Exception ('Configuration Directory does not Exist ')
return path
@ -29,4 +47,4 @@ def getSongsFile():
def getBiblePath():
return os.path.join(getConfigPath(), "Data","Bibles")

View File

@ -1 +1,19 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""