forked from openlp/openlp
Fixes to stop problems from last release
Add new Icons and ability to display Various code fixes from review comments. bzr-revno: 433
This commit is contained in:
commit
ef27be093c
|
@ -65,3 +65,4 @@ class OpenLP(QtGui.QApplication):
|
|||
if __name__ == '__main__':
|
||||
app = OpenLP(sys.argv)
|
||||
app.run()
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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.))
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
@ -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_()
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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_()
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
</qresource>
|
||||
<qresource prefix="graphics" >
|
||||
<file>splash-screen-new.bmp</file>
|
||||
<file>splash-screen-2.png</file>
|
||||
<file>openlp2.png</file>
|
||||
<file>about-new.bmp</file>
|
||||
</qresource>
|
||||
<qresource prefix="imports" >
|
||||
|
|
Loading…
Reference in New Issue