This commit is contained in:
Andreas Preikschat 2011-03-10 17:42:18 +01:00
commit 8c21f7853f
98 changed files with 42497 additions and 32835 deletions

View File

@ -24,7 +24,6 @@
# 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 sys
import logging
@ -37,6 +36,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, check_directory_exists
from openlp.core.resources import qInitResources
from openlp.core.ui.mainwindow import MainWindow
from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm
from openlp.core.ui.firsttimeform import FirstTimeForm
from openlp.core.ui.exceptionform import ExceptionForm
from openlp.core.ui import SplashScreen, ScreenList
from openlp.core.utils import AppLocation, LanguageManager, VersionThread
@ -150,10 +151,6 @@ class OpenLP(QtGui.QApplication):
log.info(u'Openlp version %s' % app_version[u'version'])
return app_version
# def notify(self, obj, evt):
# #TODO needed for presentation exceptions
# return QtGui.QApplication.notify(self, obj, evt)
def run(self):
"""
Run the OpenLP application.
@ -170,6 +167,13 @@ class OpenLP(QtGui.QApplication):
self.setOrganizationDomain(u'openlp.org')
self.setApplicationName(u'OpenLP')
self.setApplicationVersion(app_version[u'version'])
# Decide how many screens we have and their size
screens = ScreenList(self.desktop())
# First time checks in settings
firstTime = QtCore.QSettings().value(
u'general/first time', QtCore.QVariant(True)).toBool()
if firstTime:
FirstTimeForm(screens).exec_()
if os.name == u'nt':
self.setStyleSheet(application_stylesheet)
show_splash = QtCore.QSettings().value(
@ -179,17 +183,10 @@ class OpenLP(QtGui.QApplication):
self.splash.show()
# make sure Qt really display the splash screen
self.processEvents()
screens = ScreenList()
# Decide how many screens we have and their size
for screen in xrange(0, self.desktop().numScreens()):
size = self.desktop().screenGeometry(screen)
screens.add_screen({u'number': screen,
u'size': size,
u'primary': (self.desktop().primaryScreen() == screen)})
log.info(u'Screen %d found with resolution %s', screen, size)
# start the main app window
self.appClipboard = self.clipboard()
self.mainWindow = MainWindow(screens, app_version, self.appClipboard)
self.mainWindow = MainWindow(screens, app_version, self.appClipboard,
firstTime)
self.mainWindow.show()
if show_splash:
# now kill the splashscreen
@ -273,7 +270,19 @@ def main():
qInitResources()
# Now create and actually run the application.
app = OpenLP(qt_args)
#i18n Set Language
# Define the settings environment
QtCore.QSettings(u'OpenLP', u'OpenLP')
# First time checks in settings
# Use explicit reference as not inside a QT environment yet
if QtCore.QSettings(u'OpenLP', u'OpenLP').value(
u'general/first time', QtCore.QVariant(True)).toBool():
if not FirstTimeLanguageForm().exec_():
# if cancel then stop processing
sys.exit()
if sys.platform == u'darwin':
OpenLP.addLibraryPath(QtGui.QApplication.applicationDirPath()
+ "/qt4_plugins")
# i18n Set Language
language = LanguageManager.get_language()
appTranslator = LanguageManager.get_translator(language)
app.installTranslator(appTranslator)

View File

@ -106,8 +106,8 @@ def translate(context, text, comment=None,
def get_text_file_string(text_file):
"""
Open a file and return its content as unicode string. If the supplied file
name is not a file then the function returns False. If there is an error
Open a file and return its content as unicode string. If the supplied file
name is not a file then the function returns False. If there is an error
loading the file or the content can't be decoded then the function will
return None.

View File

@ -65,7 +65,7 @@ def delete_database(plugin_name, db_file_name=None):
The name of the plugin to remove the database for
``db_file_name``
The database file name. Defaults to None resulting in the
The database file name. Defaults to None resulting in the
plugin_name being used.
"""
db_file_path = None
@ -91,6 +91,7 @@ class BaseModel(object):
instance.__setattr__(key, kwargs[key])
return instance
class Manager(object):
"""
Provide generic object persistence management
@ -107,7 +108,7 @@ class Manager(object):
The init_schema function for this database
``db_file_name``
The file name to use for this database. Defaults to None resulting
The file name to use for this database. Defaults to None resulting
in the plugin_name being used.
"""
settings = QtCore.QSettings()
@ -211,11 +212,11 @@ class Manager(object):
The type of objects to return
``filter_clause``
The filter governing selection of objects to return. Defaults to
The filter governing selection of objects to return. Defaults to
None.
``order_by_ref``
Any parameters to order the returned objects by. Defaults to None.
Any parameters to order the returned objects by. Defaults to None.
"""
query = self.session.query(object_class)
if filter_clause is not None:
@ -232,7 +233,7 @@ class Manager(object):
The type of objects to return.
``filter_clause``
The filter governing selection of objects to return. Defaults to
The filter governing selection of objects to return. Defaults to
None.
"""
query = self.session.query(object_class)

View File

@ -220,8 +220,6 @@ class MediaManagerItem(QtGui.QWidget):
if self.hasDeleteIcon:
toolbar_actions.append([StringContent.Delete,
u':/general/general_delete.png', self.onDeleteClick])
## Separator Line ##
self.addToolbarSeparator()
## Preview ##
toolbar_actions.append([StringContent.Preview,
u':/general/general_preview.png', self.onPreviewClick])
@ -232,6 +230,8 @@ class MediaManagerItem(QtGui.QWidget):
toolbar_actions.append([StringContent.Service,
u':/general/general_add.png', self.onAddClick])
for action in toolbar_actions:
if action[0] == StringContent.Preview:
self.addToolbarSeparator()
self.addToolbarButton(
self.plugin.getString(action[0])[u'title'],
self.plugin.getString(action[0])[u'tooltip'],

View File

@ -34,6 +34,15 @@ from openlp.core.ui import MainDisplay
log = logging.getLogger(__name__)
VERSE = u'The Lord said to {r}Noah{/r}: \n' \
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \
'The Lord said to {g}Noah{/g}:\n' \
'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \
'Get those children out of the muddy, muddy \n' \
'{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \
'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456']
class RenderManager(object):
"""
Class to pull all Renderer interactions into one place. The plugins will
@ -60,7 +69,6 @@ class RenderManager(object):
self.image_manager = ImageManager()
self.display = MainDisplay(self, screens, False)
self.display.imageManager = self.image_manager
self.display.setup()
self.theme_manager = theme_manager
self.renderer = Renderer()
self.calculate_default(self.screens.current[u'size'])
@ -202,28 +210,17 @@ class RenderManager(object):
self.force_page = force_page
# set the default image size for previews
self.calculate_default(self.screens.preview[u'size'])
verse = u'The Lord said to {r}Noah{/r}: \n' \
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n' \
'The Lord said to {g}Noah{/g}:\n' \
'There\'s gonna be a {st}floody{/st}, {it}floody{/it}\n' \
'Get those children out of the muddy, muddy \n' \
'{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}' \
'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n'
# make big page for theme edit dialog to get line count
if self.force_page:
verse = verse + verse + verse
else:
self.image_manager.del_image(theme_data.theme_name)
footer = []
footer.append(u'Arky Arky (Unknown)')
footer.append(u'Public Domain')
footer.append(u'CCLI 123456')
# build a service item to generate preview
serviceItem = ServiceItem()
serviceItem.theme = theme_data
serviceItem.add_from_text(u'', verse, footer)
if self.force_page:
# make big page for theme edit dialog to get line count
serviceItem.add_from_text(u'', VERSE + VERSE + VERSE, FOOTER)
else:
self.image_manager.del_image(theme_data.theme_name)
serviceItem.add_from_text(u'', VERSE, FOOTER)
serviceItem.render_manager = self
serviceItem.raw_footer = footer
serviceItem.raw_footer = FOOTER
serviceItem.render(True)
if not self.force_page:
self.display.buildHtml(serviceItem)

View File

@ -88,8 +88,8 @@ class ServiceItem(object):
self.audit = u''
self.items = []
self.iconic_representation = None
self.raw_footer = None
self.foot_text = None
self.raw_footer = []
self.foot_text = u''
self.theme = None
self.service_item_type = None
self._raw_frames = []
@ -162,9 +162,7 @@ class ServiceItem(object):
line_break = True
if self.is_capable(ItemCapabilities.NoLineBreaks):
line_break = False
theme = None
if self.theme:
theme = self.theme
theme = self.theme if self.theme else None
self.main, self.footer = \
self.render_manager.set_override_theme(theme, useOverride)
self.themedata = self.render_manager.renderer._theme
@ -185,13 +183,8 @@ class ServiceItem(object):
else:
log.error(u'Invalid value renderer :%s' % self.service_item_type)
self.title = clean_tags(self.title)
self.foot_text = None
if self.raw_footer:
for foot in self.raw_footer:
if not self.foot_text:
self.foot_text = foot
else:
self.foot_text = u'%s<br>%s' % (self.foot_text, foot)
self.foot_text = \
u'<br>'.join([footer for footer in self.raw_footer if footer])
def add_from_image(self, path, title):
"""
@ -204,8 +197,7 @@ class ServiceItem(object):
A title for the slide in the service item.
"""
self.service_item_type = ServiceItemType.Image
self._raw_frames.append(
{u'title': title, u'path': path})
self._raw_frames.append({u'title': title, u'path': path})
self.render_manager.image_manager.add_image(title, path)
self._new_item()

View File

@ -64,7 +64,7 @@ class SettingsManager(object):
Read the last directory used for plugin.
``section``
The section of code calling the method. This is used in the
The section of code calling the method. This is used in the
settings key.
``num``
@ -84,7 +84,7 @@ class SettingsManager(object):
Save the last directory used for plugin.
``section``
The section of code calling the method. This is used in the
The section of code calling the method. This is used in the
settings key.
``directory``
@ -160,11 +160,11 @@ class SettingsManager(object):
Get a list of files from the data files path.
``section``
Defaults to *None*. The section of code getting the files - used
Defaults to *None*. The section of code getting the files - used
to load from a section's data subdirectory.
``extension``
Defaults to *None*. The extension to search for.
Defaults to *None*. The extension to search for.
"""
path = AppLocation.get_data_path()
if section:

View File

@ -91,6 +91,7 @@ class ThemeLevel(object):
Service = 2
Song = 3
class BackgroundType(object):
"""
Type enumeration for backgrounds.
@ -123,6 +124,7 @@ class BackgroundType(object):
elif type_string == u'image':
return BackgroundType.Image
class BackgroundGradientType(object):
"""
Type enumeration for background gradients.
@ -200,6 +202,7 @@ INTEGER_LIST = [u'size', u'line_adjustment', u'x', u'height', u'y',
u'width', u'shadow_size', u'outline_size', u'horizontal_align',
u'vertical_align', u'wrap_style']
class ThemeXML(object):
"""
A class to encapsulate the Theme XML.

View File

@ -130,7 +130,7 @@ def create_accept_reject_button_box(parent, okay=False):
methods to handle the default ``accepted()`` and ``rejected()`` signals.
``parent``
The parent object. This should be a ``QWidget`` descendant.
The parent object. This should be a ``QWidget`` descendant.
``okay``
If true creates an okay/cancel combination instead of save/cancel.
@ -185,15 +185,15 @@ def media_item_combo_box(parent, name):
def create_delete_push_button(parent, icon=None):
"""
Creates a standard push button with a delete label and optional icon. The
Creates a standard push button with a delete label and optional icon. The
button is connected to the parent's ``onDeleteButtonClicked()`` method to
handle the ``clicked()`` signal.
``parent``
The parent object. This should be a ``QWidget`` descendant.
The parent object. This should be a ``QWidget`` descendant.
``icon``
An icon to display on the button. This can be either a ``QIcon``, a
An icon to display on the button. This can be either a ``QIcon``, a
resource path or a file name.
"""
delete_button = QtGui.QPushButton(parent)
@ -210,12 +210,12 @@ def create_delete_push_button(parent, icon=None):
def create_up_down_push_button_set(parent):
"""
Creates a standard set of two push buttons, one for up and the other for
down, for use with lists. The buttons use arrow icons and no text and are
down, for use with lists. The buttons use arrow icons and no text and are
connected to the parent's ``onUpButtonClicked()`` and
``onDownButtonClicked()`` to handle their respective ``clicked()`` signals.
``parent``
The parent object. This should be a ``QWidget`` descendant.
The parent object. This should be a ``QWidget`` descendant.
"""
up_button = QtGui.QPushButton(parent)
up_button.setIcon(build_icon(u':/services/service_up.png'))
@ -295,7 +295,7 @@ def create_valign_combo(form, parent, layout):
The UI screen that the label and combo will appear on.
``parent``
The parent object. This should be a ``QWidget`` descendant.
The parent object. This should be a ``QWidget`` descendant.
``layout``
A layout object to add the label and combo widgets to.

View File

@ -92,7 +92,7 @@ class Theme(object):
* ``solid`` - color
``BackgroundParameter2``
Extra information about the background. The contents of this attribute
Extra information about the background. The contents of this attribute
depend on the BackgroundType:
* ``image`` - border color
@ -100,7 +100,7 @@ class Theme(object):
* ``solid`` - N/A
``BackgroundParameter3``
Extra information about the background. The contents of this attribute
Extra information about the background. The contents of this attribute
depend on the BackgroundType:
* ``image`` - N/A
@ -142,7 +142,7 @@ class Theme(object):
Color for the outline (or None if Outline is 0)
``HorizontalAlign``
The horizontal alignment to apply to text. Valid alignments are:
The horizontal alignment to apply to text. Valid alignments are:
* ``0`` - left align
* ``1`` - right align
@ -156,7 +156,7 @@ class Theme(object):
* ``2`` - centre align
``WrapStyle``
The wrap style to apply to the text. Valid styles are:
The wrap style to apply to the text. Valid styles are:
* ``0`` - normal
* ``1`` - lyrics

View File

@ -51,6 +51,8 @@ class HideMode(object):
Theme = 2
Screen = 3
from firsttimeform import FirstTimeForm
from firsttimelanguageform import FirstTimeLanguageForm
from themeform import ThemeForm
from filerenameform import FileRenameForm
from starttimeform import StartTimeForm
@ -74,4 +76,4 @@ from thememanager import ThemeManager
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay',
'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager',
'ServiceItemEditForm']
'ServiceItemEditForm', u'FirstTimeForm']

View File

@ -106,38 +106,86 @@ class Ui_AboutDialog(object):
))
self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.aboutTab), UiStrings.About)
self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
lead = u'Raoul "superfly" Snyman'
developers = [u'Tim "TRB143" Bentley', u'Jonathan "gushie" Corwin',
u'Michael "cocooncrash" Gorven',
u'Andreas "googol" Preikschat', u'Raoul "superfly" Snyman',
u'Martin "mijiti" Thompson', u'Jon "Meths" Tibble']
contributors = [u'Scott "sguerrieri" Guerrieri',
u'Meinert "m2j" Jordan', u'Armin "orangeshirt" K\xf6hler',
u'Christian "crichter" Richter', u'Philip "Phill" Ridout',
u'Jeffrey "whydoubt" Smith', u'Maikel Stuivenberg',
u'Carsten "catini" Tingaard', u'Frode "frodus" Woldsund']
testers = [u'Philip "Phill" Ridout', u'Wesley "wrst" Stout',
u'John "jseagull1" Cegalis (lead)']
packagers = ['Thomas "tabthorpe" Abthorpe (FreeBSD)',
u'Tim "TRB143" Bentley (Fedora)',
u'Michael "cocooncrash" Gorven (Ubuntu)',
u'Matthias "matthub" Hub (Mac OS X)',
u'Raoul "superfly" Snyman (Windows, Ubuntu)']
translators = {
u'af': [u'Johan "nuvolari" Mynhardt'],
u'de': [u'Patrick "madmuffin" Br\xfcckner',
u'Meinert "m2j" Jordan',
u'Andreas "googol" Preikschat',
u'Christian "crichter" Richter'],
u'en_GB': [u'Tim "TRB143" Bentley', u'Jonathan "gushie" Corwin'],
u'en_ZA': [u'Raoul "superfly" Snyman'],
u'et': [u'Mattias "mahfiaz" P\xf5ldaru'],
u'fr': [u'Stephan\xe9 "stbrunner" Brunner'],
u'hu': [u'Gyuris Gellért'],
u'ja': [u'Kunio "Kunio" Nakamaru'],
u'nb': [u'Atle "pendlaren" Weibell', u'Frode "frodus" Woldsund'],
u'nl': [u'Arjen "typovar" van Voorst'],
u'pt_BR': [u'Rafael "rafaellerm" Lerm'],
u'ru': [u'Sergey "ratz" Ratz']
}
documentors = [u'Wesley "wrst" Stout',
u'John "jseagull1" Cegalis (lead)']
self.creditsTextEdit.setPlainText(unicode(translate('OpenLP.AboutForm',
'Project Lead\n'
' Raoul "superfly" Snyman\n'
' %s\n'
'\n'
'Developers\n'
' Tim "TRB143" Bentley\n'
' Jonathan "gushie" Corwin\n'
' Michael "cocooncrash" Gorven\n'
' Scott "sguerrieri" Guerrieri\n'
' Raoul "superfly" Snyman\n'
' Martin "mijiti" Thompson\n'
' Jon "Meths" Tibble\n'
' %s\n'
'\n'
'Contributors\n'
' Meinert "m2j" Jordan\n'
' Andreas "googol" Preikschat\n'
' Christian "crichter" Richter\n'
' Philip "Phill" Ridout\n'
' Maikel Stuivenberg\n'
' Carsten "catini" Tingaard\n'
' Frode "frodus" Woldsund\n'
' %s\n'
'\n'
'Testers\n'
' Philip "Phill" Ridout\n'
' Wesley "wrst" Stout (lead)\n'
' %s\n'
'\n'
'Packagers\n'
' Thomas "tabthorpe" Abthorpe (FreeBSD)\n'
' Tim "TRB143" Bentley (Fedora)\n'
' Michael "cocooncrash" Gorven (Ubuntu)\n'
' Matthias "matthub" Hub (Mac OS X)\n'
' Raoul "superfly" Snyman (Windows, Ubuntu)\n'
' %s\n'
'\n'
'Translators\n'
' Afrikaans (af)\n'
' %s\n'
' German (de)\n'
' %s\n'
' English, United Kingdom (en_GB)\n'
' %s\n'
' English, South Africa (en_ZA)\n'
' %s\n'
' Estonian (et)\n'
' %s\n'
' French (fr)\n'
' %s\n'
' Hungarian (hu)\n'
' %s\n'
' Japanese (ja)\n'
' %s\n'
' Norwegian Bokm\xe5l (nb)\n'
' %s\n'
' Dutch (nl)\n'
' %s\n'
' Portuguese, Brazil (pt_BR)\n'
' %s\n'
' Russian (ru)\n'
' %s\n'
'\n'
'Documentation\n'
' %s\n'
'\n'
'Built With\n'
' Python: http://www.python.org/\n'
@ -155,31 +203,42 @@ class Ui_AboutDialog(object):
' God our Father, for sending His Son to die\n'
' on the cross, setting us free from sin. We\n'
' bring this software to you for free because\n'
' He has set us free.'
))
' He has set us free.')) % (lead, u'\n '.join(developers),
u'\n '.join(contributors), u'\n '.join(testers),
u'\n '.join(packagers), u'\n '.join(translators[u'af']),
u'\n '.join(translators[u'de']),
u'\n '.join(translators[u'en_GB']),
u'\n '.join(translators[u'en_ZA']),
u'\n '.join(translators[u'et']),
u'\n '.join(translators[u'fr']),
u'\n '.join(translators[u'hu']),
u'\n '.join(translators[u'ja']),
u'\n '.join(translators[u'nb']),
u'\n '.join(translators[u'nl']),
u'\n '.join(translators[u'pt_BR']),
u'\n '.join(translators[u'ru']),
u'\n '.join(documentors)))
self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.creditsTab),
translate('OpenLP.AboutForm', 'Credits'))
self.licenseTextEdit.setPlainText(translate('OpenLP.AboutForm',
copyright = translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2011 Raoul Snyman\n'
'Portions copyright \xa9 2004-2011 '
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri,\n'
'Meinert Jordan, Andreas Preikschat, Christian Richter, Philip\n'
'Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Carstenn'
'Tinggaard, Frode Woldsund\n'
'\n'
'Tinggaard, Frode Woldsund')
licence = translate('OpenLP.AboutForm',
'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.\n'
'\n'
'License.')
disclaimer = translate('OpenLP.AboutForm',
'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 below '
'for more details.\n'
'\n'
'\n'
'GNU GENERAL PUBLIC LICENSE\n'
'for more details.')
gpltext = ('GNU GENERAL PUBLIC LICENSE\n'
'Version 2, June 1991\n'
'\n'
'Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 '
@ -549,7 +608,9 @@ class Ui_AboutDialog(object):
'subroutine library, you may consider it more useful to permit '
'linking proprietary applications with the library. If this is '
'what you want to do, use the GNU Lesser General Public License '
'instead of this License.'))
'instead of this License.')
self.licenseTextEdit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' %
(copyright, licence, disclaimer, gpltext))
self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.licenseTab),
translate('OpenLP.AboutForm', 'License'))

View File

@ -72,7 +72,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog):
def preLoad(self):
"""
Load the Tags from store so can be used in the system or used to
update the display. If Cancel was selected this is needed to reset the
update the display. If Cancel was selected this is needed to reset the
dsiplay to the correct version.
"""
# Initial Load of the Tags

View File

@ -0,0 +1,217 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, #
# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon #
# Tibble, Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# 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 ConfigParser
import io
import logging
import os
import urllib
from PyQt4 import QtCore, QtGui
from firsttimewizard import Ui_FirstTimeWizard
from openlp.core.lib import translate, PluginStatus, check_directory_exists, \
Receiver
from openlp.core.utils import get_web_page, AppLocation
log = logging.getLogger(__name__)
class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
"""
This is the Theme Import Wizard, which allows easy creation and editing of
OpenLP themes.
"""
log.info(u'ThemeWizardForm loaded')
def __init__(self, screens, parent=None):
# check to see if we have web access
self.web = u'http://openlp.org/files/frw/'
self.config = ConfigParser.ConfigParser()
self.webAccess = get_web_page(u'%s%s' % (self.web, u'download.cfg'))
if self.webAccess:
files = self.webAccess.read()
self.config.readfp(io.BytesIO(files))
QtGui.QWizard.__init__(self, parent)
self.setupUi(self)
for screen in screens.get_screen_list():
self.displaySelectionComboBox.addItem(screen)
self.songsText = translate('OpenLP.FirstTimeWizard', 'Songs')
self.biblesText = translate('OpenLP.FirstTimeWizard', 'Bibles')
self.themesText = translate('OpenLP.FirstTimeWizard', 'Themes')
self.startUpdates = translate('OpenLP.FirstTimeWizard',
'Starting Updates')
self.downloading = unicode(translate('OpenLP.FirstTimeWizard',
'Downloading %s'))
QtCore.QObject.connect(self,
QtCore.SIGNAL(u'currentIdChanged(int)'),
self.onCurrentIdChanged)
def exec_(self, edit=False):
"""
Run the wizard.
"""
self.setDefaults()
return QtGui.QWizard.exec_(self)
def setDefaults(self):
"""
Set up display at start of theme edit.
"""
self.restart()
# Sort out internet access for downloads
if self.webAccess:
self.internetGroupBox.setVisible(True)
self.noInternetLabel.setVisible(False)
# If songs database exists do not allow a copy
songs = os.path.join(AppLocation.get_section_data_path(u'songs'),
u'songs.sqlite')
if not os.path.exists(songs):
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
treewidgetitem.setText(0, self.songsText)
self._loadChild(treewidgetitem, u'songs', u'languages', u'songs')
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
treewidgetitem.setText(0, self.biblesText)
self._loadChild(treewidgetitem, u'bibles', u'translations',
u'bible')
treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget)
treewidgetitem.setText(0, self.themesText)
self._loadChild(treewidgetitem, u'themes', u'files', 'theme')
else:
self.internetGroupBox.setVisible(False)
self.noInternetLabel.setVisible(True)
def _loadChild(self, tree, list, tag, root):
files = self.config.get(list, tag)
files = files.split(u',')
for file in files:
if file:
child = QtGui.QTreeWidgetItem(tree)
child.setText(0, self.config.get(u'%s_%s'
% (root, file), u'title'))
child.setData(0, QtCore.Qt.UserRole,
QtCore.QVariant(self.config.get(u'%s_%s'
% (root, file), u'filename')))
child.setCheckState(0, QtCore.Qt.Unchecked)
child.setFlags(QtCore.Qt.ItemIsUserCheckable |
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
def onCurrentIdChanged(self, pageId):
"""
Detects Page changes and updates as approprate.
"""
if self.page(pageId) == self.DefaultsPage:
self.themeSelectionComboBox.clear()
listIterator = QtGui.QTreeWidgetItemIterator(
self.selectionTreeWidget)
while listIterator.value():
parent = listIterator.value().parent()
if parent and listIterator.value().checkState(0) \
== QtCore.Qt.Checked:
if unicode(parent.text(0)) == self.themesText:
self.themeSelectionComboBox.addItem(
listIterator.value().text(0))
listIterator += 1
def accept(self):
Receiver.send_message(u'cursor_busy')
self._updateMessage(self.startUpdates)
# Set up the Plugin status's
self._pluginStatus(self.songsCheckBox, u'songs/status')
self._pluginStatus(self.bibleCheckBox, u'bibles/status')
self._pluginStatus(self.presentationCheckBox, u'presentations/status')
self._pluginStatus(self.imageCheckBox, u'images/status')
self._pluginStatus(self.mediaCheckBox, u'media/status')
self._pluginStatus(self.remoteCheckBox, u'remotes/status')
self._pluginStatus(self.customCheckBox, u'custom/status')
self._pluginStatus(self.songUsageCheckBox, u'songusage/status')
self._pluginStatus(self.alertCheckBox, u'alerts/status')
# Build directories for downloads
songsDestination = AppLocation.get_section_data_path(u'songs')
check_directory_exists(songsDestination)
bibleDestination = AppLocation.get_section_data_path(u'bibles')
check_directory_exists(bibleDestination)
themeDestination = AppLocation.get_section_data_path(u'themes')
check_directory_exists(themeDestination)
# Install Selected Items looping through them
listIterator = QtGui.QTreeWidgetItemIterator(self.selectionTreeWidget)
while listIterator.value():
type = listIterator.value().parent()
if listIterator.value().parent():
if listIterator.value().checkState(0) == QtCore.Qt.Checked:
# Install items as theu have been selected
item = unicode(listIterator.value().text(0))
# Download Song database if selected
if unicode(type.text(0)) == self.songsText:
songs = unicode(listIterator.value().data(0,
QtCore.Qt.UserRole).toString())
message = self.downloading % item
self._updateMessage(message)
# Song database is a fixed file name
urllib.urlretrieve(u'%s%s' % (self.web, songs),
os.path.join(songsDestination, u'songs.sqlite'))
# Download and selected Bibles
if unicode(type.text(0)) == self.biblesText:
bible = unicode(listIterator.value().data(0,
QtCore.Qt.UserRole).toString())
message = self.downloading % item
self._updateMessage(message)
urllib.urlretrieve(u'%s%s' % (self.web, bible),
os.path.join(bibleDestination, bible))
# Download any themes
if unicode(type.text(0)) == self.themesText:
theme = unicode(listIterator.value().data(0,
QtCore.Qt.UserRole).toString())
message = self.downloading % item
self._updateMessage(message)
urllib.urlretrieve(u'%s%s' % (self.web, theme),
os.path.join(themeDestination, theme))
listIterator += 1
# Set Default Display
if self.displaySelectionComboBox.currentIndex() != -1:
QtCore.QSettings().setValue(u'General/monitor',
QtCore.QVariant(self.displaySelectionComboBox.
currentIndex()))
# Set Global Theme
if self.themeSelectionComboBox.currentIndex() != -1:
QtCore.QSettings().setValue(u'themes/global theme',
QtCore.QVariant(self.themeSelectionComboBox.currentText()))
QtCore.QSettings().setValue(u'general/first time',
QtCore.QVariant(False))
Receiver.send_message(u'cursor_normal')
return QtGui.QWizard.accept(self)
def _pluginStatus(self, field, tag):
status = PluginStatus.Active if field.checkState() \
== QtCore.Qt.Checked else PluginStatus.Inactive
QtCore.QSettings().setValue(tag, QtCore.QVariant(status))
def _updateMessage(self, text):
"""
Keep screen up to date
"""
self.updateLabel.setText(text)
Receiver.send_message(u'openlp_process_events')

View File

@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, #
# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon #
# Tibble, Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_FirstTimeLanguageDialog(object):
def setupUi(self, firstTimeLanguageDialog):
firstTimeLanguageDialog.setObjectName(u'firstTimeLanguageDialog')
firstTimeLanguageDialog.resize(300, 10)
self.dialogLayout = QtGui.QGridLayout(firstTimeLanguageDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.fileNameLabel = QtGui.QLabel(firstTimeLanguageDialog)
self.fileNameLabel.setObjectName(u'fileNameLabel')
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
self.LanguageComboBox = QtGui.QComboBox(firstTimeLanguageDialog)
self.LanguageComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.LanguageComboBox.setObjectName("LanguageComboBox")
self.dialogLayout.addWidget(self.LanguageComboBox, 0, 1)
self.buttonBox = create_accept_reject_button_box(firstTimeLanguageDialog, True)
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(firstTimeLanguageDialog)
self.setMaximumHeight(self.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(firstTimeLanguageDialog)
def retranslateUi(self, firstTimeLanguageDialog):
self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm',
'Initial Set up Language'))
self.fileNameLabel.setText(translate('OpenLP.FirstTimeLanguageForm',
'Initial Language:'))

View File

@ -0,0 +1,67 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, #
# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon #
# Tibble, Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtGui
from firsttimelanguagedialog import Ui_FirstTimeLanguageDialog
from openlp.core.lib import translate
from openlp.core.utils import LanguageManager
class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog):
"""
The exception dialog
"""
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.qmList = LanguageManager.get_qm_list()
self.LanguageComboBox.addItem(u'Automatic')
for key in sorted(self.qmList.keys()):
self.LanguageComboBox.addItem(key)
def exec_(self):
"""
Run the Dialog with correct heading.
"""
return QtGui.QDialog.exec_(self)
def accept(self):
# It's the first row so must be Automatic
if self.LanguageComboBox.currentIndex() == 0:
LanguageManager.auto_language = True
LanguageManager.set_language(False, False)
else:
LanguageManager.auto_language = False
action = QtGui.QAction(None)
action.setObjectName(unicode(self.LanguageComboBox.currentText()))
LanguageManager.set_language(action, False)
return QtGui.QDialog.accept(self)
def reject(self):
LanguageManager.auto_language = True
LanguageManager.set_language(False, False)
return QtGui.QDialog.reject(self)

View File

@ -0,0 +1,227 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, #
# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon #
# Tibble, Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_FirstTimeWizard(object):
def setupUi(self, FirstTimeWizard):
FirstTimeWizard.setObjectName(u'FirstTimeWizard')
FirstTimeWizard.resize(550, 386)
FirstTimeWizard.setModal(True)
FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages|
QtGui.QWizard.NoBackButtonOnStartPage)
self.welcomePage = QtGui.QWizardPage()
self.welcomePage.setTitle(u'')
self.welcomePage.setSubTitle(u'')
self.welcomePage.setObjectName(u'welcomePage')
self.welcomeLayout = QtGui.QHBoxLayout(self.welcomePage)
self.welcomeLayout.setSpacing(8)
self.welcomeLayout.setMargin(0)
self.welcomeLayout.setObjectName(u'welcomeLayout')
self.importBibleImage = QtGui.QLabel(self.welcomePage)
self.importBibleImage.setMinimumSize(QtCore.QSize(163, 0))
self.importBibleImage.setMaximumSize(QtCore.QSize(163, 16777215))
self.importBibleImage.setLineWidth(0)
self.importBibleImage.setText(u'')
self.importBibleImage.setPixmap(
QtGui.QPixmap(u':/wizards/wizard_importbible.bmp'))
self.importBibleImage.setIndent(0)
self.importBibleImage.setObjectName(u'importBibleImage')
self.welcomeLayout.addWidget(self.importBibleImage)
self.welcomePageLayout = QtGui.QVBoxLayout()
self.welcomePageLayout.setSpacing(8)
self.welcomePageLayout.setObjectName(u'welcomePageLayout')
self.titleLabel = QtGui.QLabel(self.welcomePage)
self.titleLabel.setObjectName(u'titleLabel')
self.welcomePageLayout.addWidget(self.titleLabel)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Fixed)
self.welcomePageLayout.addItem(spacerItem)
self.informationLabel = QtGui.QLabel(self.welcomePage)
self.informationLabel.setWordWrap(True)
self.informationLabel.setMargin(10)
self.informationLabel.setObjectName(u'informationLabel')
self.welcomePageLayout.addWidget(self.informationLabel)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.welcomePageLayout.addItem(spacerItem1)
self.welcomeLayout.addLayout(self.welcomePageLayout)
FirstTimeWizard.addPage(self.welcomePage)
self.PluginPagePage = QtGui.QWizardPage()
self.PluginPagePage.setObjectName(u'PluginPagePage')
self.verticalLayout_2 = QtGui.QVBoxLayout(self.PluginPagePage)
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(u'verticalLayout')
self.songsCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.songsCheckBox.setChecked(True)
self.songsCheckBox.setObjectName(u'songsCheckBox')
self.verticalLayout.addWidget(self.songsCheckBox)
self.customCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.customCheckBox.setChecked(True)
self.customCheckBox.setObjectName(u'customCheckBox')
self.verticalLayout.addWidget(self.customCheckBox)
self.bibleCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.bibleCheckBox.setChecked(True)
self.bibleCheckBox.setObjectName(u'bibleCheckBox')
self.verticalLayout.addWidget(self.bibleCheckBox)
self.imageCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.imageCheckBox.setChecked(True)
self.imageCheckBox.setObjectName(u'imageCheckBox')
self.verticalLayout.addWidget(self.imageCheckBox)
self.presentationCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.presentationCheckBox.setChecked(True)
self.presentationCheckBox.setObjectName(u'presentationCheckBox')
self.verticalLayout.addWidget(self.presentationCheckBox)
self.mediaCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.mediaCheckBox.setChecked(True)
self.mediaCheckBox.setObjectName(u'mediaCheckBox')
self.verticalLayout.addWidget(self.mediaCheckBox)
self.remoteCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.remoteCheckBox.setObjectName(u'remoteCheckBox')
self.verticalLayout.addWidget(self.remoteCheckBox)
self.songUsageCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.songUsageCheckBox.setChecked(True)
self.songUsageCheckBox.setObjectName(u'songUsageCheckBox')
self.verticalLayout.addWidget(self.songUsageCheckBox)
self.alertCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.alertCheckBox.setChecked(True)
self.alertCheckBox.setObjectName(u'alertCheckBox')
self.verticalLayout.addWidget(self.alertCheckBox)
self.verticalLayout_2.addLayout(self.verticalLayout)
FirstTimeWizard.addPage(self.PluginPagePage)
self.downloadDefaultsPage = QtGui.QWizardPage()
self.downloadDefaultsPage.setObjectName(u'downloadDefaultsPage')
self.noInternetLabel = QtGui.QLabel(self.downloadDefaultsPage)
self.noInternetLabel.setGeometry(QtCore.QRect(20, 20, 461, 17))
self.noInternetLabel.setObjectName(u'noInternetLabel')
self.internetGroupBox = QtGui.QGroupBox(self.downloadDefaultsPage)
self.internetGroupBox.setGeometry(QtCore.QRect(20, 10, 501, 271))
self.internetGroupBox.setObjectName(u'internetGroupBox')
self.verticalLayout_4 = QtGui.QVBoxLayout(self.internetGroupBox)
self.verticalLayout_4.setObjectName(u'verticalLayout_4')
self.selectionTreeWidget = QtGui.QTreeWidget(self.internetGroupBox)
self.selectionTreeWidget.setHorizontalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
self.selectionTreeWidget.setProperty(u'showDropIndicator', False)
self.selectionTreeWidget.setAlternatingRowColors(True)
self.selectionTreeWidget.setObjectName(u'selectionTreeWidget')
self.selectionTreeWidget.headerItem().setText(0, u'1')
self.selectionTreeWidget.header().setVisible(False)
self.verticalLayout_4.addWidget(self.selectionTreeWidget)
FirstTimeWizard.addPage(self.downloadDefaultsPage)
self.DefaultsPage = QtGui.QWizardPage()
self.DefaultsPage.setObjectName(u'DefaultsPage')
self.layoutWidget = QtGui.QWidget(self.DefaultsPage)
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 491, 113))
self.layoutWidget.setObjectName(u'layoutWidget')
self.gridLayout = QtGui.QGridLayout(self.layoutWidget)
self.gridLayout.setMargin(0)
self.gridLayout.setObjectName(u'gridLayout')
self.displaySelectionLabel = QtGui.QLabel(self.layoutWidget)
self.displaySelectionLabel.setObjectName(u'displaySelectionLabel')
self.gridLayout.addWidget(self.displaySelectionLabel, 0, 0, 1, 1)
self.displaySelectionComboBox = QtGui.QComboBox(self.layoutWidget)
self.displaySelectionComboBox.setEditable(False)
self.displaySelectionComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.displaySelectionComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToContents)
self.displaySelectionComboBox.setObjectName(u'displaySelectionComboBox')
self.gridLayout.addWidget(self.displaySelectionComboBox, 0, 1, 1, 1)
self.themeSelectionLabel = QtGui.QLabel(self.layoutWidget)
self.themeSelectionLabel.setObjectName(u'themeSelectionLabel')
self.gridLayout.addWidget(self.themeSelectionLabel, 1, 0, 1, 1)
self.themeSelectionComboBox = QtGui.QComboBox(self.layoutWidget)
self.themeSelectionComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToContents)
self.themeSelectionComboBox.setObjectName(u'themeSelectionComboBox')
self.gridLayout.addWidget(self.themeSelectionComboBox, 1, 1, 1, 1)
self.messageLabel = QtGui.QLabel(self.DefaultsPage)
self.messageLabel.setGeometry(QtCore.QRect(60, 160, 471, 17))
self.messageLabel.setObjectName(u'messageLabel')
self.updateLabel = QtGui.QLabel(self.DefaultsPage)
self.updateLabel.setGeometry(QtCore.QRect(60, 220, 351, 17))
self.updateLabel.setObjectName(u'updateLabel')
FirstTimeWizard.addPage(self.DefaultsPage)
self.retranslateUi(FirstTimeWizard)
QtCore.QMetaObject.connectSlotsByName(FirstTimeWizard)
def retranslateUi(self, FirstTimeWizard):
FirstTimeWizard.setWindowTitle(translate(
'OpenLP.FirstTimeWizard', 'First Time Wizard'))
self.titleLabel.setText(
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate('OpenLP.FirstTimeWizard',
'Welcome to the First Time Wizard'))
self.informationLabel.setText(translate('OpenLP.FirstTimeWizard',
'This wizard will help you to configure OpenLP for initial use .'
' Click the next button below to start the process of selection '
'your initial options. '))
self.PluginPagePage.setTitle(translate('OpenLP.FirstTimeWizard',
'Activate required Plugins'))
self.PluginPagePage.setSubTitle(translate('OpenLP.FirstTimeWizard',
'Select the Plugins you wish to use. '))
self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs'))
self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Custom Text'))
self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible'))
self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Images'))
self.presentationCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Presentations'))
self.mediaCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Media (Audio and Video)'))
self.remoteCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Allow remote access'))
self.songUsageCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Monitor Song Usage'))
self.alertCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Allow Alerts'))
self.downloadDefaultsPage.setTitle(translate('OpenLP.FirstTimeWizard',
'Download Samples from OpenLP.org'))
self.downloadDefaultsPage.setSubTitle(translate(
'OpenLP.FirstTimeWizard',
'Select samples to downlaod and install for use.'))
self.noInternetLabel.setText(translate('OpenLP.FirstTimeWizard',
'No Internet connection found so unable to download any default'
' files.'))
self.internetGroupBox.setTitle(translate('OpenLP.FirstTimeWizard',
'Download Example Files'))
self.DefaultsPage.setTitle(translate('OpenLP.FirstTimeWizard',
'Default Settings'))
self.DefaultsPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
'Set up default values to be used by OpenLP'))
self.displaySelectionLabel.setText(translate('OpenLP.FirstTimeWizard',
'Default output display'))
self.themeSelectionLabel.setText(translate('OpenLP.FirstTimeWizard',
'Select the default Theme'))
self.messageLabel.setText(translate('OpenLP.FirstTimeWizard',
'Press finish to apply all your changes and start OpenLP'))

View File

@ -45,7 +45,7 @@ class ValidEdit(QtGui.QLineEdit):
def validText(self):
"""
Only return Integers. Space is 0
Only return Integers. Space is 0
"""
if self.text().isEmpty():
return QtCore.QString(u'0')
@ -234,6 +234,9 @@ class GeneralTab(SettingsTab):
QtCore.QObject.connect(self.customXValueEdit,
QtCore.SIGNAL(u'textEdited(const QString&)'),
self.onDisplayPositionChanged)
# Reload the tab, as the screen resolution/count may have changed.
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_screen_changed'), self.load)
def retranslateUi(self):
"""
@ -300,13 +303,9 @@ class GeneralTab(SettingsTab):
"""
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
for screen in self.screens.screen_list:
screen_name = u'%s %d' % (translate('OpenLP.GeneralTab', 'Screen'),
screen[u'number'] + 1)
if screen[u'primary']:
screen_name = u'%s (%s)' % (screen_name,
translate('OpenLP.GeneralTab', 'primary'))
self.monitorComboBox.addItem(screen_name)
self.monitorComboBox.clear()
for screen in self.screens.get_screen_list():
self.monitorComboBox.addItem(screen)
self.numberEdit.setText(unicode(settings.value(
u'ccli number', QtCore.QVariant(u'')).toString()))
self.usernameEdit.setText(unicode(settings.value(

View File

@ -90,8 +90,8 @@ class MainDisplay(DisplayWidget):
"""
Set up and build the output screen
"""
log.debug(u'Setup live = %s for monitor %s ' % (self.isLive,
self.screens.monitor_number))
log.debug(u'Start setup for monitor %s (live = %s)' %
(self.screens.monitor_number, self.isLive))
self.usePhonon = QtCore.QSettings().value(
u'media/use phonon', QtCore.QVariant(True)).toBool()
self.phononActive = False
@ -102,6 +102,7 @@ class MainDisplay(DisplayWidget):
self.videoWidget.setVisible(False)
self.videoWidget.setGeometry(QtCore.QRect(0, 0,
self.screen[u'size'].width(), self.screen[u'size'].height()))
log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number)
self.mediaObject = Phonon.MediaObject(self)
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
Phonon.createPath(self.mediaObject, self.videoWidget)
@ -109,6 +110,7 @@ class MainDisplay(DisplayWidget):
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'),
self.videoStart)
log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number)
self.webView = QtWebKit.QWebView(self)
self.webView.setGeometry(0, 0,
self.screen[u'size'].width(), self.screen[u'size'].height())
@ -158,12 +160,15 @@ class MainDisplay(DisplayWidget):
self.webView.setHtml(build_html(serviceItem, self.screen,
self.alertTab, self.isLive, None))
self.initialFrame = True
self.__hideMouse()
# To display or not to display?
if not self.screen[u'primary']:
self.show()
self.primary = False
else:
self.primary = True
log.debug(
u'Finished setup for monitor %s' % self.screens.monitor_number)
def text(self, slide):
"""
@ -232,9 +237,6 @@ class MainDisplay(DisplayWidget):
image = self.imageManager.get_image_bytes(name)
self.resetVideo()
self.displayImage(image)
# show screen
if self.isLive:
self.setVisible(True)
return self.preview()
def displayImage(self, image):
@ -247,7 +249,8 @@ class MainDisplay(DisplayWidget):
js = u'show_image("");'
self.frame.evaluateJavaScript(js)
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
if self.isLive:
Receiver.send_message(u'maindisplay_active')
def resetImage(self):
"""
@ -261,7 +264,8 @@ class MainDisplay(DisplayWidget):
self.displayImage(None)
self.override = {}
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
if self.isLive:
Receiver.send_message(u'maindisplay_active')
def resetVideo(self):
"""
@ -278,7 +282,8 @@ class MainDisplay(DisplayWidget):
self.frame.evaluateJavaScript(u'show_video("close");')
self.override = {}
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
if self.isLive:
Receiver.send_message(u'maindisplay_active')
def videoPlay(self):
"""
@ -318,7 +323,7 @@ class MainDisplay(DisplayWidget):
Changes the volume of a running video
"""
log.debug(u'videoVolume %d' % volume)
vol = float(volume)/float(10)
vol = float(volume) / float(10)
if self.phononActive:
self.audio.setVolume(vol)
else:
@ -334,7 +339,7 @@ class MainDisplay(DisplayWidget):
# We are running a background theme
self.override[u'theme'] = u''
self.override[u'video'] = True
vol = float(volume)/float(10)
vol = float(volume) / float(10)
if isBackground or not self.usePhonon:
js = u'show_video("init", "%s", %s, true); show_video("play");' % \
(videoPath.replace(u'\\', u'\\\\'), str(vol))
@ -349,7 +354,8 @@ class MainDisplay(DisplayWidget):
self.videoWidget.setVisible(True)
self.audio.setVolume(vol)
# Update the preview frame.
Receiver.send_message(u'maindisplay_active')
if self.isLive:
Receiver.send_message(u'maindisplay_active')
return self.preview()
def videoStart(self, newState, oldState):
@ -387,9 +393,10 @@ class MainDisplay(DisplayWidget):
Receiver.send_message(u'openlp_process_events')
# if was hidden keep it hidden
if self.isLive:
self.setVisible(True)
if self.hideMode:
self.hideDisplay(self.hideMode)
else:
self.setVisible(True)
preview = QtGui.QImage(self.screen[u'size'].width(),
self.screen[u'size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied)
@ -434,15 +441,7 @@ class MainDisplay(DisplayWidget):
# if was hidden keep it hidden
if self.hideMode and self.isLive:
self.hideDisplay(self.hideMode)
# Hide mouse cursor when moved over display if enabled in settings
settings = QtCore.QSettings()
if settings.value(u'advanced/hide mouse',
QtCore.QVariant(False)).toBool():
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else:
self.setCursor(QtCore.Qt.ArrowCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
self.__hideMouse()
def footer(self, text):
"""
@ -490,7 +489,18 @@ class MainDisplay(DisplayWidget):
self.videoPlay()
self.hideMode = None
# Trigger actions when display is active again
Receiver.send_message(u'maindisplay_active')
if self.isLive:
Receiver.send_message(u'maindisplay_active')
def __hideMouse(self):
# Hide mouse cursor when moved over display if enabled in settings
if QtCore.QSettings().value(u'advanced/hide mouse',
QtCore.QVariant(False)).toBool():
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else:
self.setCursor(QtCore.Qt.ArrowCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
class AudioPlayer(QtCore.QObject):
@ -506,9 +516,6 @@ class AudioPlayer(QtCore.QObject):
``parent``
The parent widget.
``screens``
The list of screens.
"""
log.debug(u'AudioPlayer Initialisation started')
QtCore.QObject.__init__(self, parent)

View File

@ -206,7 +206,7 @@ class Ui_MainWindow(object):
mainWindow.actionList.add_action(self.ModeDefaultItem, u'View Mode')
self.ModeSetupItem = checkable_action(mainWindow, u'ModeLiveItem')
mainWindow.actionList.add_action(self.ModeSetupItem, u'View Mode')
self.ModeLiveItem = checkable_action(mainWindow, u'ModeLiveItem')
self.ModeLiveItem = checkable_action(mainWindow, u'ModeLiveItem', True)
mainWindow.actionList.add_action(self.ModeLiveItem, u'View Mode')
self.ModeGroup = QtGui.QActionGroup(mainWindow)
self.ModeGroup.addAction(self.ModeDefaultItem)
@ -215,6 +215,8 @@ class Ui_MainWindow(object):
self.ModeDefaultItem.setChecked(True)
self.ToolsAddToolItem = icon_action(mainWindow, u'ToolsAddToolItem',
u':/tools/tools_add.png')
# Hide the entry, as it does not have any functionality yet.
self.ToolsAddToolItem.setVisible(False)
mainWindow.actionList.add_action(self.ToolsAddToolItem, u'Tools')
self.ToolsOpenDataFolder = icon_action(mainWindow,
u'ToolsOpenDataFolder', u':/general/general_open.png')
@ -225,19 +227,17 @@ class Ui_MainWindow(object):
u'Settings')
# i18n Language Items
self.AutoLanguageItem = checkable_action(mainWindow,
u'AutoLanguageItem')
u'AutoLanguageItem', LanguageManager.auto_language)
mainWindow.actionList.add_action(self.AutoLanguageItem, u'Settings')
self.LanguageGroup = QtGui.QActionGroup(mainWindow)
self.LanguageGroup.setExclusive(True)
self.LanguageGroup.setObjectName(u'LanguageGroup')
self.AutoLanguageItem.setChecked(LanguageManager.auto_language)
self.LanguageGroup.setDisabled(LanguageManager.auto_language)
qmList = LanguageManager.get_qm_list()
savedLanguage = LanguageManager.get_language()
for key in sorted(qmList.keys()):
languageItem = checkable_action(mainWindow, key)
if qmList[key] == savedLanguage:
languageItem.setChecked(True)
languageItem = checkable_action(
mainWindow, key, qmList[key] == savedLanguage)
add_actions(self.LanguageGroup, [languageItem])
self.SettingsShortcutsItem = icon_action(mainWindow,
u'SettingsShortcutsItem',
@ -279,7 +279,7 @@ class Ui_MainWindow(object):
add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
add_actions(self.SettingsMenu, (self.settingsPluginListItem,
self.SettingsLanguageMenu.menuAction(), None,
self.SettingsShortcutsItem, self.DisplayTagItem,
self.DisplayTagItem, self.SettingsShortcutsItem,
self.SettingsConfigureItem))
add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None))
add_actions(self.ToolsMenu, (self.ToolsOpenDataFolder, None))
@ -461,7 +461,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
actionList = ActionList()
def __init__(self, screens, applicationVersion, clipboard):
def __init__(self, screens, applicationVersion, clipboard, firstTime):
"""
This constructor sets up the interface, the various managers, and the
plugins.
@ -626,6 +626,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.MediaToolBox.setCurrentIndex(savedPlugin)
self.settingsForm.postSetUp()
Receiver.send_message(u'cursor_normal')
# Import themes if first time
if firstTime:
self.themeManagerContents.firstTime()
def setAutoLanguage(self, value):
self.LanguageGroup.setDisabled(value)
@ -650,8 +654,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Show the main form, as well as the display form
"""
QtGui.QWidget.show(self)
self.liveController.display.setup()
self.previewController.display.setup()
if self.liveController.display.isVisible():
self.liveController.display.setFocus()
self.activateWindow()

View File

@ -25,11 +25,15 @@
###############################################################################
"""
The :mod:`screen` module provides management functionality for a machines'
displays
displays.
"""
import logging
import copy
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate
log = logging.getLogger(__name__)
class ScreenList(object):
@ -38,7 +42,14 @@ class ScreenList(object):
"""
log.info(u'Screen loaded')
def __init__(self):
def __init__(self, desktop):
"""
Initialise the screen list.
``desktop``
A ``QDesktopWidget`` object.
"""
self.desktop = desktop
self.preview = None
self.current = None
self.override = None
@ -48,19 +59,120 @@ class ScreenList(object):
self.current_display = 0
# save config display number
self.monitor_number = 0
self.screen_count_changed()
QtCore.QObject.connect(desktop,
QtCore.SIGNAL(u'resized(int)'), self.screen_resolution_changed)
QtCore.QObject.connect(desktop,
QtCore.SIGNAL(u'screenCountChanged(int)'),
self.screen_count_changed)
def screen_resolution_changed(self, number):
"""
Called when the resolution of a screen has changed.
``number``
The number of the screen, which size has changed.
"""
log.info(u'screenResolutionChanged %d' % number)
for screen in self.screen_list:
if number == screen[u'number']:
newScreen = {
u'number': number,
u'size': self.desktop.screenGeometry(number),
u'primary': self.desktop.primaryScreen() == number
}
self.remove_screen(number)
self.add_screen(newScreen)
# The screen's default size is used, that is why we have to
# update the override screen.
if screen == self.override:
self.override = copy.deepcopy(newScreen)
self.set_override_display()
Receiver.send_message(u'config_screen_changed')
break
def screen_count_changed(self, changed_screen=-1):
"""
Called when a screen has been added or removed.
``changed_screen``
The screen's number which has been (un)plugged.
"""
# Remove unplugged screens.
for screen in copy.deepcopy(self.screen_list):
if screen[u'number'] == self.desktop.numScreens():
self.remove_screen(screen[u'number'])
# Add new screens.
for number in xrange(0, self.desktop.numScreens()):
if not self.screen_exists(number):
self.add_screen({
u'number': number,
u'size': self.desktop.screenGeometry(number),
u'primary': (self.desktop.primaryScreen() == number)
})
# We do not want to send this message, when the method is called the
# first time.
if changed_screen != -1:
# Reload setting tabs to apply possible changes.
Receiver.send_message(u'config_screen_changed')
def get_screen_list(self):
"""
Returns a list with the screens. This should only be used to display
available screens to the user::
[u'Screen 1 (primary)', u'Screen 2']
"""
screen_list = []
for screen in self.screen_list:
screen_name = u'%s %d' % (translate('OpenLP.ScreenList', 'Screen'),
screen[u'number'] + 1)
if screen[u'primary']:
screen_name = u'%s (%s)' % (screen_name,
translate('OpenLP.ScreenList', 'primary'))
screen_list.append(screen_name)
return screen_list
def add_screen(self, screen):
"""
Add a screen to the list of known screens
Add a screen to the list of known screens.
``screen``
A dict with the screen properties::
{
u'primary': True,
u'number': 0,
u'size': PyQt4.QtCore.QRect(0, 0, 1024, 768)
}
"""
log.info(u'Screen %d found with resolution %s',
screen[u'number'], screen[u'size'])
if screen[u'primary']:
self.current = screen
self.screen_list.append(screen)
self.display_count += 1
def remove_screen(self, number):
"""
Remove a screen from the list of known screens.
``number``
The screen number (int).
"""
log.info(u'remove_screen %d' % number)
for screen in self.screen_list:
if screen[u'number'] == number:
self.screen_list.remove(screen)
self.display_count -= 1
break
def screen_exists(self, number):
"""
Confirms a screen is known
Confirms a screen is known.
``number``
The screen number (int).
"""
for screen in self.screen_list:
if screen[u'number'] == number:
@ -69,7 +181,10 @@ class ScreenList(object):
def set_current_display(self, number):
"""
Set up the current screen dimensions
Set up the current screen dimensions.
``number``
The screen number (int).
"""
log.debug(u'set_current_display %s', number)
if number + 1 > self.display_count:
@ -86,8 +201,8 @@ class ScreenList(object):
def set_override_display(self):
"""
replace the current size with the override values
user wants to have their own screen attributes
Replace the current size with the override values, as the user wants to
have their own screen attributes.
"""
log.debug(u'set_override_display')
self.current = copy.deepcopy(self.override)
@ -95,8 +210,8 @@ class ScreenList(object):
def reset_current_display(self):
"""
replace the current values with the correct values
user wants to use the correct screen attributes
Replace the current values with the correct values, as the user wants to
use the correct screen attributes.
"""
log.debug(u'reset_current_display')
self.set_current_display(self.current_display)

View File

@ -943,6 +943,7 @@ class ServiceManager(QtGui.QWidget):
for item in self.serviceItems:
if item[u'service_item']._uuid == uuid:
item[u'service_item'].edit_id = editId
self.setModified(True)
def replaceServiceItem(self, newItem):
"""
@ -1123,13 +1124,14 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.remove(serviceItem)
self.serviceItems.insert(endpos, serviceItem)
self.repaintServiceList(endpos, child)
self.setModified(True)
else:
# we are not over anything so drop
replace = False
if item is None:
self.dropPosition = len(self.serviceItems)
else:
# we are over somthing so lets investigate
# we are over something so lets investigate
pos = self._getParentItemData(item) - 1
serviceItem = self.serviceItems[pos]
if (plugin == serviceItem[u'service_item'].name and

View File

@ -32,7 +32,7 @@ from PyQt4.phonon import Phonon
from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \
ItemCapabilities, translate
from openlp.core.lib.ui import UiStrings, shortcut_action
from openlp.core.lib.ui import icon_action, UiStrings, shortcut_action
from openlp.core.ui import HideMode, MainDisplay
log = logging.getLogger(__name__)
@ -114,8 +114,7 @@ class SlideController(QtGui.QWidget):
self.previewListWidget = SlideList(self)
self.previewListWidget.setColumnCount(1)
self.previewListWidget.horizontalHeader().setVisible(False)
self.previewListWidget.setColumnWidth(
0, self.controller.width())
self.previewListWidget.setColumnWidth(0, self.controller.width())
self.previewListWidget.isLive = self.isLive
self.previewListWidget.setObjectName(u'PreviewListWidget')
self.previewListWidget.setSelectionBehavior(1)
@ -146,36 +145,30 @@ class SlideController(QtGui.QWidget):
u':/slides/slide_next.png',
translate('OpenLP.SlideController', 'Move to next'),
self.onSlideSelectedNext)
self.toolbar.addToolbarSeparator(u'Close Separator')
if self.isLive:
self.toolbar.addToolbarSeparator(u'Close Separator')
self.hideMenu = QtGui.QToolButton(self.toolbar)
self.hideMenu.setText(translate('OpenLP.SlideController', 'Hide'))
self.hideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.toolbar.addToolbarWidget(u'Hide Menu', self.hideMenu)
self.hideMenu.setMenu(QtGui.QMenu(
translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.blankScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_blank.png'),
translate('OpenLP.SlideController',
'Blank Screen'), self.hideMenu)
self.blankScreen.setCheckable(True)
self.themeScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_theme.png'),
translate('OpenLP.SlideController',
'Blank to Theme'), self.hideMenu)
self.themeScreen.setCheckable(True)
self.blankScreen = icon_action(self.hideMenu, u'Blank Screen',
u':/slides/slide_blank.png', False)
self.blankScreen.setText(
translate('OpenLP.SlideController', 'Blank Screen'))
self.themeScreen = icon_action(self.hideMenu, u'Blank Theme',
u':/slides/slide_theme.png', False)
self.themeScreen.setText(
translate('OpenLP.SlideController', 'Blank to Theme'))
self.desktopScreen = icon_action(self.hideMenu, u'Desktop Screen',
u':/slides/slide_desktop.png', False)
self.desktopScreen.setText(
translate('OpenLP.SlideController', 'Show Desktop'))
self.hideMenu.setDefaultAction(self.blankScreen)
self.hideMenu.menu().addAction(self.blankScreen)
self.hideMenu.menu().addAction(self.themeScreen)
if self.screens.display_count > 1:
self.desktopScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_desktop.png'),
translate('OpenLP.SlideController',
'Show Desktop'), self.hideMenu)
self.hideMenu.menu().addAction(self.desktopScreen)
self.desktopScreen.setCheckable(True)
QtCore.QObject.connect(self.desktopScreen,
QtCore.SIGNAL(u'triggered(bool)'), self.onHideDisplay)
self.hideMenu.menu().addAction(self.desktopScreen)
self.toolbar.addToolbarSeparator(u'Loop Separator')
self.toolbar.addToolbarButton(
# Does not need translating - control string.
@ -195,7 +188,6 @@ class SlideController(QtGui.QWidget):
self.delaySpinBox.setToolTip(translate('OpenLP.SlideController',
'Delay between slides in seconds'))
else:
self.toolbar.addToolbarSeparator(u'Close Separator')
self.toolbar.addToolbarButton(
# Does not need translating - control string.
u'Go Live', u':/general/general_live.png',
@ -226,8 +218,7 @@ class SlideController(QtGui.QWidget):
if self.isLive:
# Build the Song Toolbar
self.songMenu = QtGui.QToolButton(self.toolbar)
self.songMenu.setText(translate('OpenLP.SlideController',
'Go To'))
self.songMenu.setText(translate('OpenLP.SlideController', 'Go To'))
self.songMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
self.toolbar.addToolbarWidget(u'Song Menu', self.songMenu)
self.songMenu.setMenu(QtGui.QMenu(
@ -303,6 +294,8 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'triggered(bool)'), self.onBlankDisplay)
QtCore.QObject.connect(self.themeScreen,
QtCore.SIGNAL(u'triggered(bool)'), self.onThemeDisplay)
QtCore.QObject.connect(self.desktopScreen,
QtCore.SIGNAL(u'triggered(bool)'), self.onHideDisplay)
QtCore.QObject.connect(self.volumeSlider,
QtCore.SIGNAL(u'sliderReleased()'), self.mediaVolume)
QtCore.QObject.connect(Receiver.get_receiver(),
@ -469,6 +462,9 @@ class SlideController(QtGui.QWidget):
self.onSlideSelected()
def receiveSpinDelay(self, value):
"""
Adjusts the value of the ``delaySpinBox`` to the given one.
"""
self.delaySpinBox.setValue(int(value))
def enableToolBar(self, item):
@ -624,6 +620,11 @@ class SlideController(QtGui.QWidget):
self.parent.renderManager.width,
self.parent.renderManager.height)
else:
# If current slide set background to image
if framenumber == slideno:
self.serviceItem.bg_image_bytes = \
self.parent.renderManager.image_manager. \
get_image_bytes(frame[u'title'])
image = self.parent.renderManager.image_manager. \
get_image(frame[u'title'])
label.setPixmap(QtGui.QPixmap.fromImage(image))
@ -747,8 +748,7 @@ class SlideController(QtGui.QWidget):
self.hideMenu.setDefaultAction(self.blankScreen)
self.blankScreen.setChecked(checked)
self.themeScreen.setChecked(False)
if self.screens.display_count > 1:
self.desktopScreen.setChecked(False)
self.desktopScreen.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Blank)
QtCore.QSettings().setValue(
@ -769,8 +769,7 @@ class SlideController(QtGui.QWidget):
self.hideMenu.setDefaultAction(self.themeScreen)
self.blankScreen.setChecked(False)
self.themeScreen.setChecked(checked)
if self.screens.display_count > 1:
self.desktopScreen.setChecked(False)
self.desktopScreen.setChecked(False)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
QtCore.QSettings().setValue(
@ -791,9 +790,6 @@ class SlideController(QtGui.QWidget):
self.hideMenu.setDefaultAction(self.desktopScreen)
self.blankScreen.setChecked(False)
self.themeScreen.setChecked(False)
# On valid if more than 1 display
if self.screens.display_count <= 1:
return
self.desktopScreen.setChecked(checked)
if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen)
@ -857,6 +853,8 @@ class SlideController(QtGui.QWidget):
frame = self.display.text(toDisplay)
else:
frame = self.display.image(toDisplay)
# reset the store used to display first image
self.serviceItem.bg_image_bytes = None
self.slidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
self.selectedRow = row
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
@ -1096,15 +1094,15 @@ class SlideController(QtGui.QWidget):
Used by command items which provide their own displays to reset the
screen hide attributes
"""
blank = None
if self.blankScreen.isChecked:
self.blankScreen.setChecked(False)
self.hideMenu.setDefaultAction(self.blankScreen)
blank = self.blankScreen
if self.themeScreen.isChecked:
blank = self.themeScreen
if self.desktopScreen.isChecked:
blank = self.desktopScreen
if blank:
blank.setChecked(False)
self.hideMenu.setDefaultAction(blank)
QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank')
if self.themeScreen.isChecked:
self.themeScreen.setChecked(False)
self.hideMenu.setDefaultAction(self.themeScreen)
if self.screens.display_count > 1:
if self.desktopScreen.isChecked:
self.desktopScreen.setChecked(False)
self.hideMenu.setDefaultAction(self.desktopScreen)

View File

@ -145,6 +145,20 @@ class ThemeManager(QtGui.QWidget):
# Last little bits of setting up
self.configUpdated()
def firstTime(self):
"""
Import new themes downloaded by the first time wizard
"""
Receiver.send_message(u'cursor_busy')
encoding = get_filesystem_encoding()
files = SettingsManager.get_files(self.settingsSection, u'.otz')
for file in files:
file = os.path.join(self.path, file).encode(encoding)
self.unzipTheme(file, self.path)
delete_file(file)
self.loadThemes()
Receiver.send_message(u'cursor_normal')
def configUpdated(self, firstTime=False):
"""
Triggered when Config dialog is updated.
@ -266,7 +280,7 @@ class ThemeManager(QtGui.QWidget):
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
if self.fileRenameForm.exec_():
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
if self.checkIfThemeExists(newThemeName):
oldThemeData = self.getThemeData(oldThemeName)
self.cloneThemeData(oldThemeData, newThemeName)
@ -284,7 +298,7 @@ class ThemeManager(QtGui.QWidget):
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
if self.fileRenameForm.exec_(True):
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
newThemeName = unicode(self.fileRenameForm.fileNameEdit.text())
if self.checkIfThemeExists(newThemeName):
themeData = self.getThemeData(oldThemeName)
self.cloneThemeData(themeData, newThemeName)
@ -370,6 +384,7 @@ class ThemeManager(QtGui.QWidget):
'Save Theme - (%s)')) % theme,
SettingsManager.get_last_dir(self.settingsSection, 1))
path = unicode(path)
Receiver.send_message(u'cursor_busy')
if path:
SettingsManager.set_last_dir(self.settingsSection, path, 1)
themePath = os.path.join(path, theme + u'.otz')
@ -395,11 +410,12 @@ class ThemeManager(QtGui.QWidget):
finally:
if zip:
zip.close()
Receiver.send_message(u'cursor_normal')
def onImportTheme(self):
"""
Opens a file dialog to select the theme file(s) to import before
attempting to extract OpenLP themes from those files. This process
attempting to extract OpenLP themes from those files. This process
will load both OpenLP version 1 and version 2 themes.
"""
files = QtGui.QFileDialog.getOpenFileNames(self,
@ -408,12 +424,14 @@ class ThemeManager(QtGui.QWidget):
unicode(translate('OpenLP.ThemeManager',
'OpenLP Themes (*.theme *.otz)')))
log.info(u'New Themes %s', unicode(files))
Receiver.send_message(u'cursor_busy')
if files:
for file in files:
SettingsManager.set_last_dir(
self.settingsSection, unicode(file))
self.unzipTheme(file, self.path)
self.loadThemes()
Receiver.send_message(u'cursor_normal')
def loadThemes(self):
"""

View File

@ -242,7 +242,7 @@ def add_actions(target, actions):
The menu or toolbar to add actions to.
``actions``
The actions to be added. An action consisting of the keyword 'None'
The actions to be added. An action consisting of the keyword 'None'
will result in a separator being inserted into the target.
"""
for action in actions:
@ -318,7 +318,7 @@ def get_web_page(url, header=None, update_openlp=False):
Tells OpenLP to update itself if the page is successfully downloaded.
Defaults to False.
"""
# TODO: Add proxy usage. Get proxy info from OpenLP settings, add to a
# TODO: Add proxy usage. Get proxy info from OpenLP settings, add to a
# proxy_handler, build into an opener and install the opener into urllib2.
# http://docs.python.org/library/urllib2.html
if not url:

View File

@ -100,12 +100,15 @@ class LanguageManager(object):
return language
@staticmethod
def set_language(action):
def set_language(action, message=True):
"""
Set the language to translate OpenLP into
``action``
The language menu option
``message``
Display the message option
"""
language = u'en'
if action:
@ -114,13 +117,16 @@ class LanguageManager(object):
language = u'%s' % qm_list[action_name]
if LanguageManager.auto_language:
language = u'[%s]' % language
QtCore.QSettings().setValue(
# This needs to be here for the setValue to work
settings = QtCore.QSettings(u'OpenLP', u'OpenLP')
settings.setValue(
u'general/language', QtCore.QVariant(language))
log.info(u'Language file: \'%s\' written to conf file' % language)
QtGui.QMessageBox.information(None,
translate('OpenLP.LanguageManager', 'Language'),
translate('OpenLP.LanguageManager',
'Please restart OpenLP to use your new language setting.'))
if message:
QtGui.QMessageBox.information(None,
translate('OpenLP.LanguageManager', 'Language'),
translate('OpenLP.LanguageManager',
'Please restart OpenLP to use your new language setting.'))
@staticmethod
def init_qm_list():

View File

@ -163,7 +163,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# We found '<>' in the alert text, but the ParameterEdit field is empty.
if text.find(u'<>') != -1 and not self.parameterEdit.text() and \
QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Parameter found'),
translate('AlertPlugin.AlertForm', 'No Parameter Found'),
translate('AlertPlugin.AlertForm', 'You have not entered a '
'parameter to be replaced.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
@ -174,9 +174,9 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# in the alert text.
elif text.find(u'<>') == -1 and self.parameterEdit.text() and \
QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Placeholder found'),
translate('AlertPlugin.AlertForm', 'No Placeholder Found'),
translate('AlertPlugin.AlertForm', 'The alert text does not'
' contain \'<>\'.\nDo want to continue anyway?'),
' contain \'<>\'.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.parameterEdit.setFocus()

View File

@ -568,7 +568,8 @@ class BibleImportForm(OpenLPWizard):
"""
self.getFileName(WizardStrings.OpenTypeFile % UiStrings.OLPV1,
self.openlp1FileEdit, u'%s (*.bible)' %
translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x bible'))
translate('BiblesPlugin.ImportWizardForm',
'openlp.org 1.x Bible Files'))
def registerFields(self):
"""

View File

@ -69,8 +69,6 @@ import logging
import chardet
import csv
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate
from openlp.plugins.bibles.lib.db import BibleDB, Testament

View File

@ -322,7 +322,7 @@ class BibleDB(QtCore.QObject, Manager):
def get_books(self):
"""
A wrapper so both local and web bibles have a get_books() method that
manager can call. Used in the media manager advanced search tab.
manager can call. Used in the media manager advanced search tab.
"""
return self.get_all_objects(Book, order_by_ref=Book.id)

View File

@ -35,7 +35,7 @@ import socket
import urllib
from HTMLParser import HTMLParseError
from BeautifulSoup import BeautifulSoup, NavigableString
from BeautifulSoup import BeautifulSoup, NavigableString, Tag
from openlp.core.lib import Receiver, translate
from openlp.core.lib.ui import critical_error_message_box
@ -221,25 +221,18 @@ class BGExtract(object):
crossrefs = soup.findAll(u'sup', u'xref')
if crossrefs:
[crossref.extract() for crossref in crossrefs]
headings = soup.findAll(u'h5')
if headings:
[heading.extract() for heading in headings]
cleanup = [(re.compile('\s+'), lambda match: ' ')]
verses = BeautifulSoup(str(soup), markupMassage=cleanup)
content = verses.find(u'div', u'result-text-style-normal')
if not content:
content = verses.find(u'div', u'result-text-style-rtl-serif')
if not content:
log.debug(u'No content found in the BibleGateway response.')
send_error_message(u'parse')
return None
verse_count = len(verses.findAll(u'sup', u'versenum'))
found_count = 0
verse_list = {}
while found_count < verse_count:
content = content.findNext(u'sup', u'versenum')
raw_verse_num = content.next
for verse in verses(u'sup', u'versenum'):
raw_verse_num = verse.next
clean_verse_num = 0
# Not all verses exist in all translations and may or may not be
# represented by a verse number. If they are not fine, if they are
# it will probably be in a format that breaks int(). We will then
# represented by a verse number. If they are not fine, if they are
# it will probably be in a format that breaks int(). We will then
# have no idea what garbage may be sucked in to the verse text so
# if we do not get a clean int() then ignore the verse completely.
try:
@ -248,9 +241,22 @@ class BGExtract(object):
log.exception(u'Illegal verse number in %s %s %s:%s',
version, bookname, chapter, unicode(raw_verse_num))
if clean_verse_num:
raw_verse_text = raw_verse_num.next
verse_list[clean_verse_num] = unicode(raw_verse_text)
found_count += 1
verse_text = raw_verse_num.next
part = raw_verse_num.next.next
while not (isinstance(part, Tag) and part.attrMap and
part.attrMap[u'class'] == u'versenum'):
# While we are still in the same verse grab all the text.
if isinstance(part, NavigableString):
verse_text = verse_text + part
if isinstance(part.next, Tag) and part.next.name == u'div':
# Run out of verses so stop.
break
part = part.next
verse_list[clean_verse_num] = unicode(verse_text)
if not verse_list:
log.debug(u'No content found in the BibleGateway response.')
send_error_message(u'parse')
return None
return SearchResults(bookname, chapter, verse_list)
@ -384,7 +390,7 @@ class HTTPBible(BibleDB):
BibleDB.__init__(self, parent, **kwargs)
self.download_source = kwargs[u'download_source']
self.download_name = kwargs[u'download_name']
# TODO: Clean up proxy stuff. We probably want one global proxy per
# TODO: Clean up proxy stuff. We probably want one global proxy per
# connection type (HTTP and HTTPS) at most.
self.proxy_server = None
self.proxy_username = None
@ -458,8 +464,8 @@ class HTTPBible(BibleDB):
search_results = self.get_chapter(book, reference[1])
if search_results and search_results.has_verselist():
## We have found a book of the bible lets check to see
## if it was there. By reusing the returned book name
## we get a correct book. For example it is possible
## if it was there. By reusing the returned book name
## we get a correct book. For example it is possible
## to request ac and get Acts back.
bookname = search_results.book
Receiver.send_message(u'openlp_process_events')

View File

@ -250,7 +250,7 @@ class BibleManager(object):
if not bible:
Receiver.send_message(u'openlp_information_message', {
u'title': translate('BiblesPlugin.BibleManager',
'No Bibles available'),
'No Bibles Available'),
u'message': translate('BiblesPlugin.BibleManager',
'There are no Bibles currently installed. Please use the '
'Import Wizard to install one or more Bibles.')
@ -265,7 +265,7 @@ class BibleManager(object):
'Scripture Reference Error'),
u'message': translate('BiblesPlugin.BibleManager',
'Your scripture reference is either not supported by OpenLP '
'or is invalid. Please make sure your reference conforms to '
'or is invalid. Please make sure your reference conforms to '
'one of the following patterns:\n\n'
'Book Chapter\n'
'Book Chapter-Chapter\n'

View File

@ -346,7 +346,7 @@ class BibleMediaItem(MediaManagerItem):
self.advancedSearchButton.setEnabled(False)
critical_error_message_box(
message=translate('BiblePlugin.MediaItem',
'Bible not fully loaded'))
'Bible not fully loaded.'))
else:
self.advancedSearchButton.setEnabled(True)
self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
@ -539,8 +539,9 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible)
elif critical_error_message_box(
message=translate('BiblePlugin.MediaItem',
'You cannot combine single and second bible verses. Do you '
'want to delete your search results and start a new search?'),
'You cannot combine single and dual Bible verse search results. '
'Do you want to delete your search results and start a new '
'search?'),
parent=self, question=True) == QtGui.QMessageBox.Yes:
self.listView.clear()
self.displayResults(bible, second_bible)
@ -635,7 +636,6 @@ class BibleMediaItem(MediaManagerItem):
bible_text = u''
old_item = None
old_chapter = -1
raw_footer = []
raw_slides = []
raw_title = []
for item in items:
@ -656,13 +656,13 @@ class BibleMediaItem(MediaManagerItem):
second_text = self._decodeQtObject(bitem, 'second_text')
verse_text = self.formatVerse(old_chapter, chapter, verse)
footer = u'%s (%s %s %s)' % (book, version, copyright, permissions)
if footer not in raw_footer:
raw_footer.append(footer)
if footer not in service_item.raw_footer:
service_item.raw_footer.append(footer)
if second_bible:
footer = u'%s (%s %s %s)' % (book, second_version,
second_copyright, second_permissions)
if footer not in raw_footer:
raw_footer.append(footer)
if footer not in service_item.raw_footer:
service_item.raw_footer.append(footer)
bible_text = u'%s&nbsp;%s\n\n%s&nbsp;%s' % (verse_text, text,
verse_text, second_text)
raw_slides.append(bible_text.rstrip())
@ -706,11 +706,6 @@ class BibleMediaItem(MediaManagerItem):
service_item.theme = self.settings.bible_theme
for slide in raw_slides:
service_item.add_from_text(slide[:30], slide)
if service_item.raw_footer:
for footer in raw_footer:
service_item.raw_footer.append(footer)
else:
service_item.raw_footer = raw_footer
return True
def formatTitle(self, start_item, old_item):

View File

@ -27,8 +27,6 @@
import logging
import sqlite
from PyQt4 import QtCore
from openlp.core.lib import Receiver
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.bibles.lib.db import BibleDB

View File

@ -25,9 +25,7 @@
###############################################################################
import logging
from lxml import objectify
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate
from openlp.plugins.bibles.lib.db import BibleDB

View File

@ -31,8 +31,6 @@ import chardet
import codecs
import re
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate
from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.db import BibleDB

View File

@ -63,7 +63,7 @@ class MediaPlugin(Plugin):
if ext not in list:
list.append(ext)
self.serviceManager.supportedSuffixes(extension[1:])
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
u' '.join(extensions)))
def about(self):

View File

@ -211,8 +211,8 @@ class ImpressDocument(PresentationDocument):
"""
Called when a presentation is added to the SlideController.
It builds the environment, starts communcations with the background
OpenOffice task started earlier. If OpenOffice is not present is is
started. Once the environment is available the presentation is loaded
OpenOffice task started earlier. If OpenOffice is not present is is
started. Once the environment is available the presentation is loaded
and started.
``presentation``

View File

@ -213,6 +213,7 @@ class Controller(object):
def poll(self):
self.doc.poll_slidenumber(self.is_live)
class MessageListener(object):
"""
This is the Presentation listener who acts on events from the slide

View File

@ -357,7 +357,7 @@ class PresentationController(object):
def __init__(self, plugin=None, name=u'PresentationController',
document_class=PresentationDocument):
"""
This is the constructor for the presentationcontroller object. This
This is the constructor for the presentationcontroller object. This
provides an easy way for descendent plugins to populate common data.
This method *must* be overridden, like so::

View File

@ -43,7 +43,7 @@ log = logging.getLogger(__name__)
class HttpServer(object):
"""
Ability to control OpenLP via a webbrowser
e.g. http://localhost:4316/send/slidecontroller_live_next
e.g. http://localhost:4316/send/slidecontroller_live_next
http://localhost:4316/send/alerts_text?q=your%20alert%20text
"""
def __init__(self, parent):

View File

@ -557,7 +557,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
Check the validity of the song.
"""
# This checks data in the form *not* self.song. self.song is still
# This checks data in the form *not* self.song. self.song is still
# None at this point.
log.debug(u'Validate Song')
# Lets be nice and assume the data is correct.
@ -714,14 +714,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def saveSong(self, preview=False):
"""
Get all the data from the widgets on the form, and then save it to the
database. The form has been validated and all reference items
database. The form has been validated and all reference items
(Authors, Books and Topics) have been saved before this function is
called.
``preview``
Should be ``True`` if the song is also previewed (boolean).
"""
# The Song() assignment. No database calls should be made while a
# The Song() assignment. No database calls should be made while a
# Song() is in a partially complete state.
if not self.song:
self.song = Song()
@ -810,4 +810,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
# This method must only be run after the self.song = Song() assignment.
log.debug(u'processTitle')
self.song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'',
unicode(self.song.search_title)).lower()
unicode(self.song.search_title)).lower().strip()

View File

@ -98,7 +98,10 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
match = self.verse_regex.match(text)
if match:
verse_tag = match.group(1)
verse_num = int(match.group(2))
try:
verse_num = int(match.group(2))
except ValueError:
verse_num = 1
verse_type_index = VerseType.from_loose_input(verse_tag)
if verse_type_index is not None:
self.verseNumberBox.setValue(verse_num)
@ -127,7 +130,10 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if match:
verse_type = match.group(1)
verse_type_index = VerseType.from_loose_input(verse_type)
verse_number = int(match.group(2))
try:
verse_number = int(match.group(2))
except ValueError:
verse_number = 1
if verse_type_index is not None:
self.verseTypeComboBox.setCurrentIndex(verse_type_index)
self.verseNumberBox.setValue(verse_number)

View File

@ -226,7 +226,7 @@ class SongExportForm(OpenLPWizard):
translate('SongsPlugin.ExportWizardForm',
'No Save Location specified'),
translate('SongsPlugin.ExportWizardForm',
'You need to specified a directory to save the songs in.'))
'You need to specify a directory.'))
return False
return True
elif self.currentPage() == self.progressPage:
@ -355,7 +355,8 @@ class SongExportForm(OpenLPWizard):
the path to *directoryLineEdit*.
"""
path = unicode(QtGui.QFileDialog.getExistingDirectory(self,
translate('SongsPlugin.ExportWizardForm', 'Selecte to Folder'),
translate('SongsPlugin.ExportWizardForm',
'Select Destination Folder'),
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
options=QtGui.QFileDialog.ShowDirsOnly))
SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1)

View File

@ -96,7 +96,7 @@ class EasiSlidesImport(SongImport):
mandatory=False):
"""
Add imported values to the song model converting them to unicode at the
same time. If the unicode decode fails or a mandatory attribute is not
same time. If the unicode decode fails or a mandatory attribute is not
present _success is set to False so the importer can react
appropriately.

View File

@ -72,7 +72,7 @@ def strip_rtf(blob, encoding):
elif control_str == 'tab':
clear_text.append(u'\t')
# Prefer the encoding specified by the RTF data to that
# specified by the Paradox table header
# specified by the Paradox table header
# West European encoding
elif control_str == 'fcharset0':
encoding = u'cp1252'
@ -129,6 +129,7 @@ class FieldDescEntry:
self.type = type
self.size = size
class EasyWorshipSongImport(SongImport):
"""
The :class:`EasyWorshipSongImport` class provides OpenLP with the
@ -163,7 +164,7 @@ class EasyWorshipSongImport(SongImport):
if code_page == 852:
self.encoding = u'cp1250'
# The following codepage to actual encoding mappings have not been
# observed, but merely guessed. Actual example files are needed.
# observed, but merely guessed. Actual example files are needed.
elif code_page == 737:
self.encoding = u'cp1253'
elif code_page == 775:

View File

@ -133,6 +133,7 @@ class FoilPresenterImport(SongImport):
log.exception(u'XML syntax error in file %s' % file_path)
return True
class FoilPresenter(object):
"""
This class represents the converter for Foilpresenter XML from a song.
@ -259,7 +260,6 @@ class FoilPresenter(object):
copyright = None
if copyright:
strings = []
author_temp = []
if copyright.find(u'Copyright') != -1:
temp = copyright.partition(u'Copyright')
copyright = temp[0]
@ -296,7 +296,7 @@ class FoilPresenter(object):
u'Text +u\.?n?d? +Musik', u'T & M', u'Melodie und Satz',
u'Text[\w\,\. ]*:', u'Melodie', u'Musik', u'Satz',
u'Weise', u'[dD]eutsch', u'[dD]t[\.\:]', u'Englisch',
u'[oO]riginal', u'Bearbeitung', u'[R|r]efrain']
u'[oO]riginal', u'Bearbeitung', u'[R|r]efrain']
for marker in markers:
copyright = re.compile(marker).sub(u'<marker>', copyright, re.U)
copyright = re.compile(u'(?<=<marker>) *:').sub(u'', copyright)
@ -305,7 +305,7 @@ class FoilPresenter(object):
while i != 1:
if copyright.find(u'<marker>') != -1:
temp = copyright.partition(u'<marker>')
if (temp[0].strip() != u'') & (x > 0):
if temp[0].strip() and x > 0:
strings.append(temp[0])
copyright = temp[2]
x += 1
@ -314,14 +314,15 @@ class FoilPresenter(object):
i = 1
else:
i = 1
author_temp = []
for author in strings:
temp = re.split(u',(?=\D{2})|(?<=\D),|\/(?=\D{3,})|(?<=\D);',
author)
for tempx in temp:
author_temp.append(tempx)
for author in author_temp:
regex = u'^[\/,;\-\s]+|[\/,;\-\s]+$|'\
'\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s]*$'
regex = u'^[\/,;\-\s\.]+|[\/,;\-\s\.]+$|'\
'\s*[0-9]{4}\s*[\-\/]?\s*([0-9]{4})?[\/,;\-\s\.]*$'
author = re.compile(regex).sub(u'', author)
author = re.compile(
u'[0-9]{1,2}\.\s?J(ahr)?h\.|um\s*$|vor\s*$').sub(u'',
@ -330,12 +331,12 @@ class FoilPresenter(object):
author = author.strip()
if re.search(
u'\w+\.?\s+\w{3,}\s+[a|u]nd\s|\w+\.?\s+\w{3,}\s+&\s',
author, re.U) != None:
author, re.U):
temp = re.split(u'\s[a|u]nd\s|\s&\s', author)
for tempx in temp:
tempx = tempx.strip()
authors.append(tempx)
elif (len(author) > 2):
elif len(author) > 2:
authors.append(author)
for display_name in authors:
author = self.manager.get_object_filtered(Author,
@ -411,7 +412,7 @@ class FoilPresenter(object):
temp_verse_order_backup = []
temp_sortnr_backup = 1
temp_sortnr_liste = []
versenumber = {u'V': 1, u'C': 1, u'B': 1, u'E': 1, u'O': 1, u'I': 1,
versenumber = {u'V': 1, u'C': 1, u'B': 1, u'E': 1, u'O': 1, u'I': 1,
u'P': 1}
for strophe in foilpresenterfolie.strophen.strophe:
text = self._child(strophe.text_)
@ -539,7 +540,7 @@ class FoilPresenter(object):
song.alternate_title = self._child(titelstring)
song.search_title += u'@' + song.alternate_title
song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'',
unicode(song.search_title)).lower()
unicode(song.search_title)).lower().strip()
def _process_topics(self, foilpresenterfolie, song):
"""

View File

@ -53,6 +53,7 @@ class SongSearch(object):
Authors = 4
Themes = 5
class SongMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Songs.
@ -158,15 +159,15 @@ class SongMediaItem(MediaManagerItem):
def onSearchTextButtonClick(self):
search_keywords = unicode(self.searchTextEdit.displayText())
search_results = []
# search_type = self.searchTypeComboBox.currentIndex()
search_type = self.searchTextEdit.currentSearchType()
if search_type == SongSearch.Entire:
log.debug(u'Entire Song Search')
search_results = self.parent.manager.get_all_objects(Song,
or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ',
search_keywords.lower()) + u'%'),
Song.search_lyrics.like(u'%' + search_keywords.lower() + \
u'%')), Song.search_title.asc())
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'),
Song.comments.like(u'%' + search_keywords.lower() + u'%')),
Song.search_title.asc())
self.displayResultsSong(search_results)
elif search_type == SongSearch.Titles:
log.debug(u'Titles Search')
@ -197,9 +198,9 @@ class SongMediaItem(MediaManagerItem):
Handle the exit from the edit dialog and trigger remote updates
of songs
"""
log.debug(u'onSongListLoad')
log.debug(u'onSongListLoad - start')
# Called to redisplay the song list screen edit from a search
# or from the exit of the Song edit dialog. If remote editing is active
# or from the exit of the Song edit dialog. If remote editing is active
# Trigger it and clean up so it will not update again.
if self.remoteTriggered == u'L':
self.onAddClick()
@ -212,19 +213,16 @@ class SongMediaItem(MediaManagerItem):
self.parent.serviceManager.replaceServiceItem(item)
self.onRemoteEditClear()
self.onSearchTextButtonClick()
log.debug(u'onSongListLoad - finished')
def displayResultsSong(self, searchresults):
log.debug(u'display results Song')
self.listView.clear()
searchresults.sort(cmp=self.collateSongTitles)
for song in searchresults:
author_list = u''
for author in song.authors:
if author_list != u'':
author_list = author_list + u', '
author_list = author_list + author.display_name
author_list = [author.display_name for author in song.authors]
song_title = unicode(song.title)
song_detail = u'%s (%s)' % (song_title, author_list)
song_detail = u'%s (%s)' % (song_title, u', '.join(author_list))
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.listView.addItem(song_name)
@ -255,11 +253,13 @@ class SongMediaItem(MediaManagerItem):
if self.searchAsYouType:
search_length = 1
if self.searchTextEdit.currentSearchType() == SongSearch.Entire:
search_length = 3
elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics:
search_length = 7
elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics:
search_length = 6
if len(text) > search_length:
self.onSearchTextButtonClick()
elif len(text) == 0:
self.onClearTextButtonClick()
def onImportClick(self):
if not hasattr(self, u'import_wizard'):
@ -333,10 +333,6 @@ class SongMediaItem(MediaManagerItem):
def generateSlideData(self, service_item, item=None, xmlVersion=False):
log.debug(u'generateSlideData (%s:%s)' % (service_item, item))
raw_footer = []
author_list = u''
author_audit = []
ccli = u''
item_id = self._getIdOfItemToGenerate(item, self.remoteSong)
service_item.add_capability(ItemCapabilities.AllowsEdit)
service_item.add_capability(ItemCapabilities.AllowsPreview)
@ -397,26 +393,21 @@ class SongMediaItem(MediaManagerItem):
for slide in verses:
service_item.add_from_text(slide[:30], unicode(slide))
service_item.title = song.title
for author in song.authors:
if len(author_list) > 1:
author_list = author_list + u', '
author_list = author_list + unicode(author.display_name)
author_audit.append(unicode(author.display_name))
raw_footer.append(song.title)
raw_footer.append(author_list)
raw_footer.append(song.copyright)
author_list = [unicode(author.display_name) for author in song.authors]
service_item.raw_footer.append(song.title)
service_item.raw_footer.append(u', '.join(author_list))
service_item.raw_footer.append(song.copyright)
if QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString():
raw_footer.append(unicode(
service_item.raw_footer.append(unicode(
translate('SongsPlugin.MediaItem', 'CCLI License: ') +
QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString()))
service_item.raw_footer = raw_footer
service_item.audit = [
song.title, author_audit, song.copyright, unicode(song.ccli_number)
song.title, author_list, song.copyright, unicode(song.ccli_number)
]
service_item.data_string = {u'title': song.search_title,
u'authors': author_list}
u'authors': u', '.join(author_list)}
service_item.xml_version = self.openLyrics.song_to_xml(song)
return True
@ -457,10 +448,9 @@ class SongMediaItem(MediaManagerItem):
add_song = False
editId = song.id
break
if add_song:
if self.addSongFromService:
editId = self.openLyrics.xml_to_song(item.xml_version)
self.onSearchTextButtonClick()
if add_song and self.addSongFromService:
editId = self.openLyrics.xml_to_song(item.xml_version)
self.onSearchTextButtonClick()
# Update service with correct song id.
if editId:
Receiver.send_message(u'service_item_update',

View File

@ -167,7 +167,7 @@ class OpenLPSongImport(SongImport):
new_song.alternate_title = old_titles[1]
else:
new_song.alternate_title = u''
new_song.search_title = song.search_title
new_song.search_title = song.search_title.strip()
new_song.song_number = song.song_number
new_song.lyrics = song.lyrics
new_song.search_lyrics = song.search_lyrics

View File

@ -36,7 +36,6 @@ from openlp.plugins.songs.lib.songimport import SongImport
log = logging.getLogger(__name__)
#TODO: Use lxml for parsing and make sure we use methods of "SongImport" .
class OpenSongImport(SongImport):
"""
Import songs exported from OpenSong

View File

@ -276,6 +276,7 @@ class SongImport(QtCore.QObject):
song.alternate_title = self.alternate_title
song.search_title = self.remove_punctuation(self.title).lower() \
+ '@' + self.remove_punctuation(self.alternate_title).lower()
song.search_title = song.search_title.strip()
song.song_number = self.song_number
song.search_lyrics = u''
verses_changed_to_other = {}
@ -347,7 +348,7 @@ class SongImport(QtCore.QObject):
"""
For debugging
"""
print u'========================================' \
print u'========================================' \
+ u'========================================'
print u'TITLE: ' + self.title
print u'ALT TITLE: ' + self.alternate_title

View File

@ -536,7 +536,7 @@ class OpenLyrics(object):
song.alternate_title = self._text(title)
song.search_title += u'@' + song.alternate_title
song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'',
unicode(song.search_title)).lower()
unicode(song.search_title)).lower().strip()
def _process_topics(self, properties, song):
"""

View File

@ -154,7 +154,7 @@ class SongsPlugin(Plugin):
if song.alternate_title is None:
song.alternate_title = u''
song.search_title = self.whitespace.sub(u' ', song.title.lower() +
u' ' + song.alternate_title.lower())
u' ' + song.alternate_title.lower()).strip()
# Remove the "language" attribute from lyrics tag. This is not very
# important, but this keeps the database clean. This can be removed
# when everybody has run the reindex tool once.

13
resources/debian/Makefile Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/make -f
# -*- makefile -*-
build:
mkdir -p openlp/i18n
for TSFILE in resources/i18n/*.ts; do\
lrelease-qt4 $$TSFILE -qm openlp/i18n/`basename $$TSFILE .ts`.qm;\
done
install:
clean:

View File

@ -0,0 +1,389 @@
openlp (1.9.4+bzr1355-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 06 Mar 2011 00:10:03 -0500
openlp (1.9.4+bzr1355-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 06 Mar 2011 00:07:03 -0500
openlp (1.9.4+bzr1355-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 06 Mar 2011 00:05:27 -0500
openlp (1.9.4+bzr1355-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 06 Mar 2011 00:03:17 -0500
openlp (1.9.4+bzr1350-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 05 Mar 2011 00:08:15 -0500
openlp (1.9.4+bzr1350-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 05 Mar 2011 00:06:40 -0500
openlp (1.9.4+bzr1350-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 05 Mar 2011 00:05:09 -0500
openlp (1.9.4+bzr1350-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 05 Mar 2011 00:03:14 -0500
openlp (1.9.4+bzr1347-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Fri, 04 Mar 2011 00:04:49 -0500
openlp (1.9.4+bzr1347-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Fri, 04 Mar 2011 00:04:15 -0500
openlp (1.9.4+bzr1347-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Fri, 04 Mar 2011 00:03:34 -0500
openlp (1.9.4+bzr1347-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Fri, 04 Mar 2011 00:02:43 -0500
openlp (1.9.4+bzr1344-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Thu, 03 Mar 2011 00:03:56 -0500
openlp (1.9.4+bzr1344-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Thu, 03 Mar 2011 00:03:30 -0500
openlp (1.9.4+bzr1344-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Thu, 03 Mar 2011 00:03:05 -0500
openlp (1.9.4+bzr1344-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Thu, 03 Mar 2011 00:02:26 -0500
openlp (1.9.4+bzr1342-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Tue, 01 Mar 2011 00:03:44 -0500
openlp (1.9.4+bzr1342-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Tue, 01 Mar 2011 00:03:28 -0500
openlp (1.9.4+bzr1342-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Tue, 01 Mar 2011 00:03:03 -0500
openlp (1.9.4+bzr1342-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Tue, 01 Mar 2011 00:02:28 -0500
openlp (1.9.4+bzr1341-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 27 Feb 2011 00:04:05 -0500
openlp (1.9.4+bzr1341-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 27 Feb 2011 00:03:48 -0500
openlp (1.9.4+bzr1341-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 27 Feb 2011 00:03:20 -0500
openlp (1.9.4+bzr1341-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 27 Feb 2011 00:02:34 -0500
openlp (1.9.4+bzr1337-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 26 Feb 2011 00:04:02 -0500
openlp (1.9.4+bzr1337-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 26 Feb 2011 00:03:44 -0500
openlp (1.9.4+bzr1337-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 26 Feb 2011 00:03:18 -0500
openlp (1.9.4+bzr1337-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 26 Feb 2011 00:02:32 -0500
openlp (1.9.4+bzr1332-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Fri, 25 Feb 2011 00:04:00 -0500
openlp (1.9.4+bzr1332-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Fri, 25 Feb 2011 00:03:41 -0500
openlp (1.9.4+bzr1332-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Fri, 25 Feb 2011 00:03:16 -0500
openlp (1.9.4+bzr1332-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Fri, 25 Feb 2011 00:02:36 -0500
openlp (1.9.4+bzr1328-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Thu, 24 Feb 2011 00:03:47 -0500
openlp (1.9.4+bzr1328-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Thu, 24 Feb 2011 00:03:31 -0500
openlp (1.9.4+bzr1328-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Thu, 24 Feb 2011 00:03:07 -0500
openlp (1.9.4+bzr1328-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Thu, 24 Feb 2011 00:02:28 -0500
openlp (1.9.4+bzr1324-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Wed, 23 Feb 2011 00:03:48 -0500
openlp (1.9.4+bzr1324-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Wed, 23 Feb 2011 00:03:33 -0500
openlp (1.9.4+bzr1324-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Wed, 23 Feb 2011 00:03:08 -0500
openlp (1.9.4+bzr1324-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Wed, 23 Feb 2011 00:02:28 -0500
openlp (1.9.4+bzr1322-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Tue, 22 Feb 2011 00:04:06 -0500
openlp (1.9.4+bzr1322-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Tue, 22 Feb 2011 00:03:52 -0500
openlp (1.9.4+bzr1322-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Tue, 22 Feb 2011 00:03:28 -0500
openlp (1.9.4+bzr1322-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Tue, 22 Feb 2011 00:02:42 -0500
openlp (1.9.4+bzr1320-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Mon, 21 Feb 2011 00:03:59 -0500
openlp (1.9.4+bzr1320-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Mon, 21 Feb 2011 00:03:45 -0500
openlp (1.9.4+bzr1320-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Mon, 21 Feb 2011 00:03:21 -0500
openlp (1.9.4+bzr1320-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Mon, 21 Feb 2011 00:02:41 -0500
openlp (1.9.4+bzr1316-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 20 Feb 2011 05:32:08 -0500
openlp (1.9.4+bzr1316-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 20 Feb 2011 05:31:51 -0500
openlp (1.9.4+bzr1316-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 20 Feb 2011 05:31:28 -0500
openlp (1.9.4+bzr1316-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sun, 20 Feb 2011 05:30:49 -0500
openlp (1.9.4+bzr1315-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 16:24:12 -0500
openlp (1.9.4+bzr1315-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 16:23:51 -0500
openlp (1.9.4+bzr1315-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 16:23:28 -0500
openlp (1.9.4+bzr1315-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 16:22:49 -0500
openlp (1.9.4+bzr1314-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 15:35:36 -0500
openlp (1.9.4+bzr1314-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 15:35:21 -0500
openlp (1.9.4+bzr1314-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 15:34:53 -0500
openlp (1.9.4+bzr1314-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 15:34:10 -0500
openlp (1.9.4+bzr1313-0ubuntu1~natty1) natty; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 13:58:14 -0500
openlp (1.9.4+bzr1313-0ubuntu1~maverick1) maverick; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 13:57:40 -0500
openlp (1.9.4+bzr1313-0ubuntu1~lucid1) lucid; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 13:57:11 -0500
openlp (1.9.4+bzr1313-0ubuntu1~karmic1) karmic; urgency=low
* Autobuild
-- <openlp@projecthq.biz> Sat, 19 Feb 2011 13:56:17 -0500
openlp (0.0.0+bzr664-0ubuntu1) karmic; urgency=low
* Initial release
-- Michael Gorven <michael@gorven.za.net> Fri, 06 Nov 2009 09:46:40 +0200

View File

@ -0,0 +1 @@
5

View File

@ -0,0 +1,19 @@
Source: openlp
Section: python
Priority: extra
Maintainer: OpenLP Developers <openlp-dev@lists.launchpad.net>
Build-Depends: cdbs, debhelper (>= 5), python-setuptools, python-support,
python, qt4-dev-tools
Standards-Version: 3.8.3
Homepage: http://openlp.org/
Package: openlp
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-qt4,
python-qt4-phonon, python-sqlalchemy, python-chardet, python-beautifulsoup,
python-lxml, python-sqlite, python-enchant
Conflicts: python-openlp
Description: Church lyrics projection application
OpenLP is free church presentation software, or lyrics projection software,
used to display slides of songs, Bible verses, videos, images, and even
presentations for church worship using a computer and a data projector.

View File

@ -0,0 +1,10 @@
Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat
Upstream-Name: OpenLP
Upstream-Maintainer: OpenLP Developers <openlp-dev@lists.launchpad.net>
Upstream-Source: http://openlp.org/
Files: *
Copyright: (c) 2008-2009 Raoul Snyman
License: GPL-2
X-Comment: On Debian GNU/Linux systems, the complete text of the
GPL-2 License can be found in /usr/share/common-licenses/GPL-2

View File

@ -0,0 +1 @@
documentation

View File

@ -0,0 +1 @@
resources/openlp.desktop /usr/share/applications

View File

@ -0,0 +1 @@
2

View File

@ -0,0 +1 @@
2.5-

21
resources/debian/debian/rules Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/make -f
DEB_PYTHON_SYSTEM := pysupport
DEB_MAKE_BUILD_TARGET := build
DEB_MAKE_INSTALL_TARGET :=
DEB_MAKE_CLEAN_TARGET :=
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk
include /usr/share/cdbs/1/class/makefile.mk
binary-post-install/openlp::
for SIZE in 16x16 32x32 48x48 64x64 128x128 256x256; do \
mkdir -p debian/openlp/usr/share/icons/hicolor/$$SIZE/apps && \
cp resources/images/openlp-logo-$$SIZE.png debian/openlp/usr/share/icons/hicolor/$$SIZE/apps/openlp.png; \
done
mkdir -p debian/openlp/usr/share/icons/hicolor/scalable/apps && \
cp resources/images/openlp-logo.svg debian/openlp/usr/share/icons/hicolor/scalable/apps/openlp.svg
cd debian/openlp/usr/bin/ && mv openlp.pyw openlp

View File

@ -0,0 +1,375 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FirstTimeWizard</class>
<widget class="QWizard" name="FirstTimeWizard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<height>386</height>
</rect>
</property>
<property name="windowTitle">
<string>First Time Wizard</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<property name="wizardStyle">
<enum>QWizard::ModernStyle</enum>
</property>
<property name="options">
<set>QWizard::IndependentPages|QWizard::NoBackButtonOnStartPage</set>
</property>
<widget class="QWizardPage" name="welcomePage">
<property name="title">
<string/>
</property>
<property name="subTitle">
<string/>
</property>
<layout class="QHBoxLayout" name="welcomeLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="importBibleImage">
<property name="minimumSize">
<size>
<width>163</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>163</width>
<height>16777215</height>
</size>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images/openlp-2.qrc">:/wizards/wizard_importbible.bmp</pixmap>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="welcomePageLayout">
<property name="spacing">
<number>8</number>
</property>
<item>
<widget class="QLabel" name="titleLabel">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;Welcome to the First Time Wizard&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="welcomeTopSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="informationLabel">
<property name="text">
<string>This wizard will help you to configure OpenLP for initial use . Click the next button below to start the process of selection your initial options. </string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer name="welcomeBottomSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="PluginPagePage">
<property name="title">
<string>Activate required Plugins</string>
</property>
<property name="subTitle">
<string>Select the Plugins you wish to use. </string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="songsCheckBox">
<property name="text">
<string>Songs</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="customCheckBox">
<property name="text">
<string>Custom Text</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="bibleCheckBox">
<property name="text">
<string>Bible</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="imageCheckBox">
<property name="text">
<string>Images</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="presentationCheckBox">
<property name="text">
<string>Presentations</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mediaCheckBox">
<property name="text">
<string>Media (Audio and Video)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="remoteCheckBox">
<property name="text">
<string>Allow remote access</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="songUsageCheckBox">
<property name="text">
<string>Monitor Song Usage</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="alertCheckBox">
<property name="text">
<string>Allow Alerts</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="downloadDefaultsPage">
<property name="title">
<string>Download Samples from OpenLP.org</string>
</property>
<property name="subTitle">
<string>Select samples to downlaod and install for use.</string>
</property>
<widget class="QLabel" name="noInternetLabel">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>461</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>No Internet connection found so unable to download any default files.</string>
</property>
</widget>
<widget class="QGroupBox" name="internetGroupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>0</y>
<width>501</width>
<height>281</height>
</rect>
</property>
<property name="title">
<string>Download Example Files</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTreeWidget" name="selectionTreeWidget">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWizardPage" name="DefaultsPage">
<property name="title">
<string>Default Settings</string>
</property>
<property name="subTitle">
<string>Set up default values to be used by OpenLP</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>491</width>
<height>113</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="displaySelectionLabel">
<property name="text">
<string>Default output display</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="displaySelectionComboBox">
<property name="editable">
<bool>false</bool>
</property>
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="themeSelectionLabel">
<property name="text">
<string>Select the default Theme</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="themeSelectionComboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="messageLabel">
<property name="geometry">
<rect>
<x>60</x>
<y>160</y>
<width>471</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Press Finish to apply all you changes and start OpenLP</string>
</property>
</widget>
<widget class="QLabel" name="updateLabel">
<property name="geometry">
<rect>
<x>60</x>
<y>220</y>
<width>351</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,30 @@
# Copyright 1999-2009 Gentoo Foundation
# Copyright 2010 Jaak Ristioja
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=2
RESTRICT_PYTHON_ABIS="3.*"
inherit python
DESCRIPTION="Free church presentation software"
HOMEPAGE="http://openlp.org/"
SRC_URI="mirror://sourceforge/${PN}/${PV}/OpenLP-${PV}-src.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sparc x86 x86-fbsd x86-freebsd amd64-linux x86-linux x86-macos x86-solaris"
RDEPEND=">=dev-lang/python-2.5.0
dev-python/beautifulsoup
dev-python/chardet
dev-python/lxml
dev-python/pyenchant
dev-python/PyQt4[X,multimedia]
dev-python/sqlalchemy"
DEPEND="${RDEPEND}"
PYTHON_DEPEND="2:2.5"
PYTHON_MODNAME="openlp"
S=${WORKDIR}/OpenLP-${PV}-src

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4699
resources/i18n/fr.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4691
resources/i18n/id.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4694
resources/i18n/ru.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

32
resources/osx/Info.plist.master Executable file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>org.openlp</string>
<key>CFBundleShortVersionString</key>
<string>%(openlp_version)s</string>
<key>CFBundleVersion</key>
<string>%(openlp_version)s</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDisplayName</key>
<string>%(openlp_appname)s</string>
<key>CFBundleIconFile</key>
<string>openlp-logo-with-text.icns</string>
<key>CFBundleExecutable</key>
<string>MacOS/openlp</string>
<key>CFBundleName</key>
<string>%(openlp_appname)s</string>
<key>CFBundleGetInfoString</string>
<string>%(openlp_appname)s %(openlp_version)s</string>
<key>LSHasLocalizedDisplayName</string>
<false/>
<key>NSAppleScriptEnabled</key>
<false/>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSBackgroundOnly</key>
<false/>
</dict>
</plist>

28
resources/osx/Makefile Normal file
View File

@ -0,0 +1,28 @@
all:
python build.py -c openlp.cfg
view:
python build.py -c openlp.cfg --package-view --compress-view
package:
python build.py -c openlp.cfg --package --package-view
bundle:
python build.py -c openlp.cfg --compress --compress-view
clean:
# remove old configuration files
rm -f openlp.spec
rm -f Info.plist
rm -f .version
# remove old build artifacts
rm -rf build
rm -rf dist
rm -rf Macopenlp.app
rm -rf OpenLP.app
rm -f warnopenlp.txt
rm -f *dmg

View File

@ -0,0 +1,74 @@
on saveImageWithItselfAsIcon(icon_image_file)
-- save icon_image_file with itself as icon
set icon_image_file_string to icon_image_file as string
tell application "Image Events"
launch
set icon_image to open file icon_image_file_string
save icon_image with icon
close icon_image
end tell
end saveImageWithItselfAsIcon
on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder)
tell application "Finder" to set f to aFileOrFolderWithIcon as alias
-- grab the file's icon
my CopyOrPaste(f, "c")
-- now the icon is in the clipboard
tell application "Finder" to set c to aFileOrFolder as alias
my CopyOrPaste(result, "v")
end copyIconOfTo
on CopyOrPaste(i, cv)
tell application "Finder"
activate
open information window of i
end tell
tell application "System Events" to tell process "Finder" to tell window 1
keystroke tab -- select icon button
keystroke (cv & "w") using command down (* (copy or paste) + close window *)
end tell -- window 1 then process Finder then System Events
end CopyOrPaste
on run
set icon_image_file to POSIX file "%s" as alias
set dmg_file to POSIX file "/Volumes/%s" as alias
my saveImageWithItselfAsIcon(icon_image_file)
-- wait for virus scanner
delay 2
my copyIconOfTo(icon_image_file, dmg_file)
tell application "Finder"
tell disk "%s"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 1100, 500}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128
set background picture of theViewOptions to file ".installer-background.png"
if not exists file "Applications" then
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
end if
delay 5
set position of item "%s" of container window to {160, 200}
set position of item ".Trashes" of container window to {100, 500}
set position of item ".installer-background.png" of container window to {200, 500}
set position of item ".DS_Store" of container window to {400, 500}
set position of item "Applications" of container window to {550, 200}
set position of item ".VolumeIcon.icns" of container window to {500, 500}
set position of item ".fseventsd" of container window to {300, 500}
if exists POSIX file ".SymAVx86QSFile" then
set position of item ".SymAVx86QSFile" of container window to {600, 500}
end if
open
close
update without registering applications
-- wait until the virus scan completes
delay 5
-- eject
end tell
end tell
end run

View File

@ -0,0 +1,73 @@
on saveImageWithItselfAsIcon(icon_image_file)
-- save icon_image_file with itself as icon
set icon_image_file_string to icon_image_file as string
tell application "Image Events"
launch
set icon_image to open file icon_image_file_string
save icon_image with icon
close icon_image
end tell
end saveImageWithItselfAsIcon
on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder)
tell application "Finder" to set f to aFileOrFolderWithIcon as alias
-- grab the file's icon
my CopyOrPaste(f, "c")
-- now the icon is in the clipboard
tell application "Finder" to set c to aFileOrFolder as alias
my CopyOrPaste(result, "v")
end copyIconOfTo
on CopyOrPaste(i, cv)
tell application "Finder"
activate
set infoWindow to open information window of i
set infoWindowName to name of infoWindow
end tell
tell application "System Events" to tell process "Finder" to tell window infoWindowName
keystroke tab -- select icon button
keystroke (cv & "w") using command down (* (copy or paste) + close window *)
end tell -- window 1 then process Finder then System Events
end CopyOrPaste
on run
set icon_image_file to POSIX file "%s" as alias
set dmg_file to POSIX file "/Volumes/%s" as alias
my saveImageWithItselfAsIcon(icon_image_file)
-- wait for virus scanner
delay 2
my copyIconOfTo(icon_image_file, dmg_file)
tell application "Finder"
tell disk "%s"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 1100, 500}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128
set background picture of theViewOptions to file ".installer-background.png"
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
delay 5
set position of item "%s" of container window to {160, 200}
set position of item ".Trashes" of container window to {100, 500}
set position of item ".installer-background.png" of container window to {200, 500}
set position of item ".DS_Store" of container window to {400, 500}
set position of item "Applications" of container window to {550, 200}
set position of item ".VolumeIcon.icns" of container window to {500, 500}
set position of item ".fseventsd" of container window to {300, 500}
if exists POSIX file ".SymAVx86QSFile" then
set position of item ".SymAVx86QSFile" of container window to {600, 500}
end if
open
close
update without registering applications
-- wait until the virus scan completes
delay 5
-- eject
end tell
end tell
end run

View File

@ -0,0 +1,40 @@
on saveImageWithItselfAsIcon(icon_image_file)
-- save icon_image_file with itself as icon
set icon_image_file_string to icon_image_file as string
tell application "Image Events"
launch
set icon_image to open file icon_image_file_string
save icon_image with icon
close icon_image
end tell
end saveImageWithItselfAsIcon
on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder)
tell application "Finder" to set f to aFileOrFolderWithIcon as alias
-- grab the file's icon
my CopyOrPaste(f, "c")
-- now the icon is in the clipboard
tell application "Finder" to set c to aFileOrFolder as alias
my CopyOrPaste(result, "v")
end copyIconOfTo
on CopyOrPaste(i, cv)
tell application "Finder"
activate
open information window of i
end tell
tell application "System Events" to tell process "Finder" to tell window 1
keystroke tab -- select icon button
keystroke (cv & "w") using command down (* (copy or paste) + close window *)
end tell -- window 1 then process Finder then System Events
end CopyOrPaste
on run
set icon_image_file to POSIX file "%s" as alias
set dmg_file to POSIX file "%s" as alias
my saveImageWithItselfAsIcon(icon_image_file)
-- wait for virus scanner
delay 2
my copyIconOfTo(icon_image_file, dmg_file)
end run

View File

@ -0,0 +1,41 @@
on saveImageWithItselfAsIcon(icon_image_file)
-- save icon_image_file with itself as icon
set icon_image_file_string to icon_image_file as string
tell application "Image Events"
launch
set icon_image to open file icon_image_file_string
save icon_image with icon
close icon_image
end tell
end saveImageWithItselfAsIcon
on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder)
tell application "Finder" to set f to aFileOrFolderWithIcon as alias
-- grab the file's icon
my CopyOrPaste(f, "c")
-- now the icon is in the clipboard
tell application "Finder" to set c to aFileOrFolder as alias
my CopyOrPaste(result, "v")
end copyIconOfTo
on CopyOrPaste(i, cv)
tell application "Finder"
activate
set infoWindow to open information window of i
set infoWindowName to name of infoWindow
end tell
tell application "System Events" to tell process "Finder" to tell window infoWindowName
keystroke tab -- select icon button
keystroke (cv & "w") using command down (* (copy or paste) + close window *)
end tell -- window 1 then process Finder then System Events
end CopyOrPaste
on run
set icon_image_file to POSIX file "%s" as alias
set dmg_file to POSIX file "%s" as alias
my saveImageWithItselfAsIcon(icon_image_file)
-- wait for virus scanner
delay 2
my copyIconOfTo(icon_image_file, dmg_file)
end run

412
resources/osx/build.py Normal file
View File

@ -0,0 +1,412 @@
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2011 Raoul Snyman #
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, #
# Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon #
# Tibble, Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################
"""
Mac OS X Build Script
---------------------
This script is used to build the OS X binary and the accompanying installer.
For this script to work out of the box, it depends on a number of things:
Python 2.6
This build script only works with Python 2.6.
PyQt4
You should already have this installed, OpenLP doesn't work without it.
The version the script expects is the packaged one available from River
Bank Computing.
PyInstaller
PyInstaller should be a checkout of revision 1355 of trunk, and in a
directory which is configured in the openlp.cfg. The revision is very
important as there is just included a fix for builds on OS X.
To install PyInstaller, first checkout trunk from Subversion. The
easiest way is to do a
svn co http://svn.pyinstaller.org/trunk
Then you need to copy the two hook-*.py files from the "pyinstaller"
subdirectory in OpenLP's "resources" directory into PyInstaller's
"hooks" directory.
openlp.cfg
The configuration file contains settings of the version string to include
in the bundle as well as directory and file settings for different
purposes (e.g. PyInstaller location or installer background image)
To start the build process do a
make
inside the resources/osx directory. The result should be a {openlp_dmgname}.dmg
file in the same directory. If something went wrong - this sometimes happen
with the graphical commands in the Apple script - do a
make clean
and start the build process again. If you want to execute only parts of the
build process you can specify different make targets
make view -- runs the Apple scripts to set the icons
make package -- creates the dmg file and copies the application files
make bundle -- compresses the dmg file and sets the dmg file icon
"""
import time
import os
import ConfigParser
import logging
import optparse
import sys
import platform
import re
import subprocess as subp
# set the script name
script_name = "build"
def build_application(settings, app_name_lower, app_dir):
logging.info('[%s] now building the app with pyinstaller at "%s"...',
script_name, settings['pyinstaller_basedir'])
result = os.system('python %s/pyinstaller.py openlp.spec' \
% settings['pyinstaller_basedir'])
if (result != 0):
logging.error('[%s] The pyinstaller build reported an error, cannot \
continue!', script_name)
sys.exit(1)
logging.info('[%s] copying the qt_menu files...', script_name)
# see http://www.pyinstaller.org/ticket/157
result = os.system('cp -R %(qt_menu_directory)s \
%(application_directory)s/Contents/Resources' \
% { 'qt_menu_directory' : settings['qt_menu_basedir'],
'application_directory' : app_dir })
if (result != 0):
logging.error('[%s] could not copy the qt_menu files, cannot \
continue!', script_name)
sys.exit(1)
dist_folder = os.getcwd() + '/dist/' + app_name_lower
logging.info('[%s] copying the new plugins...', script_name)
result = os.system('cp -R %(openlp_directory)s/openlp/plugins \
%(application_directory)s/Contents/MacOS' \
% { 'openlp_directory' : settings['openlp_basedir'],
'application_directory' : app_dir })
if (result != 0):
logging.error('[%s] could not copy plugins, dmg creation failed!',
script_name)
sys.exit(1)
logging.info('[%s] copying the icons to the resource directory...',
script_name)
result = os.system('cp %(icon_file)s \
%(application_directory)s/Contents/Resources' \
% { 'icon_file' : settings['openlp_icon_file'],
'application_directory' : app_dir })
if (result != 0):
logging.error('[%s] could not copy the icon, dmg creation failed!',
script_name)
sys.exit(1)
logging.info('[%s] copying the version file...', script_name)
result = os.system('CpMac %s/.version %s/Contents/MacOS' % (os.getcwd(),
app_dir))
if (result != 0):
logging.error('[%s] could not copy the version file, dmg creation \
failed!', script_name)
sys.exit(1)
logging.info('[%s] copying the new Info.plist...', script_name)
result = os.system('cp %(target_directory)s/Info.plist \
%(application_directory)s/Contents' \
% { 'target_directory' : os.getcwd(),
'application_directory' : app_dir })
if (result != 0):
logging.error('[%s] could not copy the info file, dmg creation \
failed!', script_name)
sys.exit(1)
def deploy_qt(settings):
logging.info('[%s] running mac deploy qt on %s.app...', script_name,
settings['openlp_appname']);
result = os.system('macdeployqt %s.app' % settings['openlp_appname']);
if (result != 0):
logging.error('[%s] could not create dmg file!', script_name)
sys.exit(1)
def create_dmg(settings):
logging.info('[%s] creating the dmg...', script_name)
dmg_file = os.getcwd() + '/' + settings['openlp_dmgname'] + '.dmg'
result = os.system('hdiutil create %(dmg_file)s~ -ov -megabytes \
%(vol_size)s -fs HFS+ -volname %(vol_name)s' \
% { 'dmg_file' : dmg_file,
'vol_size' : '250',
'vol_name' : settings['openlp_appname'] })
if (result != 0):
logging.error('[%s] could not create dmg file!', script_name)
sys.exit(1)
logging.info('[%s] mounting the dmg file...', script_name)
output = subp.Popen(["hdiutil", "attach", dmg_file + "~.dmg"],
stdout=subp.PIPE).communicate()[0]
logging.debug(output)
p = re.compile('Apple_HFS\s+(.+?)\s*$')
result = p.search(output, re.M)
volume_basedir = ''
if result:
volume_basedir = result.group(1)
else:
logging.error('could not mount dmg file, cannot continue!')
sys.exit(1)
logging.info('[%s] copying the app (from %s) to the dmg (at %s)...',
script_name, app_dir, volume_basedir)
result = os.system('CpMac -r %s %s' \
% ( app_dir, volume_basedir ))
if (result != 0):
logging.error('[%s] could not copy application, dmg creation failed!',
script_name)
sys.exit(1)
logging.info('[%s] copying the background image...', script_name)
# os.mkdir(volume_basedir + '/.background')
result = os.system('CpMac %s %s'
% (settings['installer_backgroundimage_file'],
volume_basedir + '/.installer-background.png'))
if (result != 0):
logging.error('[%s] could not copy the background image, dmg creation\
failed!', script_name)
sys.exit(1)
return (volume_basedir, dmg_file)
def unmount_dmg(settings, volume_basedir):
logging.info('[%s] unmounting the dmg...', script_name)
result = os.system('hdiutil detach %s' % volume_basedir)
if (result != 0):
logging.error('[%s] could not unmount the dmg file, dmg creation \
failed!', script_name)
sys.exit(1)
def compress_view(settings, seticon_scriptname, dmg_file):
logging.info('[%s] setting icon of the dmg file...', script_name)
try:
f = open(seticon_scriptname)
p = subp.Popen(["osascript"], stdin=subp.PIPE)
p.communicate(f.read() % ((os.getcwd() + '/' +
settings['openlp_dmg_icon_file']), dmg_file))
f.close()
result = p.returncode
if (result != 0):
logging.error('[%s] could not set the icon to the dmg file, \
dmg creation failed!', script_name)
sys.exit(1)
except IOError, e:
logging.error('[%s] could not adjust the view (%s), dmg creation \
failed!', script_name, e)
sys.exit(1)
except OSError, e:
logging.error('[%s] could not set the icon to the dmg file(%s), \
dmg creation failed!', script_name, e)
sys.exit(1)
def adjust_package_view(settings, adjustview_scriptname):
logging.info('[%s] making adjustments to the view...', script_name)
try:
f = open(adjustview_scriptname)
p = subp.Popen(["osascript"], stdin=subp.PIPE)
p.communicate(f.read() % ((os.getcwd() + '/' + \
settings['openlp_dmg_icon_file']),
settings['openlp_appname'],
settings['openlp_appname'],
settings['openlp_appname']))
f.close()
result = p.returncode
if (result != 0):
logging.error('[%s] could not adjust the view, dmg creation \
failed!', script_name)
sys.exit(1)
except IOError, e:
logging.error('[%s] could not adjust the view (%s), dmg creation \
failed!', script_name, e)
sys.exit(1)
except OSError, e:
logging.error('[%s] could not adjust the view (%s), dmg creation \
failed!', script_name, e)
sys.exit(1)
def compress_dmg(settings):
logging.info('[%s] compress the dmg file...', script_name)
result = os.system('hdiutil convert %s~.dmg -format UDZO \
-imagekey zlib-level=9 -o %s' \
% (dmg_file, dmg_file))
if (result != 0):
logging.error('[%s] could not compress the dmg file, dmg creation \
failed!', script_name)
sys.exit(1)
if __name__ == '__main__':
# set default actions
do_build = True
do_compress_view = True
do_package_view = True
do_create_dmg = True
do_compress_dmg = True
do_deploy_qt = True
parser = optparse.OptionParser()
parser.add_option('-c', '--config', dest='config', help='config file',
metavar='CONFIG')
parser.add_option('-v', '--package-view', dest='package_view',
help='triggers view adjustment scripts for package',
metavar='PACKAGEVIEWONLY', action='store_true', default=False)
parser.add_option('-y', '--compress-view', dest='compress_view',
help='triggers view adjustment scripts for dmg',
metavar='COMPRESSVIEWONLY', action='store_true', default=False)
parser.add_option('-p', '--package', dest='package',
help='package application folder to dmg', metavar='PACKAGE',
action='store_true', default=False)
parser.add_option('-z', '--compress', dest='compress',
help='compresses the existing dmg', metavar='COMPRESS',
action='store_true', default=False)
parser.add_option('-b', '--basedir', dest='basedir',
help='volume basedir like /Volumes/OpenLP', metavar='BASEDIR',
default='/Volumes/OpenLP')
(options, args) = parser.parse_args()
# if an option is set, false all
if (options.package_view is True or options.compress_view is True
or options.package is True or options.compress is True):
do_build = False
do_deploy_qt = False
do_package_view = options.package_view
do_compress_view = options.compress_view
do_create_dmg = options.package
do_compress_dmg = options.compress
if not options.config:
parser.error('option --config|-c is required')
logHandler = logging.StreamHandler()
logHandler.setFormatter(logging.Formatter(
'%(asctime)s %(levelname)-8s %(message)s',
'%a, %d %b %Y %H:%M:%S'))
logging.getLogger().addHandler(logHandler)
logging.getLogger().setLevel(logging.DEBUG)
config = ConfigParser.RawConfigParser()
config.readfp(open(options.config, 'r'))
if not config.has_section('openlp'):
logging.error('[%s] config file "%s" lacks an [openlp] section',
script_name, options.config)
sys.exit(1)
if not sys.platform == "darwin":
logging.error('[%s] this script only works on Macintosh OS X systems,'
+ 'not on %s', script_name, sys.platform)
sys.exit(1)
version = platform.mac_ver()[0]
# we only need the differenciation between leopard and snow leopard
if version.startswith("10.6"):
SNOWLEOPARD = True
logging.info('[%s] using snow leopard scripts (version = %s)',
script_name, version)
adjustview_scriptname = "applescript-adjustview-10-6.master"
seticon_scriptname = "applescript-seticon-10-6.master"
else:
SNOWLEOPARD = False
logging.info('[%s] using leopard scripts (version = %s)', script_name,
version)
adjustview_scriptname = "applescript-adjustview-10-5.master"
seticon_scriptname = "applescript-seticon-10-5.master"
if not os.path.isfile(adjustview_scriptname) \
or not os.path.isfile(seticon_scriptname):
logging.error('[%s] could not find apple scripts for given OS X '
+ 'version %s', script_name, version)
sys.exit(1)
settings = dict()
for k in config.options('openlp'):
settings[k] = config.get('openlp', k)
# prepare the configuration files
os.system('python expander.py --config %(config_file)s \
--template openlp.spec.master \
--expandto %(target_directory)s/openlp.spec' \
% { 'config_file' : options.config, 'target_directory' : os.getcwd() })
os.system('python expander.py --config %(config_file)s \
--template Info.plist.master \
--expandto %(target_directory)s/Info.plist' \
% { 'config_file' : options.config, 'target_directory' : os.getcwd() })
os.system('python expander.py --config %(config_file)s \
--template version.master \
--expandto %(target_directory)s/.version' \
% { 'config_file' : options.config, 'target_directory' : os.getcwd() })
# prepare variables
app_name_lower = settings['openlp_appname'].lower()
app_dir = os.getcwd() + '/' + settings['openlp_appname'] + '.app'
# if the view option is set, skip the building steps
if (do_build is True):
build_application(settings, app_name_lower, app_dir)
if (do_deploy_qt is True):
deploy_qt(settings)
if (do_create_dmg is True):
(volume_basedir, dmg_file) = create_dmg(settings)
else:
# setting base dir
volume_basedir = options.basedir
dmg_file = os.getcwd() + '/' + settings['openlp_dmgname'] + '.dmg'
if (do_package_view is True):
adjust_package_view(settings, adjustview_scriptname)
if (do_create_dmg is True):
unmount_dmg(settings, volume_basedir)
if (do_compress_dmg is True):
compress_dmg(settings)
if (do_compress_view is True):
compress_view(settings, seticon_scriptname, dmg_file)
if (do_compress_dmg is True):
logging.info('[%s] finished creating dmg file, resulting file is "%s"',
script_name, dmg_file)

202
resources/osx/expander.py Executable file
View File

@ -0,0 +1,202 @@
#!/usr/bin/python
# -*- encoding: utf-8 -*-
# TODOs:
# - defaults for non-supplied expansions:
# template contains
import ConfigParser
import logging
import optparse
import os
import re
import sys
# variable expansion:
# - %(dog)s --- normal python expansion
# - %(dog%)s --- no python expansion, leave as is (stripping the trailing %)
# - %(dog:cat) --- if there is an expansion for dog, dog will be used;
# otherwise if cat exists cat will be used
# - %(dog=cat) --- if there is an expansion for dog, dog will be used;
# otherwise "cat" will be used
# re_conf = re.compile(r'(?<!%)%\((?P<key>[^\(]+?)\)s')
re_conf = re.compile(r'(?P<verbatim>%?)%\((?P<key>[^+=:&\)]+?)'
+ '(?:(?P<kind>[+=:&])(?P<default>[^\)]+))?\)(?P<type>s|d)')
def expand_variable(match, expansions, errors):
key = match.group('key')
kind = match.group('kind')
default = match.group('default')
typ = match.group('type')
verbatim = match.group('verbatim')
if verbatim:
return match.group(0)[1:]
# literal default
if kind == '=':
if key in expansions:
return expansions[key]
return default
# variable default
if kind == ':' and default in expansions:
return expansions[default]
if kind == '+' and default in expansions:
if key in expansions:
key = expansions[key]
if typ == 's':
return '%s%s' % (key, expansions[default])
if typ == 'd':
try:
return str(int(key) + int(expansions[default]))
except:
pass
if kind == '&' and default in expansions:
if typ == 's':
return '%s%s' % (key, expansions[default])
if typ == 'd':
try:
return str(int(key) + int(expansions[default]))
except:
pass
if key in expansions:
return expansions[key]
if not match.group(0) in errors:
errors.append(match.group(0))
return None
options = None
if __name__ == '__main__':
# get config file
parser = optparse.OptionParser()
parser.add_option('-c', '--config', dest='config',
help='config file', metavar='CONFIG')
parser.add_option('-t', '--template', dest='template',
help='template file', metavar='TEMPLATE')
parser.add_option('-x', '--expandto', dest='expanded',
help='expanded file', metavar='EXPANDED')
parser.add_option('-e', '--echo', dest='echo',
help='echo variable', metavar='ECHOVAR')
(options, args) = parser.parse_args()
if not options.config:
parser.error('option --config|-c is required')
if not os.path.exists(options.config):
parser.error('config file "%s" does not exist' % options.config)
if not options.echo:
if not options.template:
parser.error('option --template|-t is required')
if not os.path.exists(options.template):
parser.error('template file "%s" does not exist' \
% options.template)
if not options.expanded:
parser.error('option --expandto|-e is required')
logHandler = logging.StreamHandler()
logHandler.setFormatter(logging.Formatter('%(asctime)s %(levelname)-8s '
+ ' %(message)s', '%a, %d %b %Y %H:%M:%S'))
logging.getLogger().addHandler(logHandler)
logging.getLogger().setLevel(logging.DEBUG)
config = ConfigParser.RawConfigParser()
config.readfp(open(options.config, 'r'))
if not config.has_section('openlp'):
logging.error('[expander] %s: config file "%s" lacks an [openlp] '
+ 'section', options.template, options.config)
expansions = dict()
for k in config.options('openlp'):
expansions[k] = config.get('openlp', k)
# commandline overrides?
for override in args:
if not '=' in override:
continue
(k, v) = override.split('=', 2)
expansions[k] = v
if options.echo:
if options.echo in expansions:
print expansions[options.echo]
sys.exit(0)
else:
sys.exit(1)
# closure to capture expansions and errors variable
errors = []
expanded = []
try:
# try to expand the template
line = 0
faulty = False
template = open(options.template, 'r')
raw = template.readlines()
template.close()
def _expand(m):
return expand_variable(m, expansions = expansions, errors = errors)
for l in raw:
line += 1
exp = re_conf.sub(_expand, l)
if errors:
for key in errors:
logging.error('[expander] %s: line %d: could not expand '
+ 'key "%s"', options.template, line, key)
faulty = True
errors = []
else:
expanded.append(exp)
if faulty:
sys.exit(1)
# successfully expanded template, now backup potentially existing
# target file
targetFile = options.expanded % expansions
if os.path.exists(targetFile):
if os.path.exists('%s~' % targetFile):
os.unlink('%s~' % targetFile)
os.rename(options.expanded, '%s~' % targetFile)
logging.info('[expander] %s: backed up existing target file "%s" '
+ 'to "%s"', options.template, targetFile,
'%s~' % options.expanded)
# make sure that target directory exists
targetDir = os.path.dirname(targetFile)
if not os.path.exists(targetDir):
os.makedirs(targetDir)
# write target file
try:
target = open(targetFile, 'w')
for exp in expanded:
target.write(exp)
target.close()
except Exception, e:
logging.error('[expander] %s: could not expand to "%s"',
options.template, options.expaned, e)
# copy over file access mode from template
mode = os.stat(options.template)
os.chmod(options.expanded, mode.st_mode)
logging.info('[expander] expanded "%s" to "%s"',
options.template, options.expanded)
except:
pass

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

11
resources/osx/openlp.cfg Executable file
View File

@ -0,0 +1,11 @@
[openlp]
openlp_appname = OpenLP
openlp_dmgname = OpenLP-1.9.4-bzrXXXX
openlp_version = XXXX
openlp_full_version = 1.9.4-latest
openlp_basedir = /Users/openlp/trunk
openlp_icon_file = openlp-logo-with-text.icns
openlp_dmg_icon_file = openlp-logo-420x420.png
installer_backgroundimage_file = installation-background.png
pyinstaller_basedir = /Users/openlp/pyinstaller/trunk
qt_menu_basedir = /Library/Frameworks/QtGui.framework/Versions/4/Resources/qt_menu.nib

View File

@ -0,0 +1,24 @@
# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), '%(openlp_basedir)s/openlp.pyw'],
pathex=['%(pyinstaller_basedir)s'], hookspath=['%(openlp_basedir)s/resources/pyinstaller'])
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
exclude_binaries=1,
name=os.path.join('build/pyi.darwin/openlp', 'openlp'),
debug=False,
strip=False,
upx=True,
console=1 )
coll = COLLECT( exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name=os.path.join('dist', 'openlp'))
import sys
if sys.platform.startswith("darwin"):
app = BUNDLE(coll,
name='%(openlp_appname)s.app',
version='%(openlp_version)s')

1
resources/osx/version.master Executable file
View File

@ -0,0 +1 @@
%(openlp_full_version)s