bzr-revno: 449
This commit is contained in:
Tim Bentley 2009-06-01 18:38:08 +01:00
commit 4069a698ab
49 changed files with 631 additions and 667 deletions

View File

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

View File

@ -1,7 +1,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
@ -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 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
""" """
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,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 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 PyQt4 import QtCore, QtGui
from settingsmanager import SettingsManager from settingsmanager import SettingsManager
from openlp.core.lib.pluginmanager import PluginManager from openlp.core.lib.pluginmanager import PluginManager
__all__ = ['SettingsManager', 'PluginManager', 'translate', __all__ = ['SettingsManager', 'PluginManager' ]
'fileToXML' ]
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,46 @@ 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 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
""" """
import types
from PyQt4 import QtCore, QtGui
def translate(context, text):
return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
def file_to_xml(xmlfile):
return open(xmlfile).read()
def str_to_bool(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
def contextMenuAction(base, icon, text, slot):
"""
Utility method to help build context menus for plugins
"""
action = QtGui.QAction(text, base)
action .setIcon(buildIcon(icon))
QtCore.QObject.connect(action, QtCore.SIGNAL("triggered()"), slot)
return action
def contextMenuSeparator(base):
action = QtGui.QAction("", base)
action.setSeparator(True)
return action
from pluginconfig import PluginConfig from pluginconfig import PluginConfig
from plugin import Plugin from plugin import Plugin
from settingstab import SettingsTab from settingstab import SettingsTab
@ -35,6 +75,11 @@ from themexmlhandler import ThemeXML
from renderer import Renderer from renderer import Renderer
from rendermanager import RenderManager from rendermanager import RenderManager
__all__ = ['Renderer','PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType' #__all__ = ['Renderer','PluginConfig', 'Plugin', 'SettingsTab', 'MediaManagerItem', 'Event', 'EventType'
'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder', # 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder',
'SongXMLParser', 'EventManager', 'ThemeXML', 'RenderManager'] # 'SongXMLParser', 'EventManager', 'ThemeXML', 'RenderManager']
__all__ = [ 'translate', 'file_to_xml', 'str_to_bool', 'contextMenuAction', 'contextMenuSeparator']

View File

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

View File

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

View File

@ -2,7 +2,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
@ -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 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. 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 This is a private class and should not be used directly but via the Receiver class
""" """
def __init__(self): def __init__(self):
QObject.__init__(self) QtCore.QObject.__init__(self)
def send_message(self, event, msg=None): def send_message(self, event, msg=None):
self.emit(SIGNAL(event), msg) self.emit(SIGNAL(event), msg)

View File

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

View File

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

View File

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

View File

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

View File

@ -177,13 +177,11 @@ class Renderer:
painter.drawPath(rectPath) painter.drawPath(rectPath)
elif self._theme.background_type== u'image': # image elif self._theme.background_type== u'image': # image
r = self._frame.rect() #r = self._frame.rect()
log.debug(u'Image size details %d %d %d %d ', r.x(), r.y(), r.width(),r.height()) #log.debug(u'Image size details %d %d %d %d ', r.x(), r.y(), r.width(),r.height())
#log.debug(u' Background Parameter %d ', self._theme.background_color1)
#if self._theme.background_color1 is not None:
# p.fillRect(self._frame.rect(), self._theme.background_borderColor)
if self.bg_image is not None: if self.bg_image is not None:
painter.drawPixmap(self.background_offsetx,self.background_offsety, self.bg_image) #painter.drawPixmap(self.background_offsetx,self.background_offsety, self.bg_image)
painter.drawPixmap(0 ,0 , self.bg_image)
else: else:
painter.fillRect(self._frame.rect(), QtGui.QColor(u'#000000')) painter.fillRect(self._frame.rect(), QtGui.QColor(u'#000000'))
painter.end() painter.end()
@ -204,24 +202,29 @@ class Renderer:
bboxes = [] bboxes = []
for line in lines: for line in lines:
bboxes.append(self._render_single_line(line, footer)) bboxes.append(self._render_single_line(line, footer))
#print line, bboxes
numlines = len(lines) numlines = len(lines)
bottom = self._rect.bottom() bottom = self._rect.bottom()
for ratio in (numlines, numlines/2, numlines/3, numlines/4): #for ratio in (numlines): #, numlines/2, numlines/3, numlines/4):
good = 1 ratio = numlines
startline = 0 good = 1
endline = startline + ratio startline = 0
while (endline <= numlines): endline = startline + ratio
by = 0 while (endline <= numlines):
for (x, y) in bboxes[startline:endline]: by = 0
by += y for (x, y) in bboxes[startline:endline]:
if by > bottom: by += y
good=0 #print by
break #print by , bottom
startline += ratio if by > bottom:
endline = startline+ratio good=0
if good == 1:
break break
startline += ratio
endline = startline+ratio
# if good == 1:
# break
#print "---------"
retval = [] retval = []
numlines_per_page = ratio numlines_per_page = ratio

View File

@ -63,6 +63,7 @@ class RenderManager:
self.renderer = Renderer() self.renderer = Renderer()
self.calculate_default(self.screen_list[self.current_display]['size']) self.calculate_default(self.screen_list[self.current_display]['size'])
self.theme = u'' self.theme = u''
self.service_theme = u''
def set_global_theme(self, global_theme, global_style = u'Global'): def set_global_theme(self, global_theme, global_style = u'Global'):
self.global_theme = global_theme self.global_theme = global_theme
@ -83,11 +84,13 @@ class RenderManager:
else: else:
if theme is not None: if theme is not None:
self.theme = theme self.theme = theme
elif self.global_style == u'Service': elif self.global_style == u'Song' or self.global_style == u'Service':
if self.service_theme == u'': if self.service_theme == u'':
self.theme = self.global_theme self.theme = self.global_theme
else: else:
self.theme = self.service_theme self.theme = self.service_theme
else:
self.theme = self.global_theme
if self.theme is not self.renderer.theme_name: if self.theme is not self.renderer.theme_name:
log.debug(u'theme is now %s', self.theme) log.debug(u'theme is now %s', self.theme)
@ -117,7 +120,7 @@ class RenderManager:
def generate_preview(self, themedata): def generate_preview(self, themedata):
log.debug(u'generate preview') log.debug(u'generate preview')
self.calculate_default(QtCore.QSize(800, 600)) self.calculate_default(QtCore.QSize(1024, 768))
self.renderer.set_theme(themedata) self.renderer.set_theme(themedata)
self.build_text_rectangle(themedata) self.build_text_rectangle(themedata)

View File

@ -19,10 +19,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import logging import logging
import time import time
from openlp import buildIcon from openlp.core.lib import buildIcon
from PyQt4.QtCore import * from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import *
class ServiceItem(): class ServiceItem():
""" """
@ -44,6 +42,8 @@ class ServiceItem():
self.items = [] self.items = []
self.iconic_representation = None self.iconic_representation = None
self.raw_slides = None self.raw_slides = None
self.frame_titles = []
self.command_files = []
self.frames = [] self.frames = []
self.raw_footer = None self.raw_footer = None
self.theme = None self.theme = None
@ -62,11 +62,14 @@ class ServiceItem():
else: else:
self.render_manager.set_override_theme(self.theme) self.render_manager.set_override_theme(self.theme)
log.debug(u'Formatting slides') log.debug(u'Formatting slides')
if len(self.frames) == 0 : if len(self.frames) == 0 and len(self.raw_slides) > 0 :
for slide in self.raw_slides: for slide in self.raw_slides:
formated = self.render_manager.format_slide(slide, False) formated = self.render_manager.format_slide(slide, False)
frame = self.render_manager.generate_slide(formated, self.raw_footer) frame = self.render_manager.generate_slide(formated, self.raw_footer)
self.frames.append({u'formatted': formated, u'image': frame}) self.frames.append({u'title': formated, u'image': frame})
else:
if len(self.command_files) > 0:
pass
def get_parent_node(self): def get_parent_node(self):

View File

@ -22,7 +22,7 @@ from xml.etree.ElementTree import ElementTree, XML, dump
For XML Schema see wiki.openlp.org For XML Schema see wiki.openlp.org
""" """
import os, os.path import os, os.path
from openlp import convertStringToBoolean from openlp.core.lib import str_to_bool
from xml.dom.minidom import Document from xml.dom.minidom import Document
from xml.etree.ElementTree import ElementTree, XML, dump from xml.etree.ElementTree import ElementTree, XML, dump
@ -69,12 +69,14 @@ class ThemeXML():
# Create the minidom document # Create the minidom document
self.theme_xml = Document() self.theme_xml = Document()
def extend_filename(self, path): def extend_image_filename(self, path):
"""
Add the path name to the image name so the background can be rendered.
"""
if self.background_filename is not None: if self.background_filename is not None:
self.background_filename = os.path.join(path, self.theme_name, self.background_filename) self.background_filename = os.path.join(path, self.theme_name, self.background_filename)
def new_document(self, name): def new_document(self, name):
# Create the <song> base element
self.theme = self.theme_xml.createElement(u'theme') self.theme = self.theme_xml.createElement(u'theme')
self.theme_xml.appendChild(self.theme) self.theme_xml.appendChild(self.theme)
self.theme.setAttribute(u'version', u'1.0') self.theme.setAttribute(u'version', u'1.0')
@ -85,89 +87,92 @@ class ThemeXML():
self.theme.appendChild(self.name) self.theme.appendChild(self.name)
def add_background_transparent(self): def add_background_transparent(self):
# Create the main <lyrics> element """
Add a transparent background.
"""
background = self.theme_xml.createElement(u'background') background = self.theme_xml.createElement(u'background')
background.setAttribute(u'mode', u'transparent') background.setAttribute(u'mode', u'transparent')
self.theme.appendChild(background) self.theme.appendChild(background)
def add_background_solid(self, bkcolor): def add_background_solid(self, bkcolor):
"""
Add a Solid background.
"""
background = self.theme_xml.createElement(u'background') background = self.theme_xml.createElement(u'background')
background.setAttribute(u'mode', u'opaque') background.setAttribute(u'mode', u'opaque')
background.setAttribute(u'type', u'solid') background.setAttribute(u'type', u'solid')
self.theme.appendChild(background) self.theme.appendChild(background)
color = self.theme_xml.createElement(u'color') self.child_element(background, u'color', bkcolor)
bkc = self.theme_xml.createTextNode(bkcolor)
color.appendChild(bkc)
background.appendChild(color)
def add_background_gradient(self, startcolor, endcolor, direction): def add_background_gradient(self, startcolor, endcolor, direction):
"""
Add a gradient background.
"""
background = self.theme_xml.createElement(u'background') background = self.theme_xml.createElement(u'background')
background.setAttribute(u'mode', u'opaque') background.setAttribute(u'mode', u'opaque')
background.setAttribute(u'type', u'gradient') background.setAttribute(u'type', u'gradient')
self.theme.appendChild(background) self.theme.appendChild(background)
color = self.theme_xml.createElement(u'startColor') # Create startColor element
bkc = self.theme_xml.createTextNode(startcolor) self.child_element(background, u'startColor', startcolor)
color.appendChild(bkc) # Create endColor element
background.appendChild(color) self.child_element(background, u'endColor', endcolor)
# Create direction element
color = self.theme_xml.createElement(u'endColor') self.child_element(background, u'direction', direction)
bkc = self.theme_xml.createTextNode(endcolor)
color.appendChild(bkc)
background.appendChild(color)
color = self.theme_xml.createElement(u'direction')
bkc = self.theme_xml.createTextNode(direction)
color.appendChild(bkc)
background.appendChild(color)
def add_background_image(self, filename): def add_background_image(self, filename):
"""
Add a image background.
"""
background = self.theme_xml.createElement(u'background') background = self.theme_xml.createElement(u'background')
background.setAttribute(u'mode', u'opaque') background.setAttribute(u'mode', u'opaque')
background.setAttribute(u'type', u'image') background.setAttribute(u'type', u'image')
self.theme.appendChild(background) self.theme.appendChild(background)
color = self.theme_xml.createElement(u'filename') #Create Filename element
bkc = self.theme_xml.createCDATASection(filename) self.child_element(background, u'filename', filename)
color.appendChild(bkc)
background.appendChild(color)
def add_font(self, name, color, proportion, override, fonttype=u'main', xpos=0, ypos=0 ,width=0, height=0): def add_font(self, name, color, proportion, override, fonttype=u'main', xpos=0, ypos=0 ,width=0, height=0):
"""
Add a Font.
"""
background = self.theme_xml.createElement(u'font') background = self.theme_xml.createElement(u'font')
background.setAttribute(u'type',fonttype) background.setAttribute(u'type',fonttype)
self.theme.appendChild(background) self.theme.appendChild(background)
element = self.theme_xml.createElement(u'name') #Create Font name element
fn = self.theme_xml.createTextNode(name) self.child_element(background, u'name', name)
element.appendChild(fn)
background.appendChild(element)
element = self.theme_xml.createElement(u'color') #Create Font color element
fn = self.theme_xml.createTextNode(color) self.child_element(background, u'color', color)
element.appendChild(fn)
background.appendChild(element)
element = self.theme_xml.createElement(u'proportion') #Create Proportion name element
fn = self.theme_xml.createTextNode(proportion) self.child_element(background, u'proportion', proportion)
element.appendChild(fn)
background.appendChild(element)
#Create Proportion name element
self.child_element(background, u'proportion', proportion)
#Create Location element
element = self.theme_xml.createElement(u'location') element = self.theme_xml.createElement(u'location')
element.setAttribute(u'override',override) element.setAttribute(u'override',override)
if override == u'True': if override == u'True':
element.setAttribute(u'x',xpos) element.setAttribute(u'x', xpos)
element.setAttribute(u'y',ypos) element.setAttribute(u'y', ypos)
element.setAttribute(u'width',width) element.setAttribute(u'width', width)
element.setAttribute(u'height',height) element.setAttribute(u'height', height)
background.appendChild(element) background.appendChild(element)
def add_display(self, shadow, shadowColor, outline, outlineColor, horizontal, vertical, wrap): def add_display(self, shadow, shadowColor, outline, outlineColor, horizontal, vertical, wrap):
"""
Add a Display options.
"""
background = self.theme_xml.createElement(u'display') background = self.theme_xml.createElement(u'display')
self.theme.appendChild(background) self.theme.appendChild(background)
tagElement = self.theme_xml.createElement(u'shadow') tagElement = self.theme_xml.createElement(u'shadow')
tagElement.setAttribute(u'color',shadowColor) tagElement.setAttribute(u'color',shadowColor)
tagValue = self.theme_xml.createTextNode(shadow) tagValue = self.theme_xml.createTextNode(shadow)
tagElement.appendChild(tagValue) tagElement.appendChild(tagValue)
@ -194,15 +199,15 @@ class ThemeXML():
tagElement.appendChild(tagValue) tagElement.appendChild(tagValue)
background.appendChild(tagElement) background.appendChild(tagElement)
def child_element(self, tag, value): def child_element(self, element, tag, value):
tagElement = self.theme_xml.createElement(tag) child = self.theme_xml.createElement(tag)
tagValue = self.theme_xml.createTextNode(value) child.appendChild(self.theme_xml.createTextNode(value))
tagElement.appendChild(ftagValue) element.appendChild(child)
self.background.appendChild(tagElement) return child
def dump_xml(self): def dump_xml(self):
# Debugging aid to see what we have # Debugging aid to see what we have
print self.theme_xml.toprettyxml(indent=" ") print self.theme_xml.toprettyxml(indent=u' ')
def extract_xml(self): def extract_xml(self):
# Print our newly created XML # Print our newly created XML
@ -211,18 +216,19 @@ class ThemeXML():
def parse(self, xml): def parse(self, xml):
self.baseParseXml() self.baseParseXml()
self.parse_xml(xml) self.parse_xml(xml)
self.theme_filename_extended = False
def baseParseXml(self): def baseParseXml(self):
self.parse_xml(blankthemexml) self.parse_xml(blankthemexml)
def parse_xml(self, xml): def parse_xml(self, xml):
theme_xml = ElementTree(element=XML(xml)) theme_xml = ElementTree(element=XML(xml))
iter=theme_xml.getiterator() iter = theme_xml.getiterator()
master = u'' master = u''
for element in iter: for element in iter:
#print element.tag, element.text #print element.tag, element.text
if len(element.getchildren()) > 0: if len(element.getchildren()) > 0:
master= element.tag + u'_' master = element.tag + u'_'
if len(element.attrib) > 0: if len(element.attrib) > 0:
#print "D", element.tag , element.attrib #print "D", element.tag , element.attrib
for e in element.attrib.iteritems(): for e in element.attrib.iteritems():
@ -231,18 +237,18 @@ class ThemeXML():
master += e[1] + u'_' master += e[1] + u'_'
elif master == u'display_' and (element.tag == u'shadow' or element.tag == u'outline'): elif master == u'display_' and (element.tag == u'shadow' or element.tag == u'outline'):
#print "b", master, element.tag, element.text, e[0], e[1] #print "b", master, element.tag, element.text, e[0], e[1]
et = convertStringToBoolean(element.text) et = str_to_bool(element.text)
setattr(self, master + element.tag , et) setattr(self, master + element.tag , et)
setattr(self, master + element.tag +u'_'+ e[0], e[1]) setattr(self, master + element.tag + u'_'+ e[0], e[1])
else: else:
field = master + e[0] field = master + e[0]
e1 = e[1] e1 = e[1]
if e[1] == u'True' or e[1] == u'False': if e[1] == u'True' or e[1] == u'False':
e1 = convertStringToBoolean(e[1]) e1 = str_to_bool(e[1])
setattr(self, field, e1) setattr(self, field, e1)
else: else:
#print "c", element.tag, element.text #print "c", element.tag, element.text
if element.tag is not None : if element.tag is not None:
field = master + element.tag field = master + element.tag
setattr(self, field, element.text) setattr(self, field, element.text)
@ -250,5 +256,5 @@ class ThemeXML():
s = u'' s = u''
for k in dir(self): for k in dir(self):
if k[0:1] != u'_': if k[0:1] != u'_':
s+= u'%30s : %s\n' %(k,getattr(self,k)) s += u'%30s : %s\n' %(k,getattr(self,k))
return s return s

View File

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

View File

@ -19,135 +19,129 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog
from openlp.core import translate from openlp.core.lib import translate
from openlp.core.resources import *
class AboutForm(QDialog): class AboutForm(QtGui.QDialog):
def __init__(self, parent=None): def __init__(self, parent=None):
QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
def setupUi(self, AboutForm): def setupUi(self, AboutForm):
AboutForm.setObjectName("AboutForm") AboutForm.setObjectName(u'AboutForm')
AboutForm.resize(470, 481) AboutForm.resize(470, 481)
icon = QtGui.QIcon() icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icon/openlp-logo-16x16.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
AboutForm.setWindowIcon(icon) AboutForm.setWindowIcon(icon)
AboutFormLayout = QtGui.QVBoxLayout(AboutForm) AboutFormLayout = QtGui.QVBoxLayout(AboutForm)
AboutFormLayout.setSpacing(8) AboutFormLayout.setSpacing(8)
AboutFormLayout.setMargin(8) AboutFormLayout.setMargin(8)
AboutFormLayout.setObjectName("AboutDialogLayout") AboutFormLayout.setObjectName(u'AboutDialogLayout')
self.Logo = QtGui.QLabel(AboutForm) self.Logo = QtGui.QLabel(AboutForm)
self.Logo.setAutoFillBackground(False) self.Logo.setAutoFillBackground(False)
self.Logo.setStyleSheet("background-color: rgb(255, 255, 255);") self.Logo.setStyleSheet(u'background-color: rgb(255, 255, 255);')
self.Logo.setFrameShape(QtGui.QFrame.StyledPanel) self.Logo.setFrameShape(QtGui.QFrame.StyledPanel)
self.Logo.setLineWidth(1) self.Logo.setLineWidth(1)
self.Logo.setPixmap(QtGui.QPixmap(":/graphics/openlp-about-logo.png")) self.Logo.setPixmap(QtGui.QPixmap(u':/graphics/openlp-about-logo.png'))
self.Logo.setScaledContents(False) self.Logo.setScaledContents(False)
self.Logo.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.Logo.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.Logo.setObjectName("Logo") self.Logo.setObjectName(u'Logo')
AboutFormLayout.addWidget(self.Logo) AboutFormLayout.addWidget(self.Logo)
self.AboutNotebook = QtGui.QTabWidget(AboutForm) self.AboutNotebook = QtGui.QTabWidget(AboutForm)
self.AboutNotebook.setObjectName("AboutNotebook") self.AboutNotebook.setObjectName(u'AboutNotebook')
self.LicenseTab = QtGui.QWidget() self.LicenseTab = QtGui.QWidget()
self.LicenseTab.setObjectName("LicenseTab") self.LicenseTab.setObjectName(u'LicenseTab')
self.LicenseTabLayout = QtGui.QVBoxLayout(self.LicenseTab) self.LicenseTabLayout = QtGui.QVBoxLayout(self.LicenseTab)
self.LicenseTabLayout.setSpacing(8) self.LicenseTabLayout.setSpacing(8)
self.LicenseTabLayout.setMargin(8) self.LicenseTabLayout.setMargin(8)
self.LicenseTabLayout.setObjectName("LicenseTabLayout") self.LicenseTabLayout.setObjectName(u'LicenseTabLayout')
self.CopyrightLabel = QtGui.QLabel(self.LicenseTab) self.CopyrightLabel = QtGui.QLabel(self.LicenseTab)
self.CopyrightLabel.setObjectName("CopyrightLabel") self.CopyrightLabel.setObjectName(u'CopyrightLabel')
self.LicenseTabLayout.addWidget(self.CopyrightLabel) self.LicenseTabLayout.addWidget(self.CopyrightLabel)
self.AboutAuthors = QtGui.QLabel(self.LicenseTab) self.AboutAuthors = QtGui.QLabel(self.LicenseTab)
self.AboutAuthors.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter) self.AboutAuthors.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter)
self.AboutAuthors.setWordWrap(True) self.AboutAuthors.setWordWrap(True)
self.AboutAuthors.setObjectName("AboutAuthors") self.AboutAuthors.setObjectName(u'AboutAuthors')
self.LicenseTabLayout.addWidget(self.AboutAuthors) self.LicenseTabLayout.addWidget(self.AboutAuthors)
self.License1Label = QtGui.QLabel(self.LicenseTab) self.License1Label = QtGui.QLabel(self.LicenseTab)
self.License1Label.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter) self.License1Label.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter)
self.License1Label.setWordWrap(True) self.License1Label.setWordWrap(True)
self.License1Label.setObjectName("License1Label") self.License1Label.setObjectName(u'License1Label')
self.LicenseTabLayout.addWidget(self.License1Label) self.LicenseTabLayout.addWidget(self.License1Label)
self.License2Label = QtGui.QLabel(self.LicenseTab) self.License2Label = QtGui.QLabel(self.LicenseTab)
self.License2Label.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter) self.License2Label.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter)
self.License2Label.setWordWrap(True) self.License2Label.setWordWrap(True)
self.License2Label.setObjectName("License2Label") self.License2Label.setObjectName(u'License2Label')
self.LicenseTabLayout.addWidget(self.License2Label) self.LicenseTabLayout.addWidget(self.License2Label)
self.License3Label = QtGui.QLabel(self.LicenseTab) self.License3Label = QtGui.QLabel(self.LicenseTab)
self.License3Label.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter) self.License3Label.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter)
self.License3Label.setWordWrap(True) self.License3Label.setWordWrap(True)
self.License3Label.setObjectName("License3Label") self.License3Label.setObjectName(u'License3Label')
self.LicenseTabLayout.addWidget(self.License3Label) self.LicenseTabLayout.addWidget(self.License3Label)
self.AboutNotebook.addTab(self.LicenseTab, "License") self.AboutNotebook.addTab(self.LicenseTab, u'License')
self.CreditsTab = QtGui.QWidget() self.CreditsTab = QtGui.QWidget()
self.CreditsTab.setObjectName("CreditsTab") self.CreditsTab.setObjectName(u'CreditsTab')
self.CreditsTabLayout = QtGui.QVBoxLayout(self.CreditsTab) self.CreditsTabLayout = QtGui.QVBoxLayout(self.CreditsTab)
self.CreditsTabLayout.setSpacing(0) # self.CreditsTabLayout.setSpacing(0) #
self.CreditsTabLayout.setMargin(8) # self.CreditsTabLayout.setMargin(8) #
self.CreditsTabLayout.setObjectName("CreditsTabLayout") self.CreditsTabLayout.setObjectName(u'CreditsTabLayout')
self.CreditsTextEdit = QtGui.QTextEdit(self.CreditsTab) self.CreditsTextEdit = QtGui.QTextEdit(self.CreditsTab)
self.CreditsTextEdit.setReadOnly(True) self.CreditsTextEdit.setReadOnly(True)
self.CreditsTextEdit.setObjectName("CreditsTextEdit") self.CreditsTextEdit.setObjectName(u'CreditsTextEdit')
self.CreditsTabLayout.addWidget(self.CreditsTextEdit) self.CreditsTabLayout.addWidget(self.CreditsTextEdit)
self.AboutNotebook.addTab(self.CreditsTab, "Credits") self.AboutNotebook.addTab(self.CreditsTab, u'Credits')
AboutFormLayout.addWidget(self.AboutNotebook) AboutFormLayout.addWidget(self.AboutNotebook)
self.ButtonWidget = QtGui.QWidget(AboutForm) self.ButtonWidget = QtGui.QWidget(AboutForm)
self.ButtonWidget.setObjectName("ButtonWidget") self.ButtonWidget.setObjectName(u'ButtonWidget')
self.ButtonWidgetLayout = QtGui.QHBoxLayout(self.ButtonWidget) self.ButtonWidgetLayout = QtGui.QHBoxLayout(self.ButtonWidget)
self.ButtonWidgetLayout.setSpacing(8) self.ButtonWidgetLayout.setSpacing(8)
self.ButtonWidgetLayout.setMargin(0) self.ButtonWidgetLayout.setMargin(0)
self.ButtonWidgetLayout.setObjectName("ButtonWidgetLayout") self.ButtonWidgetLayout.setObjectName(u'ButtonWidgetLayout')
spacerItem = QtGui.QSpacerItem(275, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem = QtGui.QSpacerItem(275, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.ButtonWidgetLayout.addItem(spacerItem) self.ButtonWidgetLayout.addItem(spacerItem)
self.ContributeButton = QtGui.QPushButton(self.ButtonWidget) self.ContributeButton = QtGui.QPushButton(self.ButtonWidget)
self.ContributeButton.setObjectName("ContributeButton") self.ContributeButton.setObjectName(u'ContributeButton')
self.ButtonWidgetLayout.addWidget(self.ContributeButton) self.ButtonWidgetLayout.addWidget(self.ContributeButton)
self.CloseButton = QtGui.QPushButton(self.ButtonWidget) self.CloseButton = QtGui.QPushButton(self.ButtonWidget)
self.CloseButton.setObjectName("CloseButton") self.CloseButton.setObjectName(u'CloseButton')
self.ButtonWidgetLayout.addWidget(self.CloseButton) self.ButtonWidgetLayout.addWidget(self.CloseButton)
AboutFormLayout.addWidget(self.ButtonWidget) AboutFormLayout.addWidget(self.ButtonWidget)
self.extContributeItem = QtGui.QAction(AboutForm) self.extContributeItem = QtGui.QAction(AboutForm)
self.extContributeItem.setObjectName("extContributeItem") self.extContributeItem.setObjectName(u'extContributeItem')
self.retranslateUi(AboutForm) self.retranslateUi(AboutForm)
self.AboutNotebook.setCurrentIndex(0) self.AboutNotebook.setCurrentIndex(0)
QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL("clicked()"), AboutForm.close) QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'), AboutForm.close)
QtCore.QMetaObject.connectSlotsByName(AboutForm) QtCore.QMetaObject.connectSlotsByName(AboutForm)
QtCore.QObject.connect(self.ContributeButton, QtCore.SIGNAL("clicked()"), self.onContributeButtonClicked) QtCore.QObject.connect(self.ContributeButton, QtCore.SIGNAL(u'clicked()'), self.onContributeButtonClicked)
def retranslateUi(self, AboutForm): def retranslateUi(self, AboutForm):
AboutForm.setWindowTitle(translate("AboutDialog", "About openlp.org",)) AboutForm.setWindowTitle(translate(u'AboutDialog', u'About openlp.org',))
self.CopyrightLabel.setText(translate("AboutDialog", "Copyright © 2004-2009 openlp.org Foundation")) self.CopyrightLabel.setText(translate(u'AboutDialog', u'Copyright © 2004-2009 openlp.org Foundation'))
self.AboutAuthors.setText(translate("AboutDialog", "openlp.org is written and maintained by volunteers. If you would like to see more free Christian software being written, please consider contributing by using the button below.")) self.AboutAuthors.setText(translate(u'AboutDialog', u'openlp.org is written and maintained by volunteers. If you would like to see more free Christian software being written, please consider contributing by using the button below.'))
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.License1Label.setText(translate(u'AboutDialog', u'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.License2Label.setText(translate(u'AboutDialog', u'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.License3Label.setText(translate(u'AboutDialog', u'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(u'AboutDialog', u'License'))
self.CreditsTextEdit.setPlainText(translate("AboutDialog", "Project Lead\n" self.CreditsTextEdit.setPlainText(translate(u'AboutDialog',
" Raoul \"superfly\" Snyman\n" u'Project Lead\n'
"\n" u' Raoul \"superfly\" Snyman\n'
"Developers\n" u'\n'
" Tim \"TRB143\" Bentley\n" u'Developers\n'
" Jonathan \"gushie\" Corwin\n" u' Tim \"TRB143\" Bentley\n'
" Scott \"sguerrieri\" Guerrieri\n" u' Jonathan \"gushie\" Corwin\n'
" Raoul \"superfly\" Snyman\n" u' Scott \"sguerrieri\" Guerrieri\n'
" Martin \"mijiti\" Thompson\n" u' Raoul \"superfly\" Snyman\n'
" Carsten \"catini\" Tingaard")) u' Martin \"mijiti\" Thompson\n'
self.AboutNotebook.setTabText(self.AboutNotebook.indexOf(self.CreditsTab), translate("AboutDialog", "Credits")) u' Carsten \"catini\" Tingaard'))
self.ContributeButton.setText(translate("AboutDialog", "Contribute")) self.AboutNotebook.setTabText(self.AboutNotebook.indexOf(self.CreditsTab), translate(u'AboutDialog', u'Credits'))
self.CloseButton.setText(translate("AboutDialog", "Close")) self.ContributeButton.setText(translate(u'AboutDialog', u'Contribute'))
self.extContributeItem.setText(translate("AboutDialog", "&Contribute")) self.CloseButton.setText(translate(u'AboutDialog', u'Close'))
self.extContributeItem.setText(translate(u'AboutDialog', u'&Contribute'))
def onContributeButtonClicked(self): 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 import webbrowser
url = "http://www.openlp.org/en/documentation/introduction/contributing.html" url = "http://www.openlp.org/en/documentation/introduction/contributing.html"
webbrowser.open_new(url) webbrowser.open_new(url)

View File

@ -19,17 +19,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
import logging import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog from openlp.core.lib import translate
from openlp.core import translate class AlertForm(QtGui.QDialog):
from openlp.core.resources import *
class AlertForm(QDialog):
global log global log
log=logging.getLogger(u'AlertForm') log=logging.getLogger(u'AlertForm')
def __init__(self, parent=None): def __init__(self, parent=None):
QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
log.info(u'Defined') 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 import QtCore, QtGui
from PyQt4.QtGui import QColor, QFont
from openlp.core import translate from openlp.core.lib import SettingsTab, translate
from openlp.core.lib import SettingsTab
from openlp.core.resources import *
class AlertsTab(SettingsTab): class AlertsTab(SettingsTab):
""" """
@ -175,7 +172,7 @@ class AlertsTab(SettingsTab):
self.timeout = int(self.config.get_config('timeout', 5)) self.timeout = int(self.config.get_config('timeout', 5))
self.font_color = str(self.config.get_config('font color', u'#ffffff')) 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.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.TimeoutSpinBox.setValue(self.timeout)
self.FontColorButton.setStyleSheet('background-color: %s' % self.font_color) self.FontColorButton.setStyleSheet('background-color: %s' % self.font_color)
self.BackgroundColorButton.setStyleSheet('background-color: %s' % self.bg_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)) self.config.set_config('timeout', str(self.timeout))
def updateDisplay(self): def updateDisplay(self):
font = QFont() font = QtGui.QFont()
font.setFamily(self.FontComboBox.currentFont().family()) font.setFamily(self.FontComboBox.currentFont().family())
font.setBold(True) font.setBold(True)
font.setPointSize(16) font.setPointSize(16)

View File

@ -456,7 +456,7 @@ class Ui_AmendThemeDialog(object):
self.ThemePreviewLayout.setSpacing(8) self.ThemePreviewLayout.setSpacing(8)
self.ThemePreviewLayout.setMargin(8) self.ThemePreviewLayout.setMargin(8)
self.ThemePreviewLayout.setObjectName("ThemePreviewLayout") self.ThemePreviewLayout.setObjectName("ThemePreviewLayout")
spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
self.ThemePreviewLayout.addItem(spacerItem7) self.ThemePreviewLayout.addItem(spacerItem7)
self.ThemePreview = QtGui.QLabel(self.PreviewGroupBox) self.ThemePreview = QtGui.QLabel(self.PreviewGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
@ -464,14 +464,14 @@ class Ui_AmendThemeDialog(object):
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.ThemePreview.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.ThemePreview.sizePolicy().hasHeightForWidth())
self.ThemePreview.setSizePolicy(sizePolicy) self.ThemePreview.setSizePolicy(sizePolicy)
self.ThemePreview.setMinimumSize(QtCore.QSize(300, 225)) self.ThemePreview.setMaximumSize(QtCore.QSize(300, 225))
self.ThemePreview.setFrameShape(QtGui.QFrame.WinPanel) self.ThemePreview.setFrameShape(QtGui.QFrame.WinPanel)
self.ThemePreview.setFrameShadow(QtGui.QFrame.Sunken) self.ThemePreview.setFrameShadow(QtGui.QFrame.Sunken)
self.ThemePreview.setLineWidth(1) self.ThemePreview.setLineWidth(1)
self.ThemePreview.setScaledContents(True) self.ThemePreview.setScaledContents(True)
self.ThemePreview.setObjectName("ThemePreview") self.ThemePreview.setObjectName("ThemePreview")
self.ThemePreviewLayout.addWidget(self.ThemePreview) self.ThemePreviewLayout.addWidget(self.ThemePreview)
spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
self.ThemePreviewLayout.addItem(spacerItem8) self.ThemePreviewLayout.addItem(spacerItem8)
self.AmendThemeLayout.addWidget(self.PreviewGroupBox) self.AmendThemeLayout.addWidget(self.PreviewGroupBox)
self.ThemeButtonBox = QtGui.QDialogButtonBox(AmendThemeDialog) self.ThemeButtonBox = QtGui.QDialogButtonBox(AmendThemeDialog)
@ -517,7 +517,7 @@ class Ui_AmendThemeDialog(object):
AmendThemeDialog.setTabOrder(self.HorizontalComboBox, self.VerticalComboBox) AmendThemeDialog.setTabOrder(self.HorizontalComboBox, self.VerticalComboBox)
def retranslateUi(self, AmendThemeDialog): def retranslateUi(self, AmendThemeDialog):
AmendThemeDialog.setWindowTitle(QtGui.QApplication.translate("AmendThemeDialog", "Theme Maintance", None, QtGui.QApplication.UnicodeUTF8)) AmendThemeDialog.setWindowTitle(QtGui.QApplication.translate("AmendThemeDialog", "Theme Maintenance", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeNameLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Theme Name:", None, QtGui.QApplication.UnicodeUTF8)) self.ThemeNameLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Theme Name:", None, QtGui.QApplication.UnicodeUTF8))
self.BackgroundLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Background:", None, QtGui.QApplication.UnicodeUTF8)) self.BackgroundLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Background:", None, QtGui.QApplication.UnicodeUTF8))
self.BackgroundComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Opaque", None, QtGui.QApplication.UnicodeUTF8)) self.BackgroundComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Opaque", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -21,9 +21,7 @@ import logging
import os, os.path import os, os.path
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QColor, QFont from openlp.core.lib import ThemeXML, Renderer, file_to_xml, translate
from openlp.core.lib import ThemeXML, Renderer
from openlp.core import fileToXML, translate
from amendthemedialog import Ui_AmendThemeDialog from amendthemedialog import Ui_AmendThemeDialog
@ -34,7 +32,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def __init__(self, thememanager, parent=None): def __init__(self, thememanager, parent=None):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.thememanager = thememanager self.thememanager = thememanager
self.theme = ThemeXML() # Needed here as UI setup generates Events # Needed here as UI setup generates Events
self.path = None
self.theme = ThemeXML()
self.setupUi(self) self.setupUi(self)
#define signals #define signals
@ -113,15 +113,15 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
else: else:
(path, filename) =os.path.split(str(self.theme.background_filename)) (path, filename) =os.path.split(str(self.theme.background_filename))
new_theme.add_background_image(filename) new_theme.add_background_image(filename)
save_to= os.path.join(self.path, theme_name,filename ) save_to= os.path.join(self.path, theme_name, filename )
save_from = self.theme.background_filename save_from = self.theme.background_filename
new_theme.add_font(str(self.theme.font_main_name), str(self.theme.font_main_color), new_theme.add_font(str(self.theme.font_main_name), str(self.theme.font_main_color),
str(self.theme.font_main_proportion), str(self.theme.font_main_override),u'main', str(self.theme.font_main_proportion), str(self.theme.font_main_override), u'main',
str(self.theme.font_main_x), str(self.theme.font_main_y), str(self.theme.font_main_width), str(self.theme.font_main_x), str(self.theme.font_main_y), str(self.theme.font_main_width),
str(self.theme.font_main_height)) str(self.theme.font_main_height))
new_theme.add_font(str(self.theme.font_footer_name), str(self.theme.font_footer_color), new_theme.add_font(str(self.theme.font_footer_name), str(self.theme.font_footer_color),
str(self.theme.font_footer_proportion), str(self.theme.font_footer_override),u'footer', str(self.theme.font_footer_proportion), str(self.theme.font_footer_override), u'footer',
str(self.theme.font_footer_x), str(self.theme.font_footer_y), str(self.theme.font_footer_width), str(self.theme.font_footer_x), str(self.theme.font_footer_y), str(self.theme.font_footer_width),
str(self.theme.font_footer_height) ) str(self.theme.font_footer_height) )
new_theme.add_display(str(self.theme.display_shadow), str(self.theme.display_shadow_color), new_theme.add_display(str(self.theme.display_shadow), str(self.theme.display_shadow_color),
@ -134,17 +134,15 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.thememanager.saveTheme(theme_name, theme, save_from, save_to) self.thememanager.saveTheme(theme_name, theme, save_from, save_to)
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)
def themePath(self, path):
self.path = path
def loadTheme(self, theme): def loadTheme(self, theme):
log.debug(u'LoadTheme %s ', theme) log.debug(u'LoadTheme %s', theme)
if theme == None: if theme == None:
self.theme.parse(self.baseTheme()) self.theme.parse(self.baseTheme())
else: 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) xml = file_to_xml(xml_file)
self.theme.parse(xml) self.theme.parse(xml)
self.theme.extend_image_filename(self.path)
self.allowPreview = False self.allowPreview = False
self.paintUi(self.theme) self.paintUi(self.theme)
self.allowPreview = True self.allowPreview = True
@ -165,10 +163,10 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onFontMainColorPushButtonClicked(self): def onFontMainColorPushButtonClicked(self):
self.theme.font_main_color = QtGui.QColorDialog.getColor( 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( 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) self.previewTheme(self.theme)
def onFontMainSizeSpinBoxChanged(self, value): def onFontMainSizeSpinBoxChanged(self, value):
@ -218,7 +216,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onFontFooterColorPushButtonClicked(self): def onFontFooterColorPushButtonClicked(self):
self.theme.font_footer_color = QtGui.QColorDialog.getColor( 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( self.FontFooterColorPushButton.setStyleSheet(
'background-color: %s' % str(self.theme.font_footer_color)) 'background-color: %s' % str(self.theme.font_footer_color))
@ -307,22 +305,22 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onColor1PushButtonClicked(self): def onColor1PushButtonClicked(self):
if self.theme.background_type == u'solid': if self.theme.background_type == u'solid':
self.theme.background_color = QtGui.QColorDialog.getColor( 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( self.Color1PushButton.setStyleSheet(
'background-color: %s' % str(self.theme.background_color)) u'background-color: %s' % str(self.theme.background_color))
else: else:
self.theme.background_startColor = QtGui.QColorDialog.getColor( 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( self.Color1PushButton.setStyleSheet(
'background-color: %s' % str(self.theme.background_startColor)) u'background-color: %s' % str(self.theme.background_startColor))
self.previewTheme(self.theme) self.previewTheme(self.theme)
def onColor2PushButtonClicked(self): def onColor2PushButtonClicked(self):
self.theme.background_endColor = QtGui.QColorDialog.getColor( 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( self.Color2PushButton.setStyleSheet(
'background-color: %s' % str(self.theme.background_endColor)) u'background-color: %s' % str(self.theme.background_endColor))
self.previewTheme(self.theme) self.previewTheme(self.theme)
# #
@ -338,9 +336,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onOutlineColorPushButtonClicked(self): def onOutlineColorPushButtonClicked(self):
self.theme.display_outline_color = QtGui.QColorDialog.getColor( 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( 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) self.previewTheme(self.theme)
def onShadowCheckBoxChanged(self, value): def onShadowCheckBoxChanged(self, value):
@ -353,9 +351,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def onShadowColorPushButtonClicked(self): def onShadowColorPushButtonClicked(self):
self.theme.display_shadow_color = QtGui.QColorDialog.getColor( 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( 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) self.previewTheme(self.theme)
def onHorizontalComboBoxSelected(self, currentIndex): def onHorizontalComboBoxSelected(self, currentIndex):
@ -375,8 +373,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
newtheme = ThemeXML() newtheme = ThemeXML()
newtheme.new_document(u'New Theme') newtheme.new_document(u'New Theme')
newtheme.add_background_solid(str(u'#000000')) newtheme.add_background_solid(str(u'#000000'))
newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(30), u'False') newtheme.add_font(str(QtGui.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(12), u'False', u'footer')
newtheme.add_display(u'False', str(u'#FFFFFF'), u'False', str(u'#FFFFFF'), newtheme.add_display(u'False', str(u'#FFFFFF'), u'False', str(u'#FFFFFF'),
str(0), str(0), str(0)) 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.FontFooterWidthSpinBox.setValue(int(self.theme.font_footer_width))
self.FontFooterHeightSpinBox.setValue(int(self.theme.font_footer_height)) self.FontFooterHeightSpinBox.setValue(int(self.theme.font_footer_height))
self.FontMainColorPushButton.setStyleSheet( self.FontMainColorPushButton.setStyleSheet(
'background-color: %s' % str(theme.font_main_color)) u'background-color: %s' % str(theme.font_main_color))
self.FontFooterColorPushButton.setStyleSheet( 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: if self.theme.font_main_override == False:
self.FontMainDefaultCheckBox.setChecked(True) self.FontMainDefaultCheckBox.setChecked(True)
@ -430,9 +428,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.FontFooterDefaultCheckBox.setChecked(False) self.FontFooterDefaultCheckBox.setChecked(False)
self.OutlineColorPushButton.setStyleSheet( self.OutlineColorPushButton.setStyleSheet(
'background-color: %s' % str(theme.display_outline_color)) u'background-color: %s' % str(theme.display_outline_color))
self.ShadowColorPushButton.setStyleSheet( 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: if self.theme.display_outline:
self.OutlineCheckBox.setChecked(True) self.OutlineCheckBox.setChecked(True)
@ -454,7 +452,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def stateChanging(self, theme): def stateChanging(self, theme):
if theme.background_type == u'solid': if theme.background_type == u'solid':
self.Color1PushButton.setStyleSheet( 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.setText(translate(u'ThemeManager', u'Background Color:'))
self.Color1Label.setVisible(True) self.Color1Label.setVisible(True)
self.Color1PushButton.setVisible(True) self.Color1PushButton.setVisible(True)
@ -467,9 +465,9 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.GradientComboBox.setVisible(False) self.GradientComboBox.setVisible(False)
elif theme.background_type == u'gradient': elif theme.background_type == u'gradient':
self.Color1PushButton.setStyleSheet( self.Color1PushButton.setStyleSheet(
'background-color: %s' % str(theme.background_startColor)) u'background-color: %s' % str(theme.background_startColor))
self.Color2PushButton.setStyleSheet( 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.Color1Label.setText(translate(u'ThemeManager', u'First Color:'))
self.Color2Label.setText(translate(u'ThemeManager', u'Second Color:')) self.Color2Label.setText(translate(u'ThemeManager', u'Second Color:'))
self.Color1Label.setVisible(True) self.Color1Label.setVisible(True)

View File

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

View File

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

View File

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

View File

@ -21,13 +21,7 @@ import os
import logging import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, RenderManager, Event, EventType, EventManager, translate, buildIcon, contextMenuAction, contextMenuSeparator
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 import buildIcon
from openlp.core.lib import Event, EventType, EventManager
class ServiceManager(QtGui.QWidget): class ServiceManager(QtGui.QWidget):
@ -38,12 +32,12 @@ class ServiceManager(QtGui.QWidget):
Also handles the UI tasks of moving things up and down etc. Also handles the UI tasks of moving things up and down etc.
""" """
global log global log
log=logging.getLogger(u'ServiceManager') log = logging.getLogger(u'ServiceManager')
def __init__(self, parent): def __init__(self, parent):
QtGui.QWidget.__init__(self) QtGui.QWidget.__init__(self)
self.parent=parent self.parent = parent
self.serviceItems=[] self.serviceItems = []
self.Layout = QtGui.QVBoxLayout(self) self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0) self.Layout.setSpacing(0)
self.Layout.setMargin(0) self.Layout.setMargin(0)
@ -57,15 +51,15 @@ class ServiceManager(QtGui.QWidget):
self.Toolbar.addToolbarButton(u'Move to bottom', u':/services/service_bottom.png', self.Toolbar.addToolbarButton(u'Move to bottom', u':/services/service_bottom.png',
translate(u'ServiceManager', u'Move to end'), self.onServiceEnd) translate(u'ServiceManager', u'Move to end'), self.onServiceEnd)
self.Toolbar.addSeparator() self.Toolbar.addSeparator()
self.Toolbar.addToolbarButton(u'New Service', u':/services/service_new.png',
translate(u'ServiceManager', u'Create a new Service'), self.onNewService)
self.Toolbar.addToolbarButton(u'Delete From Service', u':/services/service_delete.png', self.Toolbar.addToolbarButton(u'Delete From Service', u':/services/service_delete.png',
translate(u'ServiceManager', u'Delete From Service'), self.onDeleteFromService) translate(u'ServiceManager', u'Delete From Service'), self.onDeleteFromService)
self.Toolbar.addToolbarButton(u'New Service', u':/services/service_new.png',
translate(u'ServiceManager', u'Create a new Service'), self.onNewService)
self.Toolbar.addToolbarButton(u'Open Service', u':/services/service_open.png',
translate(u'ServiceManager', u'Load Existing'), self.onLoadService)
self.Toolbar.addSeparator() self.Toolbar.addSeparator()
self.Toolbar.addToolbarButton(u'Save Service', u':/services/service_save.png', self.Toolbar.addToolbarButton(u'Save Service', u':/services/service_save.png',
translate(u'ServiceManager', u'Save Service'), self.onSaveService) translate(u'ServiceManager', u'Save Service'), self.onSaveService)
self.Toolbar.addToolbarButton(u'Load Service', u':/services/service_open.png',
translate(u'ServiceManager', u'Load Existing'), self.onLoadService)
self.Toolbar.addSeparator() self.Toolbar.addSeparator()
self.ThemeComboBox = QtGui.QComboBox(self.Toolbar) self.ThemeComboBox = QtGui.QComboBox(self.Toolbar)
@ -87,14 +81,14 @@ class ServiceManager(QtGui.QWidget):
self.ServiceManagerList.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.ServiceManagerList.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.ServiceManagerList.addAction(self.contextMenuAction( self.ServiceManagerList.addAction(contextMenuAction(
self.ServiceManagerList, ':/system/system_preview.png', self.ServiceManagerList, ':/system/system_preview.png',
translate(u'ServiceManager',u'&Preview Verse'), self.makePreview)) translate(u'ServiceManager',u'&Preview Verse'), self.makePreview))
self.ServiceManagerList.addAction(self.contextMenuAction( self.ServiceManagerList.addAction(contextMenuAction(
self.ServiceManagerList, ':/system/system_live.png', self.ServiceManagerList, ':/system/system_live.png',
translate(u'ServiceManager',u'&Show Live'), self.makeLive)) translate(u'ServiceManager',u'&Show Live'), self.makeLive))
self.ServiceManagerList.addAction(self.contextMenuSeparator(self.ServiceManagerList)) self.ServiceManagerList.addAction(contextMenuSeparator(self.ServiceManagerList))
self.ServiceManagerList.addAction(self.contextMenuAction( self.ServiceManagerList.addAction(contextMenuAction(
self.ServiceManagerList, ':/services/service_delete', self.ServiceManagerList, ':/services/service_delete',
translate(u'ServiceManager',u'&Remove from Service'), self.onDeleteFromService)) translate(u'ServiceManager',u'&Remove from Service'), self.onDeleteFromService))
@ -106,20 +100,6 @@ class ServiceManager(QtGui.QWidget):
self.config = PluginConfig(u'Main') self.config = PluginConfig(u'Main')
self.service_theme = self.config.get_config(u'theme service theme', u'') self.service_theme = self.config.get_config(u'theme service theme', u'')
def contextMenuAction(self, base, icon, text, slot):
"""
Utility method to help build context menus for plugins
"""
action = QtGui.QAction(text, base)
action .setIcon(buildIcon(icon))
QtCore.QObject.connect(action, QtCore.SIGNAL("triggered()"), slot)
return action
def contextMenuSeparator(self, base):
action = QtGui.QAction("", base)
action.setSeparator(True)
return action
def onServiceTop(self): def onServiceTop(self):
pass pass
@ -160,7 +140,7 @@ class ServiceManager(QtGui.QWidget):
count = 0 count = 0
for frame in item.frames: for frame in item.frames:
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem) treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
text = frame[u'formatted'][0] text = frame[u'title'][0]
treewidgetitem1.setText(0,text[:30]) treewidgetitem1.setText(0,text[:30])
treewidgetitem1.setData(0, QtCore.Qt.UserRole,QtCore.QVariant(count)) treewidgetitem1.setData(0, QtCore.Qt.UserRole,QtCore.QVariant(count))
count = count + 1 count = count + 1
@ -199,7 +179,7 @@ class ServiceManager(QtGui.QWidget):
Handle the release of the event and trigger the plugin Handle the release of the event and trigger the plugin
to add the data to add the data
""" """
link=event.mimeData() link = event.mimeData()
if link.hasText(): if link.hasText():
plugin = event.mimeData().text() plugin = event.mimeData().text()
self.EventManager.post_event(Event(EventType.LoadServiceItem, plugin)) self.EventManager.post_event(Event(EventType.LoadServiceItem, plugin))
@ -233,7 +213,9 @@ class ServiceManager(QtGui.QWidget):
for theme in theme_list: for theme in theme_list:
self.ThemeComboBox.addItem(theme) self.ThemeComboBox.addItem(theme)
id = self.ThemeComboBox.findText(str(self.service_theme), QtCore.Qt.MatchExactly) id = self.ThemeComboBox.findText(str(self.service_theme), QtCore.Qt.MatchExactly)
# Not Found
if id == -1: if id == -1:
id = 0 # Not Found id = 0
self.service_theme = u'' self.service_theme = u''
self.ThemeComboBox.setCurrentIndex(id) self.ThemeComboBox.setCurrentIndex(id)
self.RenderManager.set_service_theme(self.service_theme)

View File

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

View File

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

View File

@ -23,23 +23,17 @@ import zipfile
import shutil import shutil
from time import sleep from time import sleep
from copy import deepcopy
from xml.etree.ElementTree import ElementTree, XML from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import *
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from openlp.core.ui import AmendThemeForm, ServiceManager from openlp.core.ui import AmendThemeForm, ServiceManager
from openlp.core import translate, fileToXML
from openlp.core.theme import Theme 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, file_to_xml
from openlp.core.utils import ConfigHelper from openlp.core.utils import ConfigHelper
from openlp.core.resources import *
import logging import logging
class ThemeData(QAbstractListModel): class ThemeData(QtCore.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
@ -49,7 +43,7 @@ class ThemeData(QAbstractListModel):
log=logging.getLogger(u'ThemeData') log=logging.getLogger(u'ThemeData')
def __init__(self): def __init__(self):
QAbstractListModel.__init__(self) QtCore.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;
@ -62,36 +56,36 @@ class ThemeData(QAbstractListModel):
return len(self.items) return len(self.items)
def insertRow(self, row, filename): 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)) log.info(u'insert row %d:%s' % (row, filename))
(prefix, shortfilename) = os.path.split(str(filename)) (prefix, shortfilename) = os.path.split(str(filename))
log.info(u'shortfilename = %s' % shortfilename) log.info(u'shortfilename = %s' % shortfilename)
theme = shortfilename.split(u'.') theme = shortfilename.split(u'.')
# create a preview image # create a preview image
if os.path.exists(filename): if os.path.exists(filename):
preview = QPixmap(str(filename)) preview = QtGui.QPixmap(str(filename))
width = self.maximagewidth width = self.maximagewidth
height = self.rowheight 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() realwidth = preview.width()
realheight = preview.height() realheight = preview.height()
# and move it to the centre of the preview space # and move it to the centre of the preview space
pixmap = QPixmap(width, height) pixmap = QtGui.QPixmap(width, height)
pixmap.fill(Qt.transparent) pixmap.fill(QtCore.Qt.transparent)
painter = QPainter(pixmap) painter = QtGui.QPainter(pixmap)
painter.drawPixmap((width - realwidth) / 2, (height - realheight) / 2, preview) painter.drawPixmap((width - realwidth) / 2, (height - realheight) / 2, preview)
else: else:
width = self.maximagewidth width = self.maximagewidth
height = self.rowheight height = self.rowheight
pixmap = QPixmap(width, height) pixmap = QtGui.QtGui.QPixmap(width, height)
pixmap.fill(Qt.transparent) pixmap.fill(QtCore.Qt.transparent)
# finally create the row # finally create the row
self.items.insert(row, (filename, pixmap, shortfilename, theme[0])) self.items.insert(row, (filename, pixmap, shortfilename, theme[0]))
log.info(u'Items: %s' % self.items) log.info(u'Items: %s' % self.items)
self.endInsertRows() self.endInsertRows()
def removeRow(self, row): def removeRow(self, row):
self.beginRemoveRows(QModelIndex(), row, row) self.beginRemoveRows(QtCore.QModelIndex(), row, row)
self.items.pop(row) self.items.pop(row)
self.endRemoveRows() self.endRemoveRows()
@ -102,16 +96,15 @@ class ThemeData(QAbstractListModel):
row = index.row() row = index.row()
if row > len(self.items): if row > len(self.items):
# if the last row is selected and deleted, we then get called with an empty row! # if the last row is selected and deleted, we then get called with an empty row!
return QVariant() return QtCore.QVariant()
if role == Qt.DisplayRole: if role == QtCore.Qt.DisplayRole:
retval = self.items[row][3] retval = self.items[row][3]
elif role == Qt.DecorationRole: elif role == QtCore.Qt.DecorationRole:
retval = self.items[row][1] retval = self.items[row][1]
else: else:
retval = QVariant() retval = QtCore.QVariant()
#log.info("Returning"+ str(retval)) if type(retval) is not type(QtCore.QVariant):
if type(retval) is not type(QVariant): return QtCore.QVariant(retval)
return QVariant(retval)
else: else:
return retval return retval
@ -131,15 +124,15 @@ class ThemeData(QAbstractListModel):
filelist = [item[3] for item in self.items] filelist = [item[3] for item in self.items]
return filelist return filelist
class ThemeManager(QWidget): class ThemeManager(QtGui.QWidget):
""" """
Manages the orders of Theme. Manages the orders of Theme.
""" """
global log global log
log=logging.getLogger(u'ThemeManager') log = logging.getLogger(u'ThemeManager')
def __init__(self, parent): def __init__(self, parent):
QWidget.__init__(self) QtGui.QWidget.__init__(self)
self.parent = parent self.parent = parent
self.Layout = QtGui.QVBoxLayout(self) self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0) self.Layout.setSpacing(0)
@ -174,7 +167,7 @@ class ThemeManager(QWidget):
self.themelist = [] self.themelist = []
self.path = os.path.join(ConfigHelper.get_data_path(), u'themes') self.path = os.path.join(ConfigHelper.get_data_path(), u'themes')
self.checkThemesExists(self.path) self.checkThemesExists(self.path)
self.amendThemeForm.themePath(self.path) self.amendThemeForm.path = self.path
def onAddTheme(self): def onAddTheme(self):
self.amendThemeForm.loadTheme(None) self.amendThemeForm.loadTheme(None)
@ -224,8 +217,7 @@ class ThemeManager(QWidget):
self.themeData.addRow(os.path.join(self.path, name)) self.themeData.addRow(os.path.join(self.path, name))
self.EventManager.post_event(Event(EventType.ThemeListChanged)) self.EventManager.post_event(Event(EventType.ThemeListChanged))
self.ServiceManager.updateThemeList(self.getThemes()) self.ServiceManager.updateThemeList(self.getThemes())
self.parent.settings_form.ThemesTab.updateThemeList(self.getThemes()) self.parent.settingsForm.ThemesTab.updateThemeList(self.getThemes())
def getThemes(self): def getThemes(self):
return self.themeData.getList() return self.themeData.getList()
@ -234,19 +226,19 @@ class ThemeManager(QWidget):
log.debug(u'getthemedata for theme %s', themename) log.debug(u'getthemedata for theme %s', themename)
xml_file = os.path.join(self.path, str(themename), str(themename) + u'.xml') xml_file = os.path.join(self.path, str(themename), str(themename) + u'.xml')
try: try:
xml = fileToXML(xml_file) xml = file_to_xml(xml_file)
except: except:
newtheme = ThemeXML() newtheme = ThemeXML()
newtheme.new_document(u'New Theme') newtheme.new_document(u'New Theme')
newtheme.add_background_solid(str(u'#000000')) newtheme.add_background_solid(str(u'#000000'))
newtheme.add_font(str(QFont().family()), str(u'#FFFFFF'), str(30), u'False') newtheme.add_font(str(QtGui.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(12), u'False', u'footer')
newtheme.add_display(u'False', str(u'#FFFFFF'), u'False', str(u'#FFFFFF'), newtheme.add_display(u'False', str(u'#FFFFFF'), u'False', str(u'#FFFFFF'),
str(0), str(0), str(0)) str(0), str(0), str(0))
xml = newtheme.extract_xml() xml = newtheme.extract_xml()
theme = ThemeXML() theme = ThemeXML()
theme.parse(xml) theme.parse(xml)
theme.extend_filename(self.path) theme.extend_image_filename(self.path)
return theme return theme
def checkThemesExists(self, dir): def checkThemesExists(self, dir):
@ -353,7 +345,7 @@ class ThemeManager(QWidget):
log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml) log.debug(u'generateAndSaveImage %s %s %s', dir, name, theme_xml)
theme = ThemeXML() theme = ThemeXML()
theme.parse(theme_xml) theme.parse(theme_xml)
theme.extend_filename(dir) theme.extend_image_filename(dir)
frame = self.generateImage(theme) frame = self.generateImage(theme)
im = frame.toImage() im = frame.toImage()
samplepathname = os.path.join(self.path, name + u'.png') samplepathname = os.path.join(self.path, name + u'.png')

View File

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

View File

@ -21,10 +21,8 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import * from PyQt4.QtCore import *
from PyQt4.QtGui import *
from openlp.core.lib import Plugin, Event from openlp.core.lib import Plugin, Event, EventType, translate
from openlp.core.lib import EventType
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
from openlp.plugins.bibles.lib.tables import * from openlp.plugins.bibles.lib.tables import *
@ -59,7 +57,7 @@ class BiblePlugin(Plugin):
self.ImportBibleItem = QtGui.QAction(import_menu) self.ImportBibleItem = QtGui.QAction(import_menu)
self.ImportBibleItem.setObjectName("ImportBibleItem") self.ImportBibleItem.setObjectName("ImportBibleItem")
import_menu.addAction(self.ImportBibleItem) import_menu.addAction(self.ImportBibleItem)
self.ImportBibleItem.setText(QtGui.QApplication.translate("main_window", "&Bible", None, QtGui.QApplication.UnicodeUTF8)) self.ImportBibleItem.setText(translate("BiblePlugin", "&Bible"))
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.ImportBibleItem, QtCore.SIGNAL("triggered()"), self.onBibleNewClick) QtCore.QObject.connect(self.ImportBibleItem, QtCore.SIGNAL("triggered()"), self.onBibleNewClick)
@ -67,8 +65,7 @@ class BiblePlugin(Plugin):
self.ExportBibleItem = QtGui.QAction(export_menu) self.ExportBibleItem = QtGui.QAction(export_menu)
self.ExportBibleItem.setObjectName("ExportBibleItem") self.ExportBibleItem.setObjectName("ExportBibleItem")
export_menu.addAction(self.ExportBibleItem) export_menu.addAction(self.ExportBibleItem)
self.ExportBibleItem.setText( self.ExportBibleItem.setText(translate("BiblePlugin", u'&Bible'))
QtGui.QApplication.translate("main_window", u'&Bible', None, QtGui.QApplication.UnicodeUTF8))
def initialise(self): def initialise(self):
pass pass

View File

@ -20,8 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import Qt, QtCore, QtGui from PyQt4 import Qt, QtCore, QtGui
from openlp.core import translate from openlp.core.lib import translate, str_to_bool
from openlp import convertStringToBoolean
from openlp.core.lib import SettingsTab from openlp.core.lib import SettingsTab
class BiblesTab(SettingsTab): class BiblesTab(SettingsTab):
@ -187,11 +186,11 @@ class BiblesTab(SettingsTab):
self.bible_search = True self.bible_search = True
def load(self): def load(self):
self.paragraph_style = convertStringToBoolean(self.config.get_config(u'paragraph style', u'True')) self.paragraph_style = str_to_bool(self.config.get_config(u'paragraph style', u'True'))
self.show_new_chapters = convertStringToBoolean(self.config.get_config(u'display new chapter', u"False")) self.show_new_chapters = str_to_bool(self.config.get_config(u'display new chapter', u"False"))
self.display_style = int(self.config.get_config(u'display brackets', u'0')) self.display_style = int(self.config.get_config(u'display brackets', u'0'))
self.bible_theme = self.config.get_config(u'bible theme', u'0') self.bible_theme = self.config.get_config(u'bible theme', u'0')
self.bible_search = convertStringToBoolean(self.config.get_config(u'search as type', u'True')) self.bible_search = str_to_bool(self.config.get_config(u'search as type', u'True'))
if self.paragraph_style: if self.paragraph_style:
self.ParagraphRadioButton.setChecked(True) self.ParagraphRadioButton.setChecked(True)
else: else:

View File

@ -21,10 +21,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core import translate from openlp.core.lib import ServiceItem, MediaManagerItem, Receiver, translate
from openlp.core.lib import MediaManagerItem, Receiver
from openlp.core.lib import ServiceItem
from openlp.plugins.bibles.forms import BibleImportForm from openlp.plugins.bibles.forms import BibleImportForm
from openlp.plugins.bibles.lib import TextListData from openlp.plugins.bibles.lib import TextListData
@ -57,7 +54,7 @@ class BibleMediaItem(MediaManagerItem):
This is the custom media manager item for Bibles. This is the custom media manager item for Bibles.
""" """
global log global log
log=logging.getLogger(u'BibleMediaItem') log = logging.getLogger(u'BibleMediaItem')
log.info(u'Bible Media Item loaded') log.info(u'Bible Media Item loaded')
def __init__(self, parent, icon, title): def __init__(self, parent, icon, title):
@ -207,7 +204,7 @@ class BibleMediaItem(MediaManagerItem):
self.BibleListView.setAlternatingRowColors(True) self.BibleListView.setAlternatingRowColors(True)
self.BibleListData = TextListData() self.BibleListData = TextListData()
self.BibleListView.setModel(self.BibleListData) self.BibleListView.setModel(self.BibleListData)
self.BibleListView.setSelectionMode(QtGui.QAbstractItemView.MultiSelection) self.BibleListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.BibleListView.setDragEnabled(True) self.BibleListView.setDragEnabled(True)
self.PageLayout.addWidget(self.BibleListView) self.PageLayout.addWidget(self.BibleListView)
@ -383,7 +380,7 @@ class BibleMediaItem(MediaManagerItem):
verse = str(self.search_results[0][2]) verse = str(self.search_results[0][2])
text = self.search_results[0][3] text = self.search_results[0][3]
if self.parent.bibles_tab.paragraph_style: #Paragraph 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: if self.parent.bibles_tab.display_style == 1:
loc = self.formatVerse(old_chapter, chapter, verse, u'(', u')') loc = self.formatVerse(old_chapter, chapter, verse, u'(', u')')
elif self.parent.bibles_tab.display_style == 2: elif self.parent.bibles_tab.display_style == 2:

View File

@ -21,10 +21,8 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
from openlp.core.lib import Plugin, Event
from openlp.core.lib import EventType
from forms import EditCustomForm from forms import EditCustomForm
from openlp.core.lib import Plugin, Event, EventType
from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem, CustomServiceItem from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem, CustomServiceItem

View File

@ -8,7 +8,7 @@
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core import translate from openlp.core.lib import translate
class Ui_customEditDialog(object): class Ui_customEditDialog(object):
def setupUi(self, customEditDialog): def setupUi(self, customEditDialog):

View File

@ -19,6 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
import logging import logging
from openlp.core.lib import ServiceItem from openlp.core.lib import ServiceItem
from openlp.plugins.custom.lib import TextListData from openlp.plugins.custom.lib import TextListData
@ -40,12 +41,12 @@ class CustomServiceItem(ServiceItem):
it simply tells the slide controller to use it??? it simply tells the slide controller to use it???
It contains 1 or more images It contains 1 or more images
""" """
global log global log
log=logging.getLogger(u'CustomServiceItem') log=logging.getLogger(u'CustomServiceItem')
log.info(u'CustomServiceItem loaded') log.info(u'CustomServiceItem loaded')
def __init__(self, controller): def __init__(self, controller):
""" """
Init Method Init Method
@ -58,7 +59,7 @@ class CustomServiceItem(ServiceItem):
# c.uniformItemSizes=True # c.uniformItemSizes=True
# c.setModel(self.imgs) # c.setModel(self.imgs)
# c.setGeometry(0,0,200,200) # c.setGeometry(0,0,200,200)
def render(self): def render(self):
""" """
The render method is what the plugin uses to render its meda to the The render method is what the plugin uses to render its meda to the
@ -66,7 +67,7 @@ class CustomServiceItem(ServiceItem):
""" """
# render the "image chooser first" # render the "image chooser first"
# for f in self.imgs: # for f in self.imgs:
# fl , nm = os.path.split(str(f)) # fl , nm = os.path.split(str(f))
# c = self.slide_controller.rowCount() # c = self.slide_controller.rowCount()
# self.slide_controller.setRowCount(c+1) # self.slide_controller.setRowCount(c+1)
# twi = QtGui.QTableWidgetItem(str(f)) # twi = QtGui.QTableWidgetItem(str(f))
@ -74,7 +75,7 @@ class CustomServiceItem(ServiceItem):
# twi = QtGui.QTableWidgetItem(str(nm)) # twi = QtGui.QTableWidgetItem(str(nm))
# self.slide_controller.setItem(c , 1, twi) # self.slide_controller.setItem(c , 1, twi)
# self.slide_controller.setRowHeight(c, 80) # self.slide_controller.setRowHeight(c, 80)
# render the preview screen here # render the preview screen here
def get_parent_node(self): def get_parent_node(self):
@ -83,7 +84,7 @@ class CustomServiceItem(ServiceItem):
Manager. Manager.
""" """
pass pass
def add(self, data): def add(self, data):
""" """
append an image to the list append an image to the list
@ -95,7 +96,7 @@ class CustomServiceItem(ServiceItem):
log.info("add Item..."+str(data)) log.info("add Item..."+str(data))
for filename in data.imgs.get_file_list(): for filename in data.imgs.get_file_list():
self.add(filename) self.add(filename)
def get_oos_text(self): def get_oos_text(self):
""" """
@ -114,4 +115,4 @@ class CustomServiceItem(ServiceItem):
files=text.split('\n') files=text.split('\n')
for f in files: for f in files:
self.imgs.addRow(f) self.imgs.addRow(f)

View File

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

View File

@ -21,11 +21,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core import translate from openlp.core.lib import MediaManagerItem, SongXMLParser, ServiceItem, translate
from openlp.core.lib import MediaManagerItem
from openlp.core.lib import SongXMLParser
from openlp.core.lib import ServiceItem
from openlp.plugins.custom.lib import TextListData from openlp.plugins.custom.lib import TextListData
class CustomList(QtGui.QListView): class CustomList(QtGui.QListView):

View File

@ -1,55 +1,50 @@
import logging import logging
from PyQt4.QtCore import * from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import *
class TextListData(QtCore.QAbstractListModel):
class TextListData(QAbstractListModel):
""" """
An abstract list of strings An abstract list of strings
""" """
global log global log
log=logging.getLogger(u'TextListData') log=logging.getLogger(u'TextListData')
log.info(u'started') log.info(u'started')
def __init__(self): def __init__(self):
QAbstractListModel.__init__(self) QtCore.QAbstractListModel.__init__(self)
self.items=[] # will be a list of (database id , title) tuples self.items=[] # will be a list of (database id , title) tuples
def resetStore(self): def resetStore(self):
#reset list so can be reloaded #reset list so can be reloaded
self.items=[] self.items=[]
def rowCount(self, parent): def rowCount(self, parent):
return len(self.items) return len(self.items)
def insertRow(self, row, id, title): def insertRow(self, row, id, title):
self.beginInsertRows(QModelIndex(),row,row) self.beginInsertRows(QtCore.QModelIndex(),row,row)
log.debug("insert row %d:%s for id %d"%(row,title, id)) log.debug("insert row %d:%s for id %d" % (row,title, id))
self.items.insert(row, (id, title)) self.items.insert(row, (id, title))
self.endInsertRows() self.endInsertRows()
def removeRow(self, row): def removeRow(self, row):
self.beginRemoveRows(QModelIndex(), row,row) self.beginRemoveRows(QtCore.QModelIndex(), row,row)
self.items.pop(row) self.items.pop(row)
self.endRemoveRows() self.endRemoveRows()
def addRow(self, id, title): def addRow(self, id, title):
self.insertRow(len(self.items), id, title) self.insertRow(len(self.items), id, title)
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!
return QVariant() return QtCore.QVariant()
if role==Qt.DisplayRole: if role == QtCore.Qt.DisplayRole:
retval= self.items[row][1] retval = self.items[row][1]
# elif role == Qt.ToolTipRole: #not sure if need as it shows the database row number
# retval= self.items[row][0]
else: else:
retval= QVariant() retval = QtCore.QVariant()
# log.info("Returning"+ str(retval)) if type(retval) is not type(QtCore.QVariant):
if type(retval) is not type(QVariant): return QtCore.QVariant(retval)
return QVariant(retval)
else: else:
return retval return retval
@ -60,10 +55,7 @@ class TextListData(QAbstractListModel):
def getId(self, index): def getId(self, index):
row = index.row() row = index.row()
return self.items[row][0] return self.items[row][0]
def deleteRow(self, index): def deleteRow(self, index):
row = index.row() row = index.row()
self.removeRow(row) self.removeRow(row)
if __name__=="__main__":
sxml=TextListData()

View File

@ -21,14 +21,12 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, Event from openlp.core.lib import Plugin, Event, EventType
from openlp.core.lib import EventType
from openlp.plugins.images.lib import ImageMediaItem, ImageServiceItem from openlp.plugins.images.lib import ImageMediaItem, ImageServiceItem
class ImagePlugin(Plugin): class ImagePlugin(Plugin):
global log global log
log=logging.getLogger(u'ImagePlugin') log = logging.getLogger(u'ImagePlugin')
log.info(u'Image Plugin loaded') log.info(u'Image Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):

View File

@ -17,8 +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 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 PyQt4 import QtCore, QtGui
import logging import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import ServiceItem from openlp.core.lib import ServiceItem
from listwithpreviews import ListWithPreviews from listwithpreviews import ListWithPreviews

View File

@ -1,51 +1,74 @@
# -*- 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
"""
import os import os
import logging import logging
from PyQt4.QtCore import * from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import *
class ListWithPreviews(QAbstractListModel):
class ListWithPreviews(QtCore.QAbstractListModel):
""" """
An abstract list of strings and the preview icon to go with them An abstract list of strings and the preview icon to go with them
""" """
global log global log
log=logging.getLogger("ListWithPreviews") log = logging.getLogger("ListWithPreviews")
log.info("started") log.info("started")
def __init__(self): def __init__(self):
QAbstractListModel.__init__(self) QtCore.QAbstractListModel.__init__(self)
self.items=[] # will be a list of (full filename, QPixmap, shortname) tuples self.items = [] # will be a list of (full filename, QPixmap, shortname) tuples
self.rowheight=50 self.rowheight = 50
self.maximagewidth=self.rowheight*16/9.0; self.maximagewidth = self.rowheight*16/9.0;
def rowCount(self, parent): def rowCount(self, parent):
return len(self.items) return len(self.items)
def insertRow(self, row, filename): def insertRow(self, row, filename):
self.beginInsertRows(QModelIndex(),row,row) self.beginInsertRows(QtCore.QModelIndex(),row,row)
log.info("insert row %d:%s"%(row,filename)) log.info("insert row %d:%s"% (row,filename))
# get short filename to display next to image # get short filename to display next to image
(prefix, shortfilename) = os.path.split(str(filename)) (prefix, shortfilename) = os.path.split(str(filename))
log.info("shortfilename=%s"%(shortfilename)) log.info("shortfilename=%s"% (shortfilename))
# create a preview image # create a preview image
if os.path.exists(filename): if os.path.exists(filename):
preview = QPixmap(str(filename)) preview = QtGui.QPixmap(str(filename))
w=self.maximagewidth;h=self.rowheight w = self.maximagewidth;
preview = preview.scaled(w,h, Qt.KeepAspectRatio, Qt.SmoothTransformation) h = self.rowheight
realw=preview.width(); realh=preview.height() preview = preview.scaled(w, h, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
realw = preview.width();
realh = preview.height()
# and move it to the centre of the preview space # and move it to the centre of the preview space
p=QPixmap(w,h) p = QtGui.QPixmap(w,h)
p.fill(Qt.transparent) p.fill(QtCore.Qt.transparent)
painter=QPainter(p) painter = QtGui.QPainter(p)
painter.drawPixmap((w-realw)/2,(h-realh)/2,preview) painter.drawPixmap((w-realw)/2,(h-realh)/2,preview)
else: else:
w=self.maximagewidth;h=self.rowheight w = self.maximagewidth;
p=QPixmap(w,h) h = self.rowheight
p.fill(Qt.transparent) p = QtGui.QPixmap(w,h)
p.fill(QtCore.Qt.transparent)
# finally create the row # finally create the row
self.items.insert(row, (filename, p, shortfilename)) self.items.insert(row, (filename, p, shortfilename))
self.endInsertRows() self.endInsertRows()
def removeRow(self, row): def removeRow(self, row):
self.beginRemoveRows(QModelIndex(), row,row) self.beginRemoveRows(QtCore.QModelIndex(), row, row)
self.items.pop(row) self.items.pop(row)
self.endRemoveRows() self.endRemoveRows()
@ -53,20 +76,20 @@ class ListWithPreviews(QAbstractListModel):
self.insertRow(len(self.items), filename) self.insertRow(len(self.items), filename)
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):
return QVariant() # if the last row is selected and deleted, we then get called with an empty row!
if role==Qt.DisplayRole: return QtCore.QVariant()
retval= self.items[row][2] if role == QtCore.Qt.DisplayRole:
elif role == Qt.DecorationRole: retval = self.items[row][2]
retval= self.items[row][1] elif role == QtCore.Qt.DecorationRole:
elif role == Qt.ToolTipRole: retval = self.items[row][1]
retval= self.items[row][0] elif role == QtCore.Qt.ToolTipRole:
retval = self.items[row][0]
else: else:
retval= QVariant() retval = QtCore.QVariant()
# log.info("Returning"+ str(retval)) if type(retval) is not type(QtCore.QVariant):
if type(retval) is not type(QVariant): return QtCore.QVariant(retval)
return QVariant(retval)
else: else:
return retval return retval

View File

@ -22,10 +22,7 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core import translate from openlp.core.lib import MediaManagerItem, ServiceItem, translate
from openlp.core.lib import MediaManagerItem
from openlp.core.lib import ServiceItem
from openlp.plugins.images.lib import ListWithPreviews from openlp.plugins.images.lib import ListWithPreviews
class ImageList(QtGui.QListView): class ImageList(QtGui.QListView):
@ -156,7 +153,7 @@ class ImageMediaItem(MediaManagerItem):
for index in indexes: for index in indexes:
filename = self.ImageListData.getFilename(index) filename = self.ImageListData.getFilename(index)
frame = QtGui.QPixmap(str(filename)) frame = QtGui.QPixmap(str(filename))
service_item.frames.append({u'formatted': u'Image', u'image': frame}) service_item.frames.append({u'title': filename , u'image': frame})
def onImagePreviewClick(self): def onImagePreviewClick(self):
log.debug(u'Image Preview Requested') log.debug(u'Image Preview Requested')

View File

@ -22,8 +22,7 @@ import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core import translate from openlp.core.lib import MediaManagerItem, translate
from openlp.core.lib import MediaManagerItem
from openlp.plugins.media.lib import MediaTab from openlp.plugins.media.lib import MediaTab
from openlp.plugins.media.lib import FileListData from openlp.plugins.media.lib import FileListData
@ -33,7 +32,7 @@ class MediaMediaItem(MediaManagerItem):
This is the custom media manager item for Media Slides. This is the custom media manager item for Media Slides.
""" """
global log global log
log=logging.getLogger(u'MediaMediaItem') log = logging.getLogger(u'MediaMediaItem')
log.info(u'Media Media Item loaded') log.info(u'Media Media Item loaded')
def __init__(self, parent, icon, title): def __init__(self, parent, icon, title):

View File

@ -20,9 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core import translate from openlp.core.lib import SettingsTab, str_to_bool, translate
from openlp import convertStringToBoolean
from openlp.core.lib import SettingsTab
class MediaTab(SettingsTab): class MediaTab(SettingsTab):
""" """
@ -67,11 +65,12 @@ class MediaTab(SettingsTab):
def onVMRCheckBoxChanged(self): def onVMRCheckBoxChanged(self):
use_vmr_mode = self.UseVMRCheckBox.checkState() use_vmr_mode = self.UseVMRCheckBox.checkState()
self.use_vmr_mode = False self.use_vmr_mode = False
if use_vmr_mode == 2: # we have a set value convert to True/False if use_vmr_mode == 2:
# we have a set value convert to True/False
self.use_vmr_mode = True self.use_vmr_mode = True
def load(self): def load(self):
self.use_vmr_mode = convertStringToBoolean(self.config.get_config(u'use mode layout', u'False')) self.use_vmr_mode = str_to_bool(self.config.get_config(u'use mode layout', u'False'))
if self.use_vmr_mode : if self.use_vmr_mode :
self.UseVMRCheckBox.setChecked(True) self.UseVMRCheckBox.setChecked(True)

View File

@ -20,7 +20,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
import os import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab
from openlp.plugins.media.lib import MediaTab,MediaMediaItem from openlp.plugins.media.lib import MediaTab,MediaMediaItem

View File

@ -21,11 +21,7 @@ import logging
import os import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, translate
from openlp.core import translate
from openlp.core.lib import MediaManagerItem
from openlp.core.resources import *
from openlp.plugins.presentations.lib import FileListData from openlp.plugins.presentations.lib import FileListData
class PresentationMediaItem(MediaManagerItem): class PresentationMediaItem(MediaManagerItem):

View File

@ -21,9 +21,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core import translate from openlp.core.lib import MediaManagerItem, translate
from openlp.core.lib import MediaManagerItem
from openlp.core.resources import *
from openlp.plugins.songs.forms import EditSongForm from openlp.plugins.songs.forms import EditSongForm
@ -32,7 +30,7 @@ class SongMediaItem(MediaManagerItem):
This is the custom media manager item for Songs. This is the custom media manager item for Songs.
""" """
global log global log
log=logging.getLogger("SongMediaItem") log = logging.getLogger("SongMediaItem")
log.info("Song Media Item loaded") log.info("Song Media Item loaded")
def __init__(self, parent, icon, title): def __init__(self, parent, icon, title):

View File

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

View File

@ -21,7 +21,6 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
from openlp.core.lib import Plugin, Event from openlp.core.lib import Plugin, Event
from openlp.core.lib import EventType from openlp.core.lib import EventType
from openlp.plugins.songs.lib import SongManager, SongsTab, SongMediaItem from openlp.plugins.songs.lib import SongManager, SongsTab, SongMediaItem
@ -31,7 +30,7 @@ from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
class SongsPlugin(Plugin): class SongsPlugin(Plugin):
global log global log
log=logging.getLogger(u'SongsPlugin') log = logging.getLogger(u'SongsPlugin')
log.info(u'Song Plugin loaded') log.info(u'Song Plugin loaded')
def __init__(self, plugin_helpers): def __init__(self, plugin_helpers):
@ -124,7 +123,7 @@ class SongsPlugin(Plugin):
""" """
Handle the event contained in the event object. Handle the event contained in the event object.
""" """
log.debug(u'Handle event called with event %s'%event.event_type) log.debug(u'Handle event called with event %s' % event.event_type)
if event.event_type == EventType.ThemeListChanged: if event.event_type == EventType.ThemeListChanged:
log.debug(u'New Theme request received') log.debug(u'New Theme request received')
#self.edit_custom_form.loadThemes(self.theme_manager.getThemes()) #self.edit_custom_form.loadThemes(self.theme_manager.getThemes())