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__':
|
if __name__ == '__main__':
|
||||||
app = OpenLP(sys.argv)
|
app = OpenLP(sys.argv)
|
||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
|
@ -18,7 +18,4 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
__all__ = ['convertStringToBoolean']
|
__all__ = ['convertStringToBoolean']
|
||||||
|
|
||||||
def convertStringToBoolean(stringvalue):
|
def convertStringToBoolean(stringvalue):
|
||||||
if stringvalue.lower() == 'true':
|
return stringvalue.strip().lower() in (u'true', u'yes', u'y')
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
@ -51,6 +51,7 @@ class Renderer:
|
|||||||
self._bg_image_filename=None
|
self._bg_image_filename=None
|
||||||
self._paint=None
|
self._paint=None
|
||||||
self._path = path
|
self._path = path
|
||||||
|
self.img = None
|
||||||
|
|
||||||
def set_debug(self, debug):
|
def set_debug(self, debug):
|
||||||
self._debug=debug
|
self._debug=debug
|
||||||
@ -58,7 +59,8 @@ class Renderer:
|
|||||||
def set_theme(self, theme):
|
def set_theme(self, theme):
|
||||||
self._theme=theme
|
self._theme=theme
|
||||||
if theme.background_type == u'image':
|
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):
|
def set_bg_image(self, filename):
|
||||||
log.debug(u'set bg image %s', 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)
|
#log.debug(u' Background Parameter %d ', self._theme.background_color1)
|
||||||
#if self._theme.background_color1 is not None:
|
#if self._theme.background_color1 is not None:
|
||||||
# p.fillRect(self._paint.rect(), self._theme.background_borderColor)
|
# 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()
|
p.end()
|
||||||
log.debug(u'render background done')
|
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)
|
assert(0, u'Invalid value for theme.VerticalAlign:%s' % self._theme.display_verticalAlign)
|
||||||
return x, y
|
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"""
|
"""render a set of lines according to the theme, return bounding box"""
|
||||||
#log.debug(u'_render_lines %s', lines)
|
#log.debug(u'_render_lines %s', lines)
|
||||||
|
|
||||||
bbox=self._render_lines_unaligned(lines, False) # Main font
|
bbox=self._render_lines_unaligned(lines, False) # Main font
|
||||||
if lines1 is not None:
|
if footer_lines is not None:
|
||||||
bbox1=self._render_lines_unaligned(lines1, True) # Footer Font
|
bbox1=self._render_lines_unaligned(footer_lines, True) # Footer Font
|
||||||
|
|
||||||
# put stuff on background so need to reset before doing the job properly.
|
# put stuff on background so need to reset before doing the job properly.
|
||||||
self._render_background()
|
self._render_background()
|
||||||
x, y = self._correctAlignment(self._rect, bbox)
|
x, y = self._correctAlignment(self._rect, bbox)
|
||||||
bbox=self._render_lines_unaligned(lines, False, (x, y))
|
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)
|
#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')
|
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
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from maindisplay import MainDisplay
|
||||||
from amendthemeform import AmendThemeForm
|
from amendthemeform import AmendThemeForm
|
||||||
from slidecontroller import SlideController
|
from slidecontroller import SlideController
|
||||||
from splashscreen import SplashScreen
|
from splashscreen import SplashScreen
|
||||||
@ -32,4 +33,4 @@ from thememanager import ThemeManager
|
|||||||
from mainwindow import MainWindow
|
from mainwindow import MainWindow
|
||||||
|
|
||||||
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm',
|
__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)
|
new_theme.new_document(theme_name)
|
||||||
if self.theme.background_type == u'solid':
|
if self.theme.background_type == u'solid':
|
||||||
new_theme.add_background_solid(str(self.theme.background_color))
|
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)
|
new_theme.add_background_gradient(str(self.theme.background_startColor), str(self.theme.background_endColor), self.theme.background_direction)
|
||||||
#else:
|
#else:
|
||||||
#newtheme.add_background_image(str(self.theme.))
|
#newtheme.add_background_image(str(self.theme.))
|
||||||
|
55
openlp/core/ui/maindisplay.py
Normal file
55
openlp/core/ui/maindisplay.py
Normal file
@ -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 *
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.resources import *
|
|
||||||
|
|
||||||
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
|
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.lib import Plugin, MediaManagerItem, SettingsTab, EventManager, RenderManager
|
||||||
|
|
||||||
from openlp.core import PluginManager
|
from openlp.core import PluginManager
|
||||||
@ -39,6 +37,7 @@ class MainWindow(object):
|
|||||||
|
|
||||||
def __init__(self, screens):
|
def __init__(self, screens):
|
||||||
self.main_window = QtGui.QMainWindow()
|
self.main_window = QtGui.QMainWindow()
|
||||||
|
self.main_display = MainDisplay(screens, self.main_window)
|
||||||
self.screen_list = screens
|
self.screen_list = screens
|
||||||
self.EventManager = EventManager()
|
self.EventManager = EventManager()
|
||||||
self.alert_form = AlertForm()
|
self.alert_form = AlertForm()
|
||||||
@ -89,10 +88,10 @@ class MainWindow(object):
|
|||||||
|
|
||||||
# Once all components are initialised load the Themes
|
# Once all components are initialised load the Themes
|
||||||
log.info(u'Load Themes')
|
log.info(u'Load Themes')
|
||||||
self.ThemeManagerContents.setEventManager(self.EventManager)
|
self.ThemeManagerContents.eventManager = self.EventManager
|
||||||
self.ThemeManagerContents.setRenderManager(self.RenderManager)
|
self.ThemeManagerContents.renderManager = self.RenderManager
|
||||||
self.ServiceManagerContents.setRenderManager(self.RenderManager)
|
self.ServiceManagerContents.renderManager = self.RenderManager
|
||||||
self.ThemeManagerContents.setServiceManager(self.ServiceManagerContents)
|
self.ThemeManagerContents.serviceManager = self.ServiceManagerContents
|
||||||
self.ThemeManagerContents.loadThemes()
|
self.ThemeManagerContents.loadThemes()
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
@ -421,8 +420,9 @@ class MainWindow(object):
|
|||||||
self.ModeLiveItem.setText(QtGui.QApplication.translate("main_window", "&Live", None, QtGui.QApplication.UnicodeUTF8))
|
self.ModeLiveItem.setText(QtGui.QApplication.translate("main_window", "&Live", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
sleep(2)
|
|
||||||
self.main_window.showMaximized()
|
self.main_window.showMaximized()
|
||||||
|
self.main_display.initialView()
|
||||||
|
self.main_display.show()
|
||||||
|
|
||||||
def onHelpAboutItemClicked(self):
|
def onHelpAboutItemClicked(self):
|
||||||
self.about_form.exec_()
|
self.about_form.exec_()
|
||||||
|
@ -142,9 +142,6 @@ class ServiceManager(QWidget):
|
|||||||
QtCore.QObject.connect(self.ThemeComboBox,
|
QtCore.QObject.connect(self.ThemeComboBox,
|
||||||
QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
|
QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
|
||||||
|
|
||||||
def setRenderManager(self, renderManager):
|
|
||||||
self.renderManager = renderManager
|
|
||||||
|
|
||||||
def onThemeComboBoxSelected(self, currentIndex):
|
def onThemeComboBoxSelected(self, currentIndex):
|
||||||
self.renderManager.set_default_theme(self.ThemeComboBox.currentText())
|
self.renderManager.set_default_theme(self.ThemeComboBox.currentText())
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"""
|
"""
|
||||||
OpenLP - Open Source Lyrics Projection
|
OpenLP - Open Source Lyrics Projection
|
||||||
Copyright (c) 2008 Raoul Snyman
|
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
|
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
|
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 PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
#from openlp.core.resources import *
|
|
||||||
from openlp.core import translate
|
from openlp.core import translate
|
||||||
|
|
||||||
class SplashScreen(object):
|
class SplashScreen(object):
|
||||||
@ -44,15 +43,8 @@ class SplashScreen(object):
|
|||||||
icon = QtGui.QIcon()
|
icon = QtGui.QIcon()
|
||||||
icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
self.splash_screen.setWindowIcon(icon)
|
self.splash_screen.setWindowIcon(icon)
|
||||||
#self.verticalLayout = QtGui.QVBoxLayout(self.splash_screen)
|
|
||||||
#self.verticalLayout.setSpacing(0)
|
self.splash_screen.setPixmap(QtGui.QPixmap(":/graphics/splash-screen-2.png"))
|
||||||
#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.setWindowFlags(QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint)
|
self.splash_screen.setWindowFlags(QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint)
|
||||||
|
|
||||||
self.retranslateUi()
|
self.retranslateUi()
|
||||||
|
@ -45,7 +45,7 @@ from openlp.core.utils import ConfigHelper
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
class ThemeData(QAbstractItemModel):
|
class ThemeData(QAbstractListModel):
|
||||||
"""
|
"""
|
||||||
Tree of items for an order of Theme.
|
Tree of items for an order of Theme.
|
||||||
Includes methods for reading and writing the contents to an OOS file
|
Includes methods for reading and writing the contents to an OOS file
|
||||||
@ -55,7 +55,7 @@ class ThemeData(QAbstractItemModel):
|
|||||||
log=logging.getLogger(u'ThemeData')
|
log=logging.getLogger(u'ThemeData')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QAbstractItemModel.__init__(self)
|
QAbstractListModel.__init__(self)
|
||||||
self.items=[]
|
self.items=[]
|
||||||
self.rowheight=50
|
self.rowheight=50
|
||||||
self.maximagewidth=self.rowheight*16/9.0;
|
self.maximagewidth=self.rowheight*16/9.0;
|
||||||
@ -64,9 +64,6 @@ class ThemeData(QAbstractItemModel):
|
|||||||
def clearItems(self):
|
def clearItems(self):
|
||||||
self.items=[]
|
self.items=[]
|
||||||
|
|
||||||
def columnCount(self, parent):
|
|
||||||
return 1; # always only a single column (for now)
|
|
||||||
|
|
||||||
def rowCount(self, parent):
|
def rowCount(self, parent):
|
||||||
return len(self.items)
|
return len(self.items)
|
||||||
|
|
||||||
@ -104,12 +101,6 @@ class ThemeData(QAbstractItemModel):
|
|||||||
def addRow(self, item):
|
def addRow(self, item):
|
||||||
self.insertRow(len(self.items), 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):
|
def data(self, index, role):
|
||||||
row=index.row()
|
row=index.row()
|
||||||
if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty 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.checkThemesExists(self.path)
|
||||||
self.amendThemeForm.themePath(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):
|
def onAddTheme(self):
|
||||||
self.amendThemeForm.loadTheme(None)
|
self.amendThemeForm.loadTheme(None)
|
||||||
self.amendThemeForm.exec_()
|
self.amendThemeForm.exec_()
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="graphics" >
|
<qresource prefix="graphics" >
|
||||||
<file>splash-screen-new.bmp</file>
|
<file>splash-screen-new.bmp</file>
|
||||||
|
<file>splash-screen-2.png</file>
|
||||||
|
<file>openlp2.png</file>
|
||||||
<file>about-new.bmp</file>
|
<file>about-new.bmp</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="imports" >
|
<qresource prefix="imports" >
|
||||||
|
Loading…
Reference in New Issue
Block a user