diff --git a/openlp.pyw b/openlp.pyw
index 3ba640de2..388376a48 100755
--- a/openlp.pyw
+++ b/openlp.pyw
@@ -65,3 +65,4 @@ class OpenLP(QtGui.QApplication):
if __name__ == '__main__':
app = OpenLP(sys.argv)
app.run()
+
diff --git a/openlp/__init__.py b/openlp/__init__.py
index 1870f3b96..e614bce89 100644
--- a/openlp/__init__.py
+++ b/openlp/__init__.py
@@ -18,7 +18,4 @@ Place, Suite 330, Boston, MA 02111-1307 USA
__all__ = ['convertStringToBoolean']
def convertStringToBoolean(stringvalue):
- if stringvalue.lower() == 'true':
- return True
- else:
- return False
+ return stringvalue.strip().lower() in (u'true', u'yes', u'y')
diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py
index 0356e084a..e29e5e3b3 100644
--- a/openlp/core/lib/renderer.py
+++ b/openlp/core/lib/renderer.py
@@ -51,6 +51,7 @@ class Renderer:
self._bg_image_filename=None
self._paint=None
self._path = path
+ self.img = None
def set_debug(self, debug):
self._debug=debug
@@ -58,7 +59,8 @@ class Renderer:
def set_theme(self, theme):
self._theme=theme
if theme.background_type == u'image':
- self.set_bg_image(theme.background_filename)
+ if self._path is not None:
+ self.set_bg_image(theme.background_filename)
def set_bg_image(self, filename):
log.debug(u'set bg image %s', filename)
@@ -167,7 +169,10 @@ class Renderer:
#log.debug(u' Background Parameter %d ', self._theme.background_color1)
#if self._theme.background_color1 is not None:
# p.fillRect(self._paint.rect(), self._theme.background_borderColor)
- p.drawPixmap(self.background_offsetx,self.background_offsety, self.img)
+ if self.img is not None:
+ p.drawPixmap(self.background_offsetx,self.background_offsety, self.img)
+ else:
+ p.fillRect(self._paint.rect(), QtGui.QColor(u'#000000'))
p.end()
log.debug(u'render background done')
@@ -246,22 +251,22 @@ class Renderer:
assert(0, u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)
return x, y
- def render_lines(self, lines, lines1=None):
+ def render_lines(self, lines, footer_lines=None):
"""render a set of lines according to the theme, return bounding box"""
#log.debug(u'_render_lines %s', lines)
bbox=self._render_lines_unaligned(lines, False) # Main font
- if lines1 is not None:
- bbox1=self._render_lines_unaligned(lines1, True) # Footer Font
+ if footer_lines is not None:
+ bbox1=self._render_lines_unaligned(footer_lines, True) # Footer Font
# put stuff on background so need to reset before doing the job properly.
self._render_background()
x, y = self._correctAlignment(self._rect, bbox)
bbox=self._render_lines_unaligned(lines, False, (x, y))
- if lines1 is not None:
+ if footer_lines is not None:
#x, y = self._correctAlignment(self._rect_footer, bbox1)
- bbox=self._render_lines_unaligned(lines1, True, (self._rect_footer.left(), self._rect_footer.top()) )
+ bbox=self._render_lines_unaligned(footer_lines, True, (self._rect_footer.left(), self._rect_footer.top()) )
log.debug(u'render lines DONE')
diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py
index 6c101a230..cbc6cde0d 100644
--- a/openlp/core/ui/__init__.py
+++ b/openlp/core/ui/__init__.py
@@ -18,6 +18,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
+from maindisplay import MainDisplay
from amendthemeform import AmendThemeForm
from slidecontroller import SlideController
from splashscreen import SplashScreen
@@ -32,4 +33,4 @@ from thememanager import ThemeManager
from mainwindow import MainWindow
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
- 'MainWindow', 'SlideController', 'ServiceManager', 'ThemeManager', 'AmendThemeForm']
+ 'MainWindow', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'AmendThemeForm']
diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py
index 82a2c9f3d..f5b5ec7b6 100644
--- a/openlp/core/ui/amendthemeform.py
+++ b/openlp/core/ui/amendthemeform.py
@@ -106,7 +106,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
new_theme.new_document(theme_name)
if self.theme.background_type == u'solid':
new_theme.add_background_solid(str(self.theme.background_color))
- elif self.theme.theme.background_type == u'gradient':
+ elif self.theme.background_type == u'gradient':
new_theme.add_background_gradient(str(self.theme.background_startColor), str(self.theme.background_endColor), self.theme.background_direction)
#else:
#newtheme.add_background_image(str(self.theme.))
diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py
new file mode 100644
index 000000000..c17bd2759
--- /dev/null
+++ b/openlp/core/ui/maindisplay.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+"""
+OpenLP - Open Source Lyrics Projection
+Copyright (c) 2008 Raoul Snyman
+Portions copyright (c) 2008-2009 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 PyQt4 import QtCore, QtGui
+
+from openlp.core import translate
+
+class MainDisplay(QtGui.QWidget):
+
+ def __init__(self, screens, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ self.setWindowTitle(u'OpenLP Display')
+ self.screens = screens
+ self.imagesize = screens[0][1]
+ self.display = QtGui.QLabel(self)
+ #self.showMinimized()
+
+ def initialView(self):
+ self.display.setGeometry((self.imagesize.width()-429)/2, (self.imagesize.height()-429)/2, 429, 429)
+ self.display.setPixmap(QtGui.QPixmap("openlp2.png"))
+ self.showMaximized()
+ print len(self.screens)
+ print self.isEnabled()
+ print self.isVisible()
+ print self.geometry()
+ #if len(self.screens) > 0:
+ self.showFullScreen()
+ self.show()
+
+ def frameView(self, frame):
+ self.display.setGeometry(0, 0, imagesize.width(), imagesize.height())
+ self.display.setPixmap(QtGui.QPixmap(frame))
+
+ def kill(self):
+ pass
+
+
+
diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py
index fce956780..a78be5040 100644
--- a/openlp/core/ui/mainwindow.py
+++ b/openlp/core/ui/mainwindow.py
@@ -24,10 +24,8 @@ from time import sleep
from PyQt4 import *
from PyQt4 import QtCore, QtGui
-from openlp.core.resources import *
-
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
- SlideController, ServiceManager, ThemeManager
+ SlideController, ServiceManager, ThemeManager, MainDisplay
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager, RenderManager
from openlp.core import PluginManager
@@ -39,6 +37,7 @@ class MainWindow(object):
def __init__(self, screens):
self.main_window = QtGui.QMainWindow()
+ self.main_display = MainDisplay(screens, self.main_window)
self.screen_list = screens
self.EventManager = EventManager()
self.alert_form = AlertForm()
@@ -89,10 +88,10 @@ class MainWindow(object):
# Once all components are initialised load the Themes
log.info(u'Load Themes')
- self.ThemeManagerContents.setEventManager(self.EventManager)
- self.ThemeManagerContents.setRenderManager(self.RenderManager)
- self.ServiceManagerContents.setRenderManager(self.RenderManager)
- self.ThemeManagerContents.setServiceManager(self.ServiceManagerContents)
+ self.ThemeManagerContents.eventManager = self.EventManager
+ self.ThemeManagerContents.renderManager = self.RenderManager
+ self.ServiceManagerContents.renderManager = self.RenderManager
+ self.ThemeManagerContents.serviceManager = self.ServiceManagerContents
self.ThemeManagerContents.loadThemes()
def setupUi(self):
@@ -421,8 +420,9 @@ class MainWindow(object):
self.ModeLiveItem.setText(QtGui.QApplication.translate("main_window", "&Live", None, QtGui.QApplication.UnicodeUTF8))
def show(self):
- sleep(2)
self.main_window.showMaximized()
+ self.main_display.initialView()
+ self.main_display.show()
def onHelpAboutItemClicked(self):
self.about_form.exec_()
diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py
index 81c272d17..db4b43c79 100644
--- a/openlp/core/ui/servicemanager.py
+++ b/openlp/core/ui/servicemanager.py
@@ -142,9 +142,6 @@ class ServiceManager(QWidget):
QtCore.QObject.connect(self.ThemeComboBox,
QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
- def setRenderManager(self, renderManager):
- self.renderManager = renderManager
-
def onThemeComboBoxSelected(self, currentIndex):
self.renderManager.set_default_theme(self.ThemeComboBox.currentText())
diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py
index 7d4fea3d5..70891242a 100644
--- a/openlp/core/ui/splashscreen.py
+++ b/openlp/core/ui/splashscreen.py
@@ -3,7 +3,7 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
-Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
+Portions copyright (c) 2008-2009 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
@@ -20,7 +20,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import QtCore, QtGui
-#from openlp.core.resources import *
from openlp.core import translate
class SplashScreen(object):
@@ -44,15 +43,8 @@ class SplashScreen(object):
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.splash_screen.setWindowIcon(icon)
- #self.verticalLayout = QtGui.QVBoxLayout(self.splash_screen)
- #self.verticalLayout.setSpacing(0)
- #self.verticalLayout.setMargin(0)
- #self.verticalLayout.setObjectName("verticalLayout")
- #self.SplashImage = QtGui.QLabel(self.splash_screen)
- #self.SplashImage.setPixmap(QtGui.QPixmap(":/graphics/splash-screen-new.bmp"))
- #self.SplashImage.setObjectName("SplashImage")
- #self.verticalLayout.addWidget(self.SplashImage)
- self.splash_screen.setPixmap(QtGui.QPixmap(":/graphics/splash-screen-new.bmp"))
+
+ self.splash_screen.setPixmap(QtGui.QPixmap(":/graphics/splash-screen-2.png"))
self.splash_screen.setWindowFlags(QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint)
self.retranslateUi()
diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py
index a40fc8af1..497c011b4 100644
--- a/openlp/core/ui/thememanager.py
+++ b/openlp/core/ui/thememanager.py
@@ -45,7 +45,7 @@ from openlp.core.utils import ConfigHelper
import logging
-class ThemeData(QAbstractItemModel):
+class ThemeData(QAbstractListModel):
"""
Tree of items for an order of Theme.
Includes methods for reading and writing the contents to an OOS file
@@ -55,7 +55,7 @@ class ThemeData(QAbstractItemModel):
log=logging.getLogger(u'ThemeData')
def __init__(self):
- QAbstractItemModel.__init__(self)
+ QAbstractListModel.__init__(self)
self.items=[]
self.rowheight=50
self.maximagewidth=self.rowheight*16/9.0;
@@ -64,9 +64,6 @@ class ThemeData(QAbstractItemModel):
def clearItems(self):
self.items=[]
- def columnCount(self, parent):
- return 1; # always only a single column (for now)
-
def rowCount(self, parent):
return len(self.items)
@@ -104,12 +101,6 @@ class ThemeData(QAbstractItemModel):
def addRow(self, item):
self.insertRow(len(self.items), item)
- def index(self, row, col, parent = QModelIndex()):
- return self.createIndex(row,col)
-
- def parent(self, index=QModelIndex()):
- return QModelIndex() # no children as yet
-
def data(self, index, role):
row=index.row()
if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row!
@@ -185,15 +176,6 @@ class ThemeManager(QWidget):
self.checkThemesExists(self.path)
self.amendThemeForm.themePath(self.path)
- def setEventManager(self, eventManager):
- self.eventManager = eventManager
-
- def setRenderManager(self, renderManager):
- self.renderManager = renderManager
-
- def setServiceManager(self, serviceManager):
- self.serviceManager = serviceManager
-
def onAddTheme(self):
self.amendThemeForm.loadTheme(None)
self.amendThemeForm.exec_()
diff --git a/resources/images/openlp-2.qrc b/resources/images/openlp-2.qrc
index 718f30ab7..a941b75bc 100644
--- a/resources/images/openlp-2.qrc
+++ b/resources/images/openlp-2.qrc
@@ -11,6 +11,8 @@
splash-screen-new.bmp
+ splash-screen-2.png
+ openlp2.png
about-new.bmp