Phase1 operation superfly

This commit is contained in:
Tim Bentley 2009-05-20 21:17:20 +01:00
parent b4a08096d6
commit da0acea229
27 changed files with 321 additions and 360 deletions

View File

@ -4,7 +4,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
@ -26,17 +26,15 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver
logging.basicConfig(level=logging.DEBUG,
format=u'%(asctime)s %(msecs)d %(name)-12s %(levelname)-8s %(message)s',
datefmt=u'%m-%d %H:%M:%S',
filename=u'openlp.log',
filemode=u'w')
format=u'%(asctime)s %(msecs)d %(name)-12s %(levelname)-8s %(message)s',
datefmt=u'%m-%d %H:%M:%S', filename=u'openlp.log', filemode=u'w')
from openlp.core.resources import *
from openlp.core.ui import MainWindow, SplashScreen
class OpenLP(QtGui.QApplication):
global log
log=logging.getLogger(u'OpenLP Application')
log = logging.getLogger(u'OpenLP Application')
log.info(u'Application Loaded')
def run(self):
@ -56,15 +54,16 @@ class OpenLP(QtGui.QApplication):
screens.append({u'number': screen,
u'size': self.desktop().availableGeometry(screen),
u'primary': (self.desktop().primaryScreen() == screen)})
log.info(u'Screen %d found with resolution %s', screen, self.desktop().availableGeometry(screen))
log.info(u'Screen %d found with resolution %s',
screen, self.desktop().availableGeometry(screen))
# start the main app window
self.main_window = MainWindow(screens)
self.main_window.show()
self.mainWindow = MainWindow(screens)
self.mainWindow.show()
# now kill the splashscreen
self.splash.finish(self.main_window.main_window)
self.splash.finish(self.mainWindow.mainWindow)
sys.exit(app.exec_())
if __name__ == '__main__':
if __name__ == u'__main__':
app = OpenLP(sys.argv)
app.run()

View File

@ -15,24 +15,3 @@ 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 types
from PyQt4 import QtCore, QtGui
__all__ = ['convertStringToBoolean','buildIcon',]
def convertStringToBoolean(stringvalue):
return stringvalue.strip().lower() in (u'true', u'yes', u'y')
def buildIcon(icon):
ButtonIcon = None
if type(icon) is QtGui.QIcon:
ButtonIcon = icon
elif type(icon) is types.StringType or type(icon) is types.UnicodeType:
ButtonIcon = QtGui.QIcon()
if icon.startswith(u':/'):
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
else:
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QImage(icon)),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
return ButtonIcon

View File

@ -17,16 +17,9 @@ 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 settingsmanager import SettingsManager
from openlp.core.lib.pluginmanager import PluginManager
__all__ = ['SettingsManager', 'PluginManager', 'translate',
'fileToXML' ]
__all__ = ['SettingsManager', 'PluginManager' ]
def translate(context, text):
return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
def fileToXML(xmlfile):
return open(xmlfile).read()

View File

@ -17,6 +17,8 @@ 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 types
from PyQt4 import QtCore, QtGui
from pluginconfig import PluginConfig
from plugin import Plugin
from settingstab import SettingsTab
@ -35,6 +37,31 @@ from themexmlhandler import ThemeXML
from renderer import Renderer
from rendermanager import RenderManager
__all__ = ['Renderer','PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType'
'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder',
'SongXMLParser', 'EventManager', 'ThemeXML', 'RenderManager']
#__all__ = ['Renderer','PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType'
# 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder',
# 'SongXMLParser', 'EventManager', 'ThemeXML', 'RenderManager']
__all__ = [ 'translate', 'fileToXML', 'convertStringToBoolean','buildIcon' ]
def translate(context, text):
return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
def fileToXML(xmlfile):
return open(xmlfile).read()
def convertStringToBoolean(stringvalue):
return stringvalue.strip().lower() in (u'true', u'yes', u'y')
def buildIcon(icon):
ButtonIcon = None
if type(icon) is QtGui.QIcon:
ButtonIcon = icon
elif type(icon) is types.StringType or type(icon) is types.UnicodeType:
ButtonIcon = QtGui.QIcon()
if icon.startswith(u':/'):
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
else:
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QImage(icon)),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
return ButtonIcon

View File

@ -44,6 +44,7 @@ class EventType(object):
#PreviewBeforeShow = 13
#PreviewAfterShow = 14
#Theme Related Events
ThemeListChanged = 15

View File

@ -29,10 +29,10 @@ class EventManager(object):
"""
global log
log=logging.getLogger(u'EventManager')
log = logging.getLogger(u'EventManager')
def __init__(self):
self.endpoints=[]
self.endpoints = []
log.info(u'Initialising')
def register(self, plugin):

View File

@ -2,7 +2,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
@ -17,15 +17,15 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4.QtCore import *
from PyQt4 import QtCore
class EventReceiver(QObject):
class EventReceiver(QtCore.QObject):
"""
Class to allow events to be passed from different parts of the system.
This is a private class and should not be used directly but via the Receiver class
"""
def __init__(self):
QObject.__init__(self)
QtCore.QObject.__init__(self)
def send_message(self, event, msg=None):
self.emit(SIGNAL(event), msg)

View File

@ -64,7 +64,7 @@ class MediaManagerItem(QtGui.QWidget):
item.
"""
if self.Toolbar is None:
self.Toolbar=OpenLPToolbar(self)
self.Toolbar = OpenLPToolbar(self)
self.PageLayout.addWidget(self.Toolbar)
def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None):
@ -82,7 +82,7 @@ class MediaManagerItem(QtGui.QWidget):
self.Toolbar.addSeparator()
def contextMenuSeparator(self, base):
action = QtGui.QAction("", base)
action = QtGui.QAction(u'', base)
action.setSeparator(True)
return action
@ -94,7 +94,7 @@ class MediaManagerItem(QtGui.QWidget):
ButtonIcon = icon
elif type(icon) is types.StringType:
ButtonIcon = QtGui.QIcon()
if icon.startswith(':/'):
if icon.startswith(u':/'):
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
else:
@ -103,6 +103,6 @@ class MediaManagerItem(QtGui.QWidget):
action = QtGui.QAction(text, base)
action .setIcon(ButtonIcon)
QtCore.QObject.connect(action, QtCore.SIGNAL("triggered()"), slot)
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
return action

View File

@ -80,7 +80,7 @@ class Plugin(object):
if name is not None:
self.name = name
else:
self.name = 'Plugin'
self.name = u'Plugin'
if version is not None:
self.version = version
self.icon = None
@ -88,12 +88,12 @@ class Plugin(object):
self.weight = 0
# Set up logging
self.log = logging.getLogger(self.name)
self.preview_controller=plugin_helpers[u'preview']
self.live_controller=plugin_helpers[u'live']
self.theme_manager=plugin_helpers[u'theme']
self.event_manager=plugin_helpers[u'event']
self.render_manager=plugin_helpers[u'render']
self.service_manager=plugin_helpers[u'service']
self.preview_controller = plugin_helpers[u'preview']
self.live_controller = plugin_helpers[u'live']
self.theme_manager = plugin_helpers[u'theme']
self.event_manager = plugin_helpers[u'event']
self.render_manager = plugin_helpers[u'render']
self.service_manager = plugin_helpers[u'service']
def check_pre_conditions(self):
"""

View File

@ -37,12 +37,12 @@ class PluginConfig(object):
Get a configuration value from the configuration registry.
"""
return ConfigHelper.get_config(self.section, key, default)
def delete_config(self, key):
"""
Delete a configuration value from the configuration registry.
"""
return ConfigHelper.delete_config(self.section, key)
return ConfigHelper.delete_config(self.section, key)
def set_config(self, key, value):
"""
@ -64,26 +64,28 @@ class PluginConfig(object):
def set_data_path(self, path):
return self.set_config(u'data path', os.path.basename(path))
def get_files(self, suffix=None):
returnfiles = []
#suffix = self.get_config("suffix name", default_suffixes)
try:
files = os.listdir(self.get_data_path())
files = os.listdir(self.get_data_path())
except:
return returnfiles
return []
if suffix != None:
return_files = []
for f in files:
if f.find('.') != -1:
nme = f.split('.')
bname = nme[0]
sfx = nme[1].lower()
sfx = sfx.lower()
if suffix.find(sfx) > -1 : # only load files with the correct suffix
returnfiles.append(f)
return returnfiles
# only load files with the correct suffix
if suffix.find(sfx) > -1 :
return_files.append(f)
return return_files
else:
return files # no filtering required
# no filtering required
return files
def load_list(self, name):
"""

View File

@ -29,7 +29,7 @@ class PluginManager(object):
and executes all the hooks, as and when necessary.
"""
global log
log=logging.getLogger(u'PluginMgr')
log = logging.getLogger(u'PluginMgr')
log.info(u'Plugin manager loaded')
def __init__(self, dir):
@ -42,25 +42,26 @@ class PluginManager(object):
log.debug("Inserting %s into sys.path", dir)
sys.path.insert(0, dir)
self.basepath = os.path.abspath(dir)
log.debug("Base path %s ", self.basepath)
log.debug(u'Base path %s ', self.basepath)
self.plugins = []
# this has to happen after the UI is sorted self.find_plugins(dir)
log.info("Plugin manager done init")
log.info(u'Plugin manager done init')
def find_plugins(self, dir, plugin_helpers, eventmanager): # TODO shouldn't dir come from self.basepath
def find_plugins(self, dir, plugin_helpers, eventmanager):
"""
Scan the directory dir for objects inheriting from openlp.plugin
"""
self.plugin_helpers = plugin_helpers
startdepth=len(os.path.abspath(dir).split(os.sep))
log.debug("find plugins %s at depth %d" %( str(dir), startdepth))
startdepth = len(os.path.abspath(dir).split(os.sep))
log.debug(u'find plugins %s at depth %d' %( str(dir), startdepth))
for root, dirs, files in os.walk(dir):
for name in files:
if name.endswith(".py") and not name.startswith("__"):
if name.endswith(u'.py') and not name.startswith(u'__'):
path = os.path.abspath(os.path.join(root, name))
thisdepth=len(path.split(os.sep))
if thisdepth-startdepth > 2: # skip anything lower down
thisdepth = len(path.split(os.sep))
if thisdepth-startdepth > 2:
# skip anything lower down
continue
modulename, pyext = os.path.splitext(path)
prefix = os.path.commonprefix([self.basepath, path])
@ -68,11 +69,11 @@ class PluginManager(object):
modulename = modulename[len(prefix) + 1:]
modulename = modulename.replace(os.path.sep, '.')
# import the modules
log.debug("Importing %s from %s. Depth %d" % (modulename, path, thisdepth))
log.debug(u'Importing %s from %s. Depth %d' % (modulename, path, thisdepth))
try:
__import__(modulename, globals(), locals(), [])
except ImportError, e:
log.error("Failed to import module %s on path %s for reason %s", modulename, path, e.message)
log.error(u'Failed to import module %s on path %s for reason %s', modulename, path, e.message)
self.plugin_classes = Plugin.__subclasses__()
self.plugins = []
plugin_objects = []
@ -80,9 +81,9 @@ class PluginManager(object):
try:
plugin = p(self.plugin_helpers)
log.debug(u'loaded plugin %s with helpers'%str(p))
log.debug("Plugin="+str(p))
log.debug(u'Plugin: %s', str(p))
if plugin.check_pre_conditions():
log.debug("Appending "+str(p))
log.debug(u'Appending %s ', str(p))
plugin_objects.append(plugin)
eventmanager.register(plugin)
except TypeError:
@ -100,7 +101,7 @@ class PluginManager(object):
for plugin in self.plugins:
media_manager_item = plugin.get_media_manager_item()
if media_manager_item is not None:
log.debug('Inserting media manager item from %s' % plugin.name)
log.debug(u'Inserting media manager item from %s' % plugin.name)
mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title)
def hook_settings_tabs(self, settingsform=None):
@ -111,10 +112,10 @@ class PluginManager(object):
for plugin in self.plugins:
settings_tab = plugin.get_settings_tab()
if settings_tab is not None:
log.debug('Inserting settings tab item from %s' % plugin.name)
log.debug(u'Inserting settings tab item from %s' % plugin.name)
settingsform.addTab(settings_tab)
else:
log.debug('No settings in %s' % plugin.name)
log.debug(u'No settings in %s' % plugin.name)
def hook_import_menu(self, import_menu):
"""
@ -132,15 +133,6 @@ class PluginManager(object):
for plugin in self.plugins:
plugin.add_export_menu_item(export_menu)
def hook_handle_event(self, eventmanager):
for plugin in self.plugins:
handle_event = plugin.handle_event(None)
print plugin, handle_event
# if settings_tab is not None:
# log.debug('Inserting settings tab item from %s' % plugin.name)
# settingsform.addTab(settings_tab)
# else:
# log.debug('No settings in %s' % plugin.name)
def initialise_plugins(self):
"""
Loop through all the plugins and give them an opportunity to add an item

View File

@ -63,6 +63,7 @@ class RenderManager:
self.renderer = Renderer()
self.calculate_default(self.screen_list[self.current_display]['size'])
self.theme = u''
self.service_theme = u''
def set_global_theme(self, global_theme, global_style = u'Global'):
self.global_theme = global_theme

View File

@ -19,10 +19,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
import logging
import time
from openlp import buildIcon
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from openlp.core.lib import buildIcon
from PyQt4 import QtCore, QtGui
class ServiceItem():
"""

View File

@ -22,13 +22,9 @@ import platform
import sys
import os
from types import StringType, NoneType, UnicodeType
sys.path.append(os.path.abspath("./../.."))
sys.path.append(os.path.abspath(u'./../..'))
ver = platform.python_version()
if ver >= '2.5':
from xml.etree.ElementTree import ElementTree, XML
else:
from elementtree import ElementTree, XML
from xml.etree.ElementTree import ElementTree, XML
class XmlRootClass(object):
@ -47,23 +43,27 @@ class XmlRootClass(object):
xml (string) -- formatted as xml tags and values
rootTag -- main tag of the xml
"""
root=ElementTree(element=XML(xml))
iter=root.getiterator()
root = ElementTree(element=XML(xml))
iter = root.getiterator()
for element in iter:
if element.tag != rootTag:
t=element.text
t = element.text
#print element.tag, t, type(t)
if type(t) == NoneType: # easy!
if type(t) == NoneType:
# easy!
val=t
elif type(t) == UnicodeType :
val=t
elif type(t) == StringType: # strings need special handling to sort the colours out
elif type(t) == StringType:
# strings need special handling to sort the colours out
#print "str",
if t[0] == "$": # might be a hex number
if t[0] == '$':
# might be a hex number
#print "hex",
try:
val=int(t[1:], 16)
except ValueError: # nope
val = int(t[1:], 16)
except ValueError:
# nope
#print "nope",
pass
else:
@ -74,9 +74,9 @@ class XmlRootClass(object):
except ValueError:
#print "give up",
val=t
if hasattr(self, "post_tag_hook"):
if hasattr(self, u'post_tag_hook'):
(element.tag, val) = self.post_tag_hook(element.tag, val)
setattr(self,element.tag, val)
setattr(self, element.tag, val)
pass
def __str__(self):
@ -88,15 +88,15 @@ class XmlRootClass(object):
"""
l = []
for k in dir(self):
if not k.startswith("_"):
l.append("%30s : %s" %(k,getattr(self,k)))
return "\n".join(l)
if not k.startswith(u'_'):
l.append(u'%30s : %s' %(k,getattr(self,k)))
return u'\n'.join(l)
def _get_as_string(self):
"""Return one string with all public attributes"""
s=""
for k in dir(self):
if not k.startswith("_"):
s+= "_%s_" %(getattr(self,k))
if not k.startswith(u'_'):
s+= u'_%s_' %(getattr(self,k))
return s

View File

@ -19,15 +19,13 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog
from openlp.core import translate
from openlp.core.resources import *
from openlp.core.lib import translate
class AboutForm(QDialog):
class AboutForm(QtGui.QDialog):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
def setupUi(self, AboutForm):
@ -126,7 +124,7 @@ class AboutForm(QDialog):
self.License1Label.setText(translate("AboutDialog", "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; either version 2 of the License, or (at your option) any later version."))
self.License2Label.setText(translate("AboutDialog", "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."))
self.License3Label.setText(translate("AboutDialog", "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."))
self.AboutNotebook.setTabText(self.AboutNotebook.indexOf(self.LicenseTab), QtGui.QApplication.translate("AboutDialog", "License", None, QtGui.QApplication.UnicodeUTF8))
self.AboutNotebook.setTabText(self.AboutNotebook.indexOf(self.LicenseTab), translate("AboutDialog", "License"))
self.CreditsTextEdit.setPlainText(translate("AboutDialog", "Project Lead\n"
" Raoul \"superfly\" Snyman\n"
"\n"
@ -143,11 +141,6 @@ class AboutForm(QDialog):
self.extContributeItem.setText(translate("AboutDialog", "&Contribute"))
def onContributeButtonClicked(self):
''' This routine will open the default
web-browser to the contribute page
of openlp.org as did the original
button on the About form
'''
import webbrowser
url = "http://www.openlp.org/en/documentation/introduction/contributing.html"
webbrowser.open_new(url)

View File

@ -19,17 +19,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
import logging
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog
from openlp.core.lib import translate
from openlp.core import translate
from openlp.core.resources import *
class AlertForm(QDialog):
class AlertForm(QtGui.QDialog):
global log
log=logging.getLogger(u'AlertForm')
def __init__(self, parent=None):
QDialog.__init__(self, parent)
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
log.info(u'Defined')

View File

@ -19,11 +19,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QColor, QFont
from openlp.core import translate
from openlp.core.lib import SettingsTab
from openlp.core.resources import *
from openlp.core.lib import SettingsTab, translate
class AlertsTab(SettingsTab):
"""
@ -175,7 +172,7 @@ class AlertsTab(SettingsTab):
self.timeout = int(self.config.get_config('timeout', 5))
self.font_color = str(self.config.get_config('font color', u'#ffffff'))
self.bg_color = str(self.config.get_config('background color', u'#660000'))
self.font_face = str(self.config.get_config('font face', QFont().family()))
self.font_face = str(self.config.get_config('font face', QtGui.QFont().family()))
self.TimeoutSpinBox.setValue(self.timeout)
self.FontColorButton.setStyleSheet('background-color: %s' % self.font_color)
self.BackgroundColorButton.setStyleSheet('background-color: %s' % self.bg_color)
@ -192,7 +189,7 @@ class AlertsTab(SettingsTab):
self.config.set_config('timeout', str(self.timeout))
def updateDisplay(self):
font = QFont()
font = QtGui.QFont()
font.setFamily(self.FontComboBox.currentFont().family())
font.setBold(True)
font.setPointSize(16)

View File

@ -21,9 +21,7 @@ import logging
import os, os.path
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QColor, QFont
from openlp.core.lib import ThemeXML, Renderer
from openlp.core import fileToXML, translate
from openlp.core.lib import ThemeXML, Renderer, fileToXML, translate
from amendthemedialog import Ui_AmendThemeDialog
@ -138,11 +136,11 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.path = path
def loadTheme(self, theme):
log.debug(u'LoadTheme %s ', theme)
log.debug(u'LoadTheme %s', theme)
if theme == None:
self.theme.parse(self.baseTheme())
else:
xml_file = os.path.join(self.path, theme, theme+u'.xml')
xml_file = os.path.join(self.path, theme, theme + u'.xml')
xml = fileToXML(xml_file)
self.theme.parse(xml)
self.allowPreview = False
@ -165,10 +163,10 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onFontMainColorPushButtonClicked(self):
self.theme.font_main_color = QtGui.QColorDialog.getColor(
QColor(self.theme.font_main_color), self).name()
QtGui.QColor(self.theme.font_main_color), self).name()
self.FontMainColorPushButton.setStyleSheet(
'background-color: %s' % str(self.theme.font_main_color))
u'background-color: %s' % str(self.theme.font_main_color))
self.previewTheme(self.theme)
def onFontMainSizeSpinBoxChanged(self, value):
@ -218,7 +216,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onFontFooterColorPushButtonClicked(self):
self.theme.font_footer_color = QtGui.QColorDialog.getColor(
QColor(self.theme.font_footer_color), self).name()
QtGui.QColor(self.theme.font_footer_color), self).name()
self.FontFooterColorPushButton.setStyleSheet(
'background-color: %s' % str(self.theme.font_footer_color))
@ -307,22 +305,22 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onColor1PushButtonClicked(self):
if self.theme.background_type == u'solid':
self.theme.background_color = QtGui.QColorDialog.getColor(
QColor(self.theme.background_color), self).name()
QtGui.QColor(self.theme.background_color), self).name()
self.Color1PushButton.setStyleSheet(
'background-color: %s' % str(self.theme.background_color))
u'background-color: %s' % str(self.theme.background_color))
else:
self.theme.background_startColor = QtGui.QColorDialog.getColor(
QColor(self.theme.background_startColor), self).name()
QtGui.QColor(self.theme.background_startColor), self).name()
self.Color1PushButton.setStyleSheet(
'background-color: %s' % str(self.theme.background_startColor))
u'background-color: %s' % str(self.theme.background_startColor))
self.previewTheme(self.theme)
def onColor2PushButtonClicked(self):
self.theme.background_endColor = QtGui.QColorDialog.getColor(
QColor(self.theme.background_endColor), self).name()
QtGui.QColor(self.theme.background_endColor), self).name()
self.Color2PushButton.setStyleSheet(
'background-color: %s' % str(self.theme.background_endColor))
u'background-color: %s' % str(self.theme.background_endColor))
self.previewTheme(self.theme)
#
@ -338,9 +336,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onOutlineColorPushButtonClicked(self):
self.theme.display_outline_color = QtGui.QColorDialog.getColor(
QColor(self.theme.display_outline_color), self).name()
QtGui.QColor(self.theme.display_outline_color), self).name()
self.OutlineColorPushButton.setStyleSheet(
'background-color: %s' % str(self.theme.display_outline_color))
u'background-color: %s' % str(self.theme.display_outline_color))
self.previewTheme(self.theme)
def onShadowCheckBoxChanged(self, value):
@ -353,9 +351,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onShadowColorPushButtonClicked(self):
self.theme.display_shadow_color = QtGui.QColorDialog.getColor(
QColor(self.theme.display_shadow_color), self).name()
QtGui.QColor(self.theme.display_shadow_color), self).name()
self.ShadowColorPushButton.setStyleSheet(
'background-color: %s' % str(self.theme.display_shadow_color))
u'background-color: %s' % str(self.theme.display_shadow_color))
self.previewTheme(self.theme)
def onHorizontalComboBoxSelected(self, currentIndex):
@ -375,8 +373,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
newtheme = ThemeXML()
newtheme.new_document(u'New Theme')
newtheme.add_background_solid(str(u'#000000'))
newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(30), u'False')
newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(12), u'False', u'footer')
newtheme.add_font(str(QtGui.QFont().family()), str(u'#FFFFFF'), str(30), u'False')
newtheme.add_font(str(QtGui.QFont().family()), str(u'#FFFFFF'), str(12), u'False', u'footer')
newtheme.add_display(u'False', str(u'#FFFFFF'), u'False', str(u'#FFFFFF'),
str(0), str(0), str(0))
@ -415,9 +413,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.FontFooterWidthSpinBox.setValue(int(self.theme.font_footer_width))
self.FontFooterHeightSpinBox.setValue(int(self.theme.font_footer_height))
self.FontMainColorPushButton.setStyleSheet(
'background-color: %s' % str(theme.font_main_color))
u'background-color: %s' % str(theme.font_main_color))
self.FontFooterColorPushButton.setStyleSheet(
'background-color: %s' % str(theme.font_footer_color))
u'background-color: %s' % str(theme.font_footer_color))
if self.theme.font_main_override == False:
self.FontMainDefaultCheckBox.setChecked(True)
@ -430,9 +428,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.FontFooterDefaultCheckBox.setChecked(False)
self.OutlineColorPushButton.setStyleSheet(
'background-color: %s' % str(theme.display_outline_color))
u'background-color: %s' % str(theme.display_outline_color))
self.ShadowColorPushButton.setStyleSheet(
'background-color: %s' % str(theme.display_shadow_color))
u'background-color: %s' % str(theme.display_shadow_color))
if self.theme.display_outline:
self.OutlineCheckBox.setChecked(True)
@ -454,7 +452,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def stateChanging(self, theme):
if theme.background_type == u'solid':
self.Color1PushButton.setStyleSheet(
'background-color: %s' % str(theme.background_color))
u'background-color: %s' % str(theme.background_color))
self.Color1Label.setText(translate(u'ThemeManager', u'Background Color:'))
self.Color1Label.setVisible(True)
self.Color1PushButton.setVisible(True)
@ -467,9 +465,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.GradientComboBox.setVisible(False)
elif theme.background_type == u'gradient':
self.Color1PushButton.setStyleSheet(
'background-color: %s' % str(theme.background_startColor))
u'background-color: %s' % str(theme.background_startColor))
self.Color2PushButton.setStyleSheet(
'background-color: %s' % str(theme.background_endColor))
u'background-color: %s' % str(theme.background_endColor))
self.Color1Label.setText(translate(u'ThemeManager', u'First Color:'))
self.Color2Label.setText(translate(u'ThemeManager', u'Second Color:'))
self.Color1Label.setVisible(True)

View File

@ -20,9 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import QtCore, QtGui
from openlp.core import translate
from openlp.core.lib import SettingsTab
from openlp.core.resources import *
from openlp.core.lib import SettingsTab, translate
class GeneralTab(SettingsTab):
"""

View File

@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import QtCore, QtGui
from openlp.core import translate
from openlp.core.lib import translate
class MainDisplay(QtGui.QWidget):

View File

@ -21,29 +21,28 @@ import os
import logging
from time import sleep
from PyQt4 import *
from PyQt4 import QtCore, QtGui
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
SlideController, ServiceManager, ThemeManager, MainDisplay
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager, RenderManager
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager, RenderManager, translate
from openlp.core import PluginManager, translate
from openlp.core import PluginManager
class MainWindow(object):
global log
log=logging.getLogger(u'MainWindow')
log = logging.getLogger(u'MainWindow')
log.info(u'MainWindow loaded')
def __init__(self, screens):
self.main_window = QtGui.QMainWindow()
self.main_window.__class__.closeEvent = self.onCloseEvent
self.main_display = MainDisplay(None, screens)
self.screen_list = screens
self.mainWindow = QtGui.QMainWindow()
self.mainWindow.__class__.closeEvent = self.onCloseEvent
self.mainDisplay = MainDisplay(None, screens)
self.screenList = screens
self.EventManager = EventManager()
self.alert_form = AlertForm()
self.about_form = AboutForm()
self.settings_form = SettingsForm(self.screen_list, self)
self.alertForm = AlertForm()
self.aboutForm = AboutForm()
self.settingsForm = SettingsForm(self.screenList, self)
pluginpath = os.path.split(os.path.abspath(__file__))[0]
pluginpath = os.path.abspath(os.path.join(pluginpath, u'..', u'..', u'plugins'))
@ -55,7 +54,7 @@ class MainWindow(object):
#warning cyclic dependency
#RenderManager needs to call ThemeManager and
#ThemeManager needs to call RenderManager
self.RenderManager = RenderManager(self.ThemeManagerContents, self.screen_list)
self.RenderManager = RenderManager(self.ThemeManagerContents, self.screenList)
log.info(u'Load Plugins')
self.plugin_helpers[u'preview'] = self.PreviewController
@ -75,7 +74,7 @@ class MainWindow(object):
# Find and insert settings tabs
log.info(u'hook settings')
self.plugin_manager.hook_settings_tabs(self.settings_form)
self.plugin_manager.hook_settings_tabs(self.settingsForm)
# Call the hook method to pull in import menus.
log.info(u'hook menus')
@ -107,29 +106,29 @@ class MainWindow(object):
# Initialise SlideControllers
log.info(u'Set Up SlideControllers')
self.LiveController.mainDisplay = self.main_display
self.LiveController.mainDisplay = self.mainDisplay
def onCloseEvent(self, event):
"""
Hook to close the main window and display windows on exit
"""
self.main_display.close()
self.mainDisplay.close()
event.accept()
def setupUi(self):
self.main_window.setObjectName(u'main_window')
self.main_window.resize(1087, 847)
self.mainWindow.setObjectName(u'mainWindow')
self.mainWindow.resize(1087, 847)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.main_window.sizePolicy().hasHeightForWidth())
self.main_window.setSizePolicy(sizePolicy)
sizePolicy.setHeightForWidth(self.mainWindow.sizePolicy().hasHeightForWidth())
self.mainWindow.setSizePolicy(sizePolicy)
main_icon = QtGui.QIcon()
main_icon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.main_window.setWindowIcon(main_icon)
self.MainContent = QtGui.QWidget(self.main_window)
self.mainWindow.setWindowIcon(main_icon)
self.MainContent = QtGui.QWidget(self.mainWindow)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@ -140,14 +139,14 @@ class MainWindow(object):
self.MainContentLayout.setSpacing(0)
self.MainContentLayout.setMargin(0)
self.MainContentLayout.setObjectName(u'MainContentLayout')
self.main_window.setCentralWidget(self.MainContent)
self.mainWindow.setCentralWidget(self.MainContent)
self.ControlSplitter = QtGui.QSplitter(self.MainContent)
self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal)
self.ControlSplitter.setObjectName(u'ControlSplitter')
self.MainContentLayout.addWidget(self.ControlSplitter)
self.PreviewController = SlideController(self.ControlSplitter, False)
self.LiveController = SlideController(self.ControlSplitter, True)
self.MenuBar = QtGui.QMenuBar(self.main_window)
self.MenuBar = QtGui.QMenuBar(self.mainWindow)
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
self.MenuBar.setObjectName(u'MenuBar')
self.FileMenu = QtGui.QMenu(self.MenuBar)
@ -169,11 +168,11 @@ class MainWindow(object):
self.ToolsMenu.setObjectName(u'ToolsMenu')
self.HelpMenu = QtGui.QMenu(self.MenuBar)
self.HelpMenu.setObjectName(u'HelpMenu')
self.main_window.setMenuBar(self.MenuBar)
self.StatusBar = QtGui.QStatusBar(self.main_window)
self.mainWindow.setMenuBar(self.MenuBar)
self.StatusBar = QtGui.QStatusBar(self.mainWindow)
self.StatusBar.setObjectName(u'StatusBar')
self.main_window.setStatusBar(self.StatusBar)
self.MediaManagerDock = QtGui.QDockWidget(self.main_window)
self.mainWindow.setStatusBar(self.StatusBar)
self.MediaManagerDock = QtGui.QDockWidget(self.mainWindow)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@ -202,9 +201,9 @@ class MainWindow(object):
self.MediaManagerLayout.addWidget(self.MediaToolBox)
self.MediaManagerDock.setWidget(self.MediaManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
self.mainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
#Sevice Manager Defined
self.ServiceManagerDock = QtGui.QDockWidget(self.main_window)
self.ServiceManagerDock = QtGui.QDockWidget(self.mainWindow)
ServiceManagerIcon = QtGui.QIcon()
ServiceManagerIcon.addPixmap(QtGui.QPixmap(u':/system/system_servicemanager.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
@ -213,9 +212,9 @@ class MainWindow(object):
self.ServiceManagerDock.setObjectName(u'ServiceManagerDock')
self.ServiceManagerContents = ServiceManager(self)
self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
self.mainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
#Theme Manager Defined
self.ThemeManagerDock = QtGui.QDockWidget(self.main_window)
self.ThemeManagerDock = QtGui.QDockWidget(self.mainWindow)
ThemeManagerIcon = QtGui.QIcon()
ThemeManagerIcon.addPixmap(QtGui.QPixmap(u':/system/system_thememanager.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
@ -226,96 +225,96 @@ class MainWindow(object):
self.ThemeManagerContents = ThemeManager(self)
self.ThemeManagerDock.setWidget(self.ThemeManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)
self.mainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)
self.FileNewItem = QtGui.QAction(self.main_window)
self.FileNewItem = QtGui.QAction(self.mainWindow)
self.FileNewItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle(u'New Service'))
self.FileNewItem.setObjectName(u'FileNewItem')
self.FileOpenItem = QtGui.QAction(self.main_window)
self.FileOpenItem = QtGui.QAction(self.mainWindow)
self.FileOpenItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle(u'Open Service'))
self.FileOpenItem.setObjectName(u'FileOpenItem')
self.FileSaveItem = QtGui.QAction(self.main_window)
self.FileSaveItem = QtGui.QAction(self.mainWindow)
self.FileSaveItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle(u'Save Service'))
self.FileSaveItem.setObjectName(u'FileSaveItem')
self.FileSaveAsItem = QtGui.QAction(self.main_window)
self.FileSaveAsItem = QtGui.QAction(self.mainWindow)
self.FileSaveAsItem.setObjectName(u'FileSaveAsItem')
self.FileExitItem = QtGui.QAction(self.main_window)
self.FileExitItem = QtGui.QAction(self.mainWindow)
ExitIcon = QtGui.QIcon()
ExitIcon.addPixmap(QtGui.QPixmap(u':/system/system_exit.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.FileExitItem.setIcon(ExitIcon)
self.FileExitItem.setObjectName(u'FileExitItem')
self.ImportThemeItem = QtGui.QAction(self.main_window)
self.ImportThemeItem = QtGui.QAction(self.mainWindow)
self.ImportThemeItem.setObjectName(u'ImportThemeItem')
self.ImportLanguageItem = QtGui.QAction(self.main_window)
self.ImportLanguageItem = QtGui.QAction(self.mainWindow)
self.ImportLanguageItem.setObjectName(u'ImportLanguageItem')
self.ExportThemeItem = QtGui.QAction(self.main_window)
self.ExportThemeItem = QtGui.QAction(self.mainWindow)
self.ExportThemeItem.setObjectName(u'ExportThemeItem')
self.ExportLanguageItem = QtGui.QAction(self.main_window)
self.ExportLanguageItem = QtGui.QAction(self.mainWindow)
self.ExportLanguageItem.setObjectName(u'ExportLanguageItem')
self.actionLook_Feel = QtGui.QAction(self.main_window)
self.actionLook_Feel = QtGui.QAction(self.mainWindow)
self.actionLook_Feel.setObjectName(u'actionLook_Feel')
self.OptionsSettingsItem = QtGui.QAction(self.main_window)
self.OptionsSettingsItem = QtGui.QAction(self.mainWindow)
SettingsIcon = QtGui.QIcon()
SettingsIcon.addPixmap(QtGui.QPixmap(u':/system/system_settings.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.OptionsSettingsItem.setIcon(SettingsIcon)
self.OptionsSettingsItem.setObjectName(u'OptionsSettingsItem')
self.ViewMediaManagerItem = QtGui.QAction(self.main_window)
self.ViewMediaManagerItem = QtGui.QAction(self.mainWindow)
self.ViewMediaManagerItem.setCheckable(True)
self.ViewMediaManagerItem.setChecked(True)
self.ViewMediaManagerItem.setIcon(icon)
self.ViewMediaManagerItem.setObjectName(u'ViewMediaManagerItem')
self.ViewThemeManagerItem = QtGui.QAction(self.main_window)
self.ViewThemeManagerItem = QtGui.QAction(self.mainWindow)
self.ViewThemeManagerItem.setCheckable(True)
self.ViewThemeManagerItem.setChecked(True)
self.ViewThemeManagerItem.setIcon(ThemeManagerIcon)
self.ViewThemeManagerItem.setObjectName(u'ViewThemeManagerItem')
self.ViewServiceManagerItem = QtGui.QAction(self.main_window)
self.ViewServiceManagerItem = QtGui.QAction(self.mainWindow)
self.ViewServiceManagerItem.setCheckable(True)
self.ViewServiceManagerItem.setChecked(True)
self.ViewServiceManagerItem.setIcon(ServiceManagerIcon)
self.ViewServiceManagerItem.setObjectName(u'ViewServiceManagerItem')
self.ToolsAlertItem = QtGui.QAction(self.main_window)
self.ToolsAlertItem = QtGui.QAction(self.mainWindow)
AlertIcon = QtGui.QIcon()
AlertIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_alert.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ToolsAlertItem.setIcon(AlertIcon)
self.ToolsAlertItem.setObjectName(u'ToolsAlertItem')
self.HelpDocumentationItem = QtGui.QAction(self.main_window)
self.HelpDocumentationItem = QtGui.QAction(self.mainWindow)
ContentsIcon = QtGui.QIcon()
ContentsIcon.addPixmap(QtGui.QPixmap(u':/system/system_help_contents.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.HelpDocumentationItem.setIcon(ContentsIcon)
self.HelpDocumentationItem.setObjectName(u'HelpDocumentationItem')
self.HelpAboutItem = QtGui.QAction(self.main_window)
self.HelpAboutItem = QtGui.QAction(self.mainWindow)
AboutIcon = QtGui.QIcon()
AboutIcon.addPixmap(QtGui.QPixmap(u':/system/system_about.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.HelpAboutItem.setIcon(AboutIcon)
self.HelpAboutItem.setObjectName(u'HelpAboutItem')
self.HelpOnlineHelpItem = QtGui.QAction(self.main_window)
self.HelpOnlineHelpItem = QtGui.QAction(self.mainWindow)
self.HelpOnlineHelpItem.setObjectName(u'HelpOnlineHelpItem')
self.HelpWebSiteItem = QtGui.QAction(self.main_window)
self.HelpWebSiteItem = QtGui.QAction(self.mainWindow)
self.HelpWebSiteItem.setObjectName(u'HelpWebSiteItem')
self.LanguageTranslateItem = QtGui.QAction(self.main_window)
self.LanguageTranslateItem = QtGui.QAction(self.mainWindow)
self.LanguageTranslateItem.setObjectName(u'LanguageTranslateItem')
self.LanguageEnglishItem = QtGui.QAction(self.main_window)
self.LanguageEnglishItem = QtGui.QAction(self.mainWindow)
self.LanguageEnglishItem.setObjectName(u'LanguageEnglishItem')
self.ToolsAddToolItem = QtGui.QAction(self.main_window)
self.ToolsAddToolItem = QtGui.QAction(self.mainWindow)
AddToolIcon = QtGui.QIcon()
AddToolIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_add.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ToolsAddToolItem.setIcon(AddToolIcon)
self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem')
self.action_Preview_Panel = QtGui.QAction(self.main_window)
self.action_Preview_Panel = QtGui.QAction(self.mainWindow)
self.action_Preview_Panel.setCheckable(True)
self.action_Preview_Panel.setChecked(True)
self.action_Preview_Panel.setObjectName(u'action_Preview_Panel')
self.ModeLiveItem = QtGui.QAction(self.main_window)
self.ModeLiveItem = QtGui.QAction(self.mainWindow)
self.ModeLiveItem.setObjectName(u'ModeLiveItem')
self.FileImportMenu.addAction(self.ImportThemeItem)
self.FileImportMenu.addAction(self.ImportLanguageItem)
@ -361,7 +360,7 @@ class MainWindow(object):
self.retranslateUi()
self.MediaToolBox.setCurrentIndex(0)
QtCore.QObject.connect(self.FileExitItem,
QtCore.SIGNAL(u'triggered()'), self.main_window.close)
QtCore.SIGNAL(u'triggered()'), self.mainWindow.close)
QtCore.QObject.connect(self.ViewMediaManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.MediaManagerDock.setVisible)
QtCore.QObject.connect(self.ViewServiceManagerItem,
@ -382,103 +381,103 @@ class MainWindow(object):
QtCore.SIGNAL(u'triggered()'), self.onToolsAlertItemClicked)
QtCore.QObject.connect(self.OptionsSettingsItem,
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
QtCore.QMetaObject.connectSlotsByName(self.main_window)
QtCore.QMetaObject.connectSlotsByName(self.mainWindow)
def retranslateUi(self):
self.main_window.setWindowTitle(translate(u'main_window', u'openlp.org 2.0'))
self.FileMenu.setTitle(translate(u'main_window', u'&File'))
self.FileImportMenu.setTitle(translate(u'main_window', u'&Import'))
self.FileExportMenu.setTitle(translate(u'main_window', u'&Export'))
self.OptionsMenu.setTitle(translate(u'main_window', u'&Options'))
self.OptionsViewMenu.setTitle(translate(u'main_window', u'&View'))
self.ViewModeMenu.setTitle(translate(u'main_window', u'M&ode'))
self.OptionsLanguageMenu.setTitle(translate(u'main_window', u'&Language'))
self.ToolsMenu.setTitle(translate(u'main_window', u'&Tools'))
self.HelpMenu.setTitle(translate(u'main_window', u'&Help'))
self.MediaManagerDock.setWindowTitle(translate(u'main_window', u'Media Manager'))
self.ServiceManagerDock.setWindowTitle(translate(u'main_window', u'Service Manager'))
# self.ServiceManagerContents.MoveTopButton.setText(translate(u'main_window', u'Move To Top'))
# self.ServiceManagerContents.MoveUpButton.setText(translate(u'main_window', u'Move Up'))
# self.ServiceManagerContents.MoveDownButton.setText(translate(u'main_window', u'Move Down'))
# self.ServiceManagerContents.MoveBottomButton.setText(translate(u'main_window', u'Move To Bottom'))
# self.ServiceManagerContents.NewItem.setText(translate(u'main_window', u'New Service'))
# self.ServiceManagerContents.OpenItem.setText(translate(u'main_window', u'Open Service'))
# self.ServiceManagerContents.SaveItem.setText(translate(u'main_window', u'Save Service'))
# self.ServiceManagerContents.ThemeComboBox.setItemText(0, translate(u'main_window', u'African Sunset'))
# self.ServiceManagerContents.ThemeComboBox.setItemText(1, translate(u'main_window', u'Snowy Mountains'))
# self.ServiceManagerContents.ThemeComboBox.setItemText(2, translate(u'main_window', u'Wilderness'))
self.ThemeManagerDock.setWindowTitle(translate(u'main_window', u'Theme Manager'))
# self.ThemeNewItem.setText(translate(u'main_window', u'New Theme'))
# self.ThemeEditItem.setText(translate(u'main_window', u'Edit Theme'))
# self.ThemeDeleteButton.setText(translate(u'main_window', u'Delete Theme'))
# self.ThemeImportButton.setText(translate(u'main_window', u'Import Theme'))
# self.ThemeExportButton.setText(translate(u'main_window', u'Export Theme'))
self.FileNewItem.setText(translate(u'main_window', u'&New'))
self.FileNewItem.setToolTip(translate(u'main_window', u'New Service'))
self.FileNewItem.setStatusTip(translate(u'main_window', u'Create a new Service'))
self.FileNewItem.setShortcut(translate(u'main_window', u'Ctrl+N'))
self.FileOpenItem.setText(translate(u'main_window', u'&Open'))
self.FileOpenItem.setToolTip(translate(u'main_window', u'Open Service'))
self.FileOpenItem.setStatusTip(translate(u'main_window', u'Open an existing service'))
self.FileOpenItem.setShortcut(translate(u'main_window', u'Ctrl+O'))
self.FileSaveItem.setText(translate(u'main_window', u'&Save'))
self.FileSaveItem.setToolTip(translate(u'main_window', u'Save Service'))
self.FileSaveItem.setStatusTip(translate(u'main_window', u'Save the current service to disk'))
self.FileSaveItem.setShortcut(translate(u'main_window', u'Ctrl+S'))
self.FileSaveAsItem.setText(translate(u'main_window', u'Save &As...'))
self.FileSaveAsItem.setToolTip(translate(u'main_window', u'Save Service As'))
self.FileSaveAsItem.setStatusTip(translate(u'main_window', u'Save the current service under a new name'))
self.FileSaveAsItem.setShortcut(translate(u'main_window', u'F12'))
self.FileExitItem.setText(translate(u'main_window', u'E&xit'))
self.FileExitItem.setStatusTip(translate(u'main_window', u'Quit OpenLP 2.0'))
self.FileExitItem.setShortcut(translate(u'main_window', u'Alt+F4'))
self.ImportThemeItem.setText(translate(u'main_window', u'&Theme'))
self.ImportLanguageItem.setText(translate(u'main_window', u'&Language'))
self.ExportThemeItem.setText(translate(u'main_window', u'&Theme'))
self.ExportLanguageItem.setText(translate(u'main_window', u'&Language'))
self.actionLook_Feel.setText(translate(u'main_window', u'Look && &Feel'))
self.OptionsSettingsItem.setText(translate(u'main_window', u'&Settings'))
self.ViewMediaManagerItem.setText(translate(u'main_window', u'&Media Manager'))
self.ViewMediaManagerItem.setToolTip(translate(u'main_window', u'Toggle Media Manager'))
self.ViewMediaManagerItem.setStatusTip(translate(u'main_window', u'Toggle the visibility of the Media Manager'))
self.ViewMediaManagerItem.setShortcut(translate(u'main_window', u'F8'))
self.ViewThemeManagerItem.setText(translate(u'main_window', u'&Theme Manager'))
self.ViewThemeManagerItem.setToolTip(translate(u'main_window', u'Toggle Theme Manager'))
self.ViewThemeManagerItem.setStatusTip(translate(u'main_window', u'Toggle the visibility of the Theme Manager'))
self.ViewThemeManagerItem.setShortcut(translate(u'main_window', u'F10'))
self.ViewServiceManagerItem.setText(translate(u'main_window', u'&Service Manager'))
self.ViewServiceManagerItem.setToolTip(translate(u'main_window', u'Toggle Service Manager'))
self.ViewServiceManagerItem.setStatusTip(translate(u'main_window', u'Toggle the visibility of the Service Manager'))
self.ViewServiceManagerItem.setShortcut(translate(u'main_window', u'F9'))
self.ToolsAlertItem.setText(translate(u'main_window', u'&Alert'))
self.ToolsAlertItem.setStatusTip(translate(u'main_window', u'Show an alert message'))
self.ToolsAlertItem.setShortcut(translate(u'main_window', u'F7'))
self.HelpDocumentationItem.setText(translate(u'main_window', u'&User Guide'))
self.HelpAboutItem.setText(translate(u'main_window', u'&About'))
self.HelpAboutItem.setStatusTip(translate(u'main_window', u'More information about OpenLP'))
self.HelpAboutItem.setShortcut(translate(u'main_window', u'Ctrl+F1'))
self.HelpOnlineHelpItem.setText(translate(u'main_window', u'&Online Help'))
self.HelpWebSiteItem.setText(translate(u'main_window', u'&Web Site'))
self.LanguageTranslateItem.setText(translate(u'main_window', u'&Translate'))
self.LanguageTranslateItem.setStatusTip(translate(u'main_window', u'Translate the interface to your language'))
self.LanguageEnglishItem.setText(translate(u'main_window', u'English'))
self.LanguageEnglishItem.setStatusTip(translate(u'main_window', u'Set the interface language to English'))
self.ToolsAddToolItem.setText(translate(u'main_window', u'&Add Tool...'))
self.ToolsAddToolItem.setStatusTip(translate(u'main_window', u'Add an application to the list of tools'))
self.action_Preview_Panel.setText(translate(u'main_window', u'&Preview Pane'))
self.ModeLiveItem.setText(translate(u'main_window', u'&Live'))
self.mainWindow.setWindowTitle(translate(u'mainWindow', u'openlp.org 2.0'))
self.FileMenu.setTitle(translate(u'mainWindow', u'&File'))
self.FileImportMenu.setTitle(translate(u'mainWindow', u'&Import'))
self.FileExportMenu.setTitle(translate(u'mainWindow', u'&Export'))
self.OptionsMenu.setTitle(translate(u'mainWindow', u'&Options'))
self.OptionsViewMenu.setTitle(translate(u'mainWindow', u'&View'))
self.ViewModeMenu.setTitle(translate(u'mainWindow', u'M&ode'))
self.OptionsLanguageMenu.setTitle(translate(u'mainWindow', u'&Language'))
self.ToolsMenu.setTitle(translate(u'mainWindow', u'&Tools'))
self.HelpMenu.setTitle(translate(u'mainWindow', u'&Help'))
self.MediaManagerDock.setWindowTitle(translate(u'mainWindow', u'Media Manager'))
self.ServiceManagerDock.setWindowTitle(translate(u'mainWindow', u'Service Manager'))
# self.ServiceManagerContents.MoveTopButton.setText(translate(u'mainWindow', u'Move To Top'))
# self.ServiceManagerContents.MoveUpButton.setText(translate(u'mainWindow', u'Move Up'))
# self.ServiceManagerContents.MoveDownButton.setText(translate(u'mainWindow', u'Move Down'))
# self.ServiceManagerContents.MoveBottomButton.setText(translate(u'mainWindow', u'Move To Bottom'))
# self.ServiceManagerContents.NewItem.setText(translate(u'mainWindow', u'New Service'))
# self.ServiceManagerContents.OpenItem.setText(translate(u'mainWindow', u'Open Service'))
# self.ServiceManagerContents.SaveItem.setText(translate(u'mainWindow', u'Save Service'))
# self.ServiceManagerContents.ThemeComboBox.setItemText(0, translate(u'mainWindow', u'African Sunset'))
# self.ServiceManagerContents.ThemeComboBox.setItemText(1, translate(u'mainWindow', u'Snowy Mountains'))
# self.ServiceManagerContents.ThemeComboBox.setItemText(2, translate(u'mainWindow', u'Wilderness'))
self.ThemeManagerDock.setWindowTitle(translate(u'mainWindow', u'Theme Manager'))
# self.ThemeNewItem.setText(translate(u'mainWindow', u'New Theme'))
# self.ThemeEditItem.setText(translate(u'mainWindow', u'Edit Theme'))
# self.ThemeDeleteButton.setText(translate(u'mainWindow', u'Delete Theme'))
# self.ThemeImportButton.setText(translate(u'mainWindow', u'Import Theme'))
# self.ThemeExportButton.setText(translate(u'mainWindow', u'Export Theme'))
self.FileNewItem.setText(translate(u'mainWindow', u'&New'))
self.FileNewItem.setToolTip(translate(u'mainWindow', u'New Service'))
self.FileNewItem.setStatusTip(translate(u'mainWindow', u'Create a new Service'))
self.FileNewItem.setShortcut(translate(u'mainWindow', u'Ctrl+N'))
self.FileOpenItem.setText(translate(u'mainWindow', u'&Open'))
self.FileOpenItem.setToolTip(translate(u'mainWindow', u'Open Service'))
self.FileOpenItem.setStatusTip(translate(u'mainWindow', u'Open an existing service'))
self.FileOpenItem.setShortcut(translate(u'mainWindow', u'Ctrl+O'))
self.FileSaveItem.setText(translate(u'mainWindow', u'&Save'))
self.FileSaveItem.setToolTip(translate(u'mainWindow', u'Save Service'))
self.FileSaveItem.setStatusTip(translate(u'mainWindow', u'Save the current service to disk'))
self.FileSaveItem.setShortcut(translate(u'mainWindow', u'Ctrl+S'))
self.FileSaveAsItem.setText(translate(u'mainWindow', u'Save &As...'))
self.FileSaveAsItem.setToolTip(translate(u'mainWindow', u'Save Service As'))
self.FileSaveAsItem.setStatusTip(translate(u'mainWindow', u'Save the current service under a new name'))
self.FileSaveAsItem.setShortcut(translate(u'mainWindow', u'F12'))
self.FileExitItem.setText(translate(u'mainWindow', u'E&xit'))
self.FileExitItem.setStatusTip(translate(u'mainWindow', u'Quit OpenLP 2.0'))
self.FileExitItem.setShortcut(translate(u'mainWindow', u'Alt+F4'))
self.ImportThemeItem.setText(translate(u'mainWindow', u'&Theme'))
self.ImportLanguageItem.setText(translate(u'mainWindow', u'&Language'))
self.ExportThemeItem.setText(translate(u'mainWindow', u'&Theme'))
self.ExportLanguageItem.setText(translate(u'mainWindow', u'&Language'))
self.actionLook_Feel.setText(translate(u'mainWindow', u'Look && &Feel'))
self.OptionsSettingsItem.setText(translate(u'mainWindow', u'&Settings'))
self.ViewMediaManagerItem.setText(translate(u'mainWindow', u'&Media Manager'))
self.ViewMediaManagerItem.setToolTip(translate(u'mainWindow', u'Toggle Media Manager'))
self.ViewMediaManagerItem.setStatusTip(translate(u'mainWindow', u'Toggle the visibility of the Media Manager'))
self.ViewMediaManagerItem.setShortcut(translate(u'mainWindow', u'F8'))
self.ViewThemeManagerItem.setText(translate(u'mainWindow', u'&Theme Manager'))
self.ViewThemeManagerItem.setToolTip(translate(u'mainWindow', u'Toggle Theme Manager'))
self.ViewThemeManagerItem.setStatusTip(translate(u'mainWindow', u'Toggle the visibility of the Theme Manager'))
self.ViewThemeManagerItem.setShortcut(translate(u'mainWindow', u'F10'))
self.ViewServiceManagerItem.setText(translate(u'mainWindow', u'&Service Manager'))
self.ViewServiceManagerItem.setToolTip(translate(u'mainWindow', u'Toggle Service Manager'))
self.ViewServiceManagerItem.setStatusTip(translate(u'mainWindow', u'Toggle the visibility of the Service Manager'))
self.ViewServiceManagerItem.setShortcut(translate(u'mainWindow', u'F9'))
self.ToolsAlertItem.setText(translate(u'mainWindow', u'&Alert'))
self.ToolsAlertItem.setStatusTip(translate(u'mainWindow', u'Show an alert message'))
self.ToolsAlertItem.setShortcut(translate(u'mainWindow', u'F7'))
self.HelpDocumentationItem.setText(translate(u'mainWindow', u'&User Guide'))
self.HelpAboutItem.setText(translate(u'mainWindow', u'&About'))
self.HelpAboutItem.setStatusTip(translate(u'mainWindow', u'More information about OpenLP'))
self.HelpAboutItem.setShortcut(translate(u'mainWindow', u'Ctrl+F1'))
self.HelpOnlineHelpItem.setText(translate(u'mainWindow', u'&Online Help'))
self.HelpWebSiteItem.setText(translate(u'mainWindow', u'&Web Site'))
self.LanguageTranslateItem.setText(translate(u'mainWindow', u'&Translate'))
self.LanguageTranslateItem.setStatusTip(translate(u'mainWindow', u'Translate the interface to your language'))
self.LanguageEnglishItem.setText(translate(u'mainWindow', u'English'))
self.LanguageEnglishItem.setStatusTip(translate(u'mainWindow', u'Set the interface language to English'))
self.ToolsAddToolItem.setText(translate(u'mainWindow', u'&Add Tool...'))
self.ToolsAddToolItem.setStatusTip(translate(u'mainWindow', u'Add an application to the list of tools'))
self.action_Preview_Panel.setText(translate(u'mainWindow', u'&Preview Pane'))
self.ModeLiveItem.setText(translate(u'mainWindow', u'&Live'))
def show(self):
self.main_window.showMaximized()
self.main_display.setup(0)
self.main_display.show()
self.mainWindow.showMaximized()
self.mainDisplay.setup(0)
self.mainDisplay.show()
def onHelpAboutItemClicked(self):
self.about_form.exec_()
self.aboutForm.exec_()
def onToolsAlertItemClicked(self):
self.alert_form.exec_()
self.alertForm.exec_()
def onOptionsSettingsItemClicked(self):
self.settings_form.exec_()
self.settingsForm.exec_()

View File

@ -21,13 +21,8 @@ import os
import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig
from openlp.core.lib import OpenLPToolbar
from openlp.core.lib import ServiceItem
from openlp.core.lib import RenderManager
from openlp.core import translate
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, RenderManager, Event, EventType, EventManager, translate
from openlp import buildIcon
from openlp.core.lib import Event, EventType, EventManager
class ServiceManager(QtGui.QWidget):

View File

@ -22,8 +22,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar
from openlp.core import translate
from openlp.core.lib import OpenLPToolbar, translate
class SlideData(QtCore.QAbstractListModel):
"""

View File

@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import QtCore, QtGui
from openlp.core import translate
from openlp.core.lib import translate
class SplashScreen(object):
def __init__(self, version):

View File

@ -23,23 +23,17 @@ import zipfile
import shutil
from time import sleep
from copy import deepcopy
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import *
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from openlp.core.ui import AmendThemeForm, ServiceManager
from openlp.core import translate, fileToXML
from openlp.core.theme import Theme
from openlp.core.lib import Event, EventType, EventManager, OpenLPToolbar, ThemeXML, Renderer
from openlp.core.lib import Event, EventType, EventManager, OpenLPToolbar, ThemeXML, Renderer, translate
from openlp.core.utils import ConfigHelper
from openlp.core.resources import *
import logging
class ThemeData(QAbstractListModel):
class ThemeData(QtCore.QAbstractListModel):
"""
Tree of items for an order of Theme.
Includes methods for reading and writing the contents to an OOS file
@ -49,7 +43,7 @@ class ThemeData(QAbstractListModel):
log=logging.getLogger(u'ThemeData')
def __init__(self):
QAbstractListModel.__init__(self)
QtCore.QAbstractListModel.__init__(self)
self.items = []
self.rowheight = 50
self.maximagewidth = self.rowheight * 16 / 9.0;
@ -62,36 +56,36 @@ class ThemeData(QAbstractListModel):
return len(self.items)
def insertRow(self, row, filename):
self.beginInsertRows(QModelIndex(), row, row)
self.beginInsertRows(QtCore.QModelIndex(), row, row)
log.info(u'insert row %d:%s' % (row, filename))
(prefix, shortfilename) = os.path.split(str(filename))
log.info(u'shortfilename = %s' % shortfilename)
theme = shortfilename.split(u'.')
# create a preview image
if os.path.exists(filename):
preview = QPixmap(str(filename))
preview = QtGui.QPixmap(str(filename))
width = self.maximagewidth
height = self.rowheight
preview = preview.scaled(width, height, Qt.KeepAspectRatio, Qt.SmoothTransformation)
preview = preview.scaled(width, height, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
realwidth = preview.width()
realheight = preview.height()
# and move it to the centre of the preview space
pixmap = QPixmap(width, height)
pixmap.fill(Qt.transparent)
painter = QPainter(pixmap)
pixmap = QtGui.QPixmap(width, height)
pixmap.fill(QtCore.Qt.transparent)
painter = QtGui.QPainter(pixmap)
painter.drawPixmap((width - realwidth) / 2, (height - realheight) / 2, preview)
else:
width = self.maximagewidth
height = self.rowheight
pixmap = QPixmap(width, height)
pixmap.fill(Qt.transparent)
pixmap = QtGui.QtGui.QPixmap(width, height)
pixmap.fill(QtCore.Qt.transparent)
# finally create the row
self.items.insert(row, (filename, pixmap, shortfilename, theme[0]))
log.info(u'Items: %s' % self.items)
self.endInsertRows()
def removeRow(self, row):
self.beginRemoveRows(QModelIndex(), row, row)
self.beginRemoveRows(QtCore.QModelIndex(), row, row)
self.items.pop(row)
self.endRemoveRows()
@ -102,16 +96,16 @@ class ThemeData(QAbstractListModel):
row = index.row()
if row > len(self.items):
# if the last row is selected and deleted, we then get called with an empty row!
return QVariant()
if role == Qt.DisplayRole:
return QtCore.QVariant()
if role == QtCore.Qt.DisplayRole:
retval = self.items[row][3]
elif role == Qt.DecorationRole:
elif role == QtCore.Qt.DecorationRole:
retval = self.items[row][1]
else:
retval = QVariant()
retval = QtCore.QVariant()
#log.info("Returning"+ str(retval))
if type(retval) is not type(QVariant):
return QVariant(retval)
if type(retval) is not type(QtCore.QVariant):
return QtCore.QVariant(retval)
else:
return retval
@ -131,15 +125,15 @@ class ThemeData(QAbstractListModel):
filelist = [item[3] for item in self.items]
return filelist
class ThemeManager(QWidget):
class ThemeManager(QtGui.QWidget):
"""
Manages the orders of Theme.
"""
global log
log=logging.getLogger(u'ThemeManager')
log = logging.getLogger(u'ThemeManager')
def __init__(self, parent):
QWidget.__init__(self)
QtGui.QWidget.__init__(self)
self.parent = parent
self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0)
@ -224,7 +218,7 @@ class ThemeManager(QWidget):
self.themeData.addRow(os.path.join(self.path, name))
self.EventManager.post_event(Event(EventType.ThemeListChanged))
self.ServiceManager.updateThemeList(self.getThemes())
self.parent.settings_form.ThemesTab.updateThemeList(self.getThemes())
self.parent.settingsForm.ThemesTab.updateThemeList(self.getThemes())
def getThemes(self):

View File

@ -20,8 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import QtCore, QtGui
from openlp.core import translate
from openlp.core.lib import SettingsTab
from openlp.core.lib import SettingsTab, translate
class ThemesTab(SettingsTab):
"""

View File

@ -383,7 +383,7 @@ class BibleMediaItem(MediaManagerItem):
verse = str(self.search_results[0][2])
text = self.search_results[0][3]
if self.parent.bibles_tab.paragraph_style: #Paragraph
text = text + u'\n'
text = text + u'\n\n'
if self.parent.bibles_tab.display_style == 1:
loc = self.formatVerse(old_chapter, chapter, verse, u'(', u')')
elif self.parent.bibles_tab.display_style == 2: