Fix up Wizard and add displays

This commit is contained in:
Tim Bentley 2011-03-04 19:02:00 +00:00
commit 21d4e7228a
51 changed files with 40834 additions and 30165 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
@ -152,7 +151,7 @@ class OpenLP(QtGui.QApplication):
log.info(u'Openlp version %s' % app_version[u'version'])
return app_version
def run(self):
def run(self, screens):
"""
Run the OpenLP application.
"""
@ -177,14 +176,6 @@ 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)
@ -276,18 +267,25 @@ def main():
# First time checks in settings
if QtCore.QSettings().value(
u'general/first time', QtCore.QVariant(True)).toBool():
FirstTimeLanguageForm().exec_()
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)
# Decide how many screens we have and their size
screens = ScreenList(app.desktop())
# First time checks in settings
if QtCore.QSettings().value(
u'general/first time', QtCore.QVariant(True)).toBool():
FirstTimeForm().exec_()
FirstTimeForm(screens).exec_()
if not options.no_error_form:
sys.excepthook = app.hookException
sys.exit()#(app.run())
sys.exit()#(app.run(screens))
if __name__ == u'__main__':
"""

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

@ -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
@ -187,11 +185,7 @@ class ServiceItem(object):
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(self.raw_footer)
def add_from_image(self, path, title):
"""
@ -204,8 +198,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

@ -106,38 +106,36 @@ 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'Scott "sguerrieri" Guerrieri',
u'Raoul "superfly" Snyman', u'Martin "mijiti" Thompson',
u'Jon "Meths" Tibble<']
contributors = [u'Meinert "m2j" Jordan', u'Andreas "googol" Preikschat',
u'Christian "crichter" Richter', u'Philip "Phill" Ridout',
u'Maikel Stuivenberg', u'Carsten "catini" Tingaard',
u'Frode "frodus" Woldsund']
testers = [u'Philip "Phill" Ridout', u'Wesley "wrst" Stout (lead)']
packagers = [u'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)']
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'
'Built With\n'
' Python: http://www.python.org/\n'
@ -155,31 +153,30 @@ 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)))
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 +546,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

@ -46,7 +46,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
"""
log.info(u'ThemeWizardForm loaded')
def __init__(self, parent=None):
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()
@ -56,7 +56,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.config.readfp(io.BytesIO(files))
QtGui.QWizard.__init__(self, parent)
self.setupUi(self)
#self.registerFields()
for screen in screens.get_screen_list():
self.displaySelectionComboBox.addItem(screen)
def exec_(self, edit=False):
"""

View File

@ -1,181 +1,224 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
# Form implementation generated from reading ui file 'firsttimewizard.ui'
#
# Created: Sun Feb 27 15:02:08 2011
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
###############################################################################
# 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
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
from openlp.core.lib import translate
class Ui_FirstTimeWizard(object):
def setupUi(self, FirstTimeWizard):
FirstTimeWizard.setObjectName(_fromUtf8("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)
FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages|
QtGui.QWizard.NoBackButtonOnStartPage)
self.welcomePage = QtGui.QWizardPage()
self.welcomePage.setTitle(_fromUtf8(""))
self.welcomePage.setSubTitle(_fromUtf8(""))
self.welcomePage.setObjectName(_fromUtf8("welcomePage"))
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(_fromUtf8("welcomeLayout"))
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(_fromUtf8(""))
self.importBibleImage.setPixmap(QtGui.QPixmap(_fromUtf8(":/wizards/wizard_importbible.bmp")))
self.importBibleImage.setText(u'')
self.importBibleImage.setPixmap(
QtGui.QPixmap(u':/wizards/wizard_importbible.bmp'))
self.importBibleImage.setIndent(0)
self.importBibleImage.setObjectName(_fromUtf8("importBibleImage"))
self.importBibleImage.setObjectName(u'importBibleImage')
self.welcomeLayout.addWidget(self.importBibleImage)
self.welcomePageLayout = QtGui.QVBoxLayout()
self.welcomePageLayout.setSpacing(8)
self.welcomePageLayout.setObjectName(_fromUtf8("welcomePageLayout"))
self.welcomePageLayout.setObjectName(u'welcomePageLayout')
self.titleLabel = QtGui.QLabel(self.welcomePage)
self.titleLabel.setObjectName(_fromUtf8("titleLabel"))
self.titleLabel.setObjectName(u'titleLabel')
self.welcomePageLayout.addWidget(self.titleLabel)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
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(_fromUtf8("informationLabel"))
self.informationLabel.setObjectName(u'informationLabel')
self.welcomePageLayout.addWidget(self.informationLabel)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
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(_fromUtf8("PluginPagePage"))
self.PluginPagePage.setObjectName(u'PluginPagePage')
self.verticalLayout_2 = QtGui.QVBoxLayout(self.PluginPagePage)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.verticalLayout_2.setObjectName(u'verticalLayout_2')
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.verticalLayout.setObjectName(u'verticalLayout')
self.songsCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.songsCheckBox.setChecked(True)
self.songsCheckBox.setObjectName(_fromUtf8("songsCheckBox"))
self.songsCheckBox.setObjectName(u'songsCheckBox')
self.verticalLayout.addWidget(self.songsCheckBox)
self.customCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.customCheckBox.setChecked(True)
self.customCheckBox.setObjectName(_fromUtf8("customCheckBox"))
self.customCheckBox.setObjectName(u'customCheckBox')
self.verticalLayout.addWidget(self.customCheckBox)
self.bibleCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.bibleCheckBox.setChecked(True)
self.bibleCheckBox.setObjectName(_fromUtf8("bibleCheckBox"))
self.bibleCheckBox.setObjectName(u'bibleCheckBox')
self.verticalLayout.addWidget(self.bibleCheckBox)
self.imageCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.imageCheckBox.setChecked(True)
self.imageCheckBox.setObjectName(_fromUtf8("imageCheckBox"))
self.imageCheckBox.setObjectName(u'imageCheckBox')
self.verticalLayout.addWidget(self.imageCheckBox)
self.presentationCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.presentationCheckBox.setChecked(True)
self.presentationCheckBox.setObjectName(_fromUtf8("presentationCheckBox"))
self.presentationCheckBox.setObjectName(u'presentationCheckBox')
self.verticalLayout.addWidget(self.presentationCheckBox)
self.mediaCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.mediaCheckBox.setChecked(True)
self.mediaCheckBox.setObjectName(_fromUtf8("mediaCheckBox"))
self.mediaCheckBox.setObjectName(u'mediaCheckBox')
self.verticalLayout.addWidget(self.mediaCheckBox)
self.remoteCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.remoteCheckBox.setObjectName(_fromUtf8("remoteCheckBox"))
self.remoteCheckBox.setObjectName(u'remoteCheckBox')
self.verticalLayout.addWidget(self.remoteCheckBox)
self.songUsageCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.songUsageCheckBox.setChecked(True)
self.songUsageCheckBox.setObjectName(_fromUtf8("songUsageCheckBox"))
self.songUsageCheckBox.setObjectName(u'songUsageCheckBox')
self.verticalLayout.addWidget(self.songUsageCheckBox)
self.alertCheckBox = QtGui.QCheckBox(self.PluginPagePage)
self.alertCheckBox.setChecked(True)
self.alertCheckBox.setObjectName(_fromUtf8("alertCheckBox"))
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(_fromUtf8("downloadDefaultsPage"))
self.downloadDefaultsPage.setObjectName(u'downloadDefaultsPage')
self.noInternetLabel = QtGui.QLabel(self.downloadDefaultsPage)
self.noInternetLabel.setGeometry(QtCore.QRect(20, 20, 461, 17))
self.noInternetLabel.setObjectName(_fromUtf8("noInternetLabel"))
self.noInternetLabel.setObjectName(u'noInternetLabel')
self.internetGroupBox = QtGui.QGroupBox(self.downloadDefaultsPage)
self.internetGroupBox.setGeometry(QtCore.QRect(20, 10, 501, 271))
self.internetGroupBox.setObjectName(_fromUtf8("internetGroupBox"))
self.internetGroupBox.setObjectName(u'internetGroupBox')
self.verticalLayout_4 = QtGui.QVBoxLayout(self.internetGroupBox)
self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
self.verticalLayout_4.setObjectName(u'verticalLayout_4')
self.selectionTreeWidget = QtGui.QTreeWidget(self.internetGroupBox)
self.selectionTreeWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.selectionTreeWidget.setProperty(_fromUtf8("showDropIndicator"), False)
self.selectionTreeWidget.setHorizontalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
self.selectionTreeWidget.setProperty(u'showDropIndicator', False)
self.selectionTreeWidget.setAlternatingRowColors(True)
#self.selectionTreeWidget.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
self.selectionTreeWidget.setObjectName(_fromUtf8("selectionTreeWidget"))
self.selectionTreeWidget.headerItem().setText(0, _fromUtf8("1"))
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(_fromUtf8("DefaultsPage"))
self.DefaultsPage.setObjectName(u'DefaultsPage')
self.layoutWidget = QtGui.QWidget(self.DefaultsPage)
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 491, 113))
self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
self.layoutWidget.setObjectName(u'layoutWidget')
self.gridLayout = QtGui.QGridLayout(self.layoutWidget)
self.gridLayout.setMargin(0)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.gridLayout.setObjectName(u'gridLayout')
self.displaySelectionLabel = QtGui.QLabel(self.layoutWidget)
self.displaySelectionLabel.setObjectName(_fromUtf8("displaySelectionLabel"))
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(_fromUtf8("displaySelectionComboBox"))
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(_fromUtf8("themeSelectionLabel"))
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(_fromUtf8("themeSelectionComboBox"))
self.themeSelectionComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToContents)
self.themeSelectionComboBox.setObjectName(u'themeSelectionComboBox')
self.gridLayout.addWidget(self.themeSelectionComboBox, 1, 1, 1, 1)
self.label = QtGui.QLabel(self.DefaultsPage)
self.label.setGeometry(QtCore.QRect(40, 190, 471, 17))
self.label.setObjectName(_fromUtf8("label"))
self.label.setObjectName(u'label')
FirstTimeWizard.addPage(self.DefaultsPage)
self.retranslateUi(FirstTimeWizard)
QtCore.QMetaObject.connectSlotsByName(FirstTimeWizard)
QtCore.QMetaObject.connectSlotsByName(OpenLP.FirstTimeWizard)
def retranslateUi(self, FirstTimeWizard):
FirstTimeWizard.setWindowTitle(QtGui.QApplication.translate("FirstTimeWizard", "First Time Wizard", None, QtGui.QApplication.UnicodeUTF8))
self.titleLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt; font-weight:600;\">Welcome to the First Time Wizard</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.informationLabel.setText(QtGui.QApplication.translate("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. ", None, QtGui.QApplication.UnicodeUTF8))
self.PluginPagePage.setTitle(QtGui.QApplication.translate("FirstTimeWizard", "Activate required Plugins", None, QtGui.QApplication.UnicodeUTF8))
self.PluginPagePage.setSubTitle(QtGui.QApplication.translate("FirstTimeWizard", "Select the Plugins you wish to use. ", None, QtGui.QApplication.UnicodeUTF8))
self.songsCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Songs", None, QtGui.QApplication.UnicodeUTF8))
self.customCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Custom Text", None, QtGui.QApplication.UnicodeUTF8))
self.bibleCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Bible", None, QtGui.QApplication.UnicodeUTF8))
self.imageCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Images", None, QtGui.QApplication.UnicodeUTF8))
self.presentationCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Presentations", None, QtGui.QApplication.UnicodeUTF8))
self.mediaCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Media (Audio and Video)", None, QtGui.QApplication.UnicodeUTF8))
self.remoteCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Allow remote access", None, QtGui.QApplication.UnicodeUTF8))
self.songUsageCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Monitor Song Usage", None, QtGui.QApplication.UnicodeUTF8))
self.alertCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Allow Alerts", None, QtGui.QApplication.UnicodeUTF8))
self.downloadDefaultsPage.setTitle(QtGui.QApplication.translate("FirstTimeWizard", "Download Samples from OpenLP.org", None, QtGui.QApplication.UnicodeUTF8))
self.downloadDefaultsPage.setSubTitle(QtGui.QApplication.translate("FirstTimeWizard", "Select samples to downlaod and install for use.", None, QtGui.QApplication.UnicodeUTF8))
self.noInternetLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "No Internet connection found so unable to download any default files.", None, QtGui.QApplication.UnicodeUTF8))
self.internetGroupBox.setTitle(QtGui.QApplication.translate("FirstTimeWizard", "Download Example Files", None, QtGui.QApplication.UnicodeUTF8))
self.DefaultsPage.setTitle(QtGui.QApplication.translate("FirstTimeWizard", "Default Settings", None, QtGui.QApplication.UnicodeUTF8))
self.DefaultsPage.setSubTitle(QtGui.QApplication.translate("FirstTimeWizard", "Set up default values to be used by OpenLP", None, QtGui.QApplication.UnicodeUTF8))
self.displaySelectionLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "Default output display", None, QtGui.QApplication.UnicodeUTF8))
self.themeSelectionLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "Select the default Theme", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("FirstTimeWizard", "Press Finish to apply all you changes and start OpenLP", None, QtGui.QApplication.UnicodeUTF8))
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.label.setText(translate('OpenLP.FirstTimeWizard',
'Press Finish to apply all you changes and start OpenLP'))

View File

@ -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

@ -158,6 +158,7 @@ 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()
@ -434,15 +435,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):
"""
@ -492,6 +485,16 @@ class MainDisplay(DisplayWidget):
# Trigger actions when display is active again
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):
"""

View File

@ -650,8 +650,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

@ -624,6 +624,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))
@ -857,6 +862,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,

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

@ -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,21 +221,14 @@ 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
@ -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)

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,7 @@ 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

@ -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'',

View File

@ -338,37 +338,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="languageLabel">
<property name="text">
<string>Select default language</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="LanguageComboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="autoLanguageCheckBox">
<property name="text">
<string>Auto Language</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="label">
<widget class="QLabel" name="messageLabel">
<property name="geometry">
<rect>
<x>40</x>
<y>190</y>
<x>60</x>
<y>160</y>
<width>471</width>
<height>17</height>
</rect>
@ -377,6 +353,19 @@ p, li { white-space: pre-wrap; }
<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>

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

4832
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

4825
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

4828
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