Head r1408

This commit is contained in:
Jon Tibble 2011-03-20 00:23:44 +00:00
commit 4f1a713f3b
9 changed files with 76 additions and 18 deletions

View File

@ -4,6 +4,7 @@ recursive-include openlp *.csv
recursive-include openlp *.html recursive-include openlp *.html
recursive-include openlp *.js recursive-include openlp *.js
recursive-include openlp *.css recursive-include openlp *.css
recursive-include openlp *.png
recursive-include documentation * recursive-include documentation *
recursive-include resources * recursive-include resources *
recursive-include scripts * recursive-include scripts *

View File

@ -183,8 +183,9 @@ class ServiceItem(object):
else: else:
log.error(u'Invalid value renderer :%s' % self.service_item_type) log.error(u'Invalid value renderer :%s' % self.service_item_type)
self.title = clean_tags(self.title) self.title = clean_tags(self.title)
# The footer should never be None, but to be compatible with older # The footer should never be None, but to be compatible with a few
# release of OpenLP, we have to correct this to avoid tracebacks. # nightly builds between 1.9.4 and 1.9.5, we have to correct this to
# avoid tracebacks.
if self.raw_footer is None: if self.raw_footer is None:
self.raw_footer = [] self.raw_footer = []
self.foot_text = \ self.foot_text = \
@ -447,4 +448,5 @@ class ServiceItem(object):
elif not start and end: elif not start and end:
return end return end
else: else:
return u'%s : %s' % (start, end) return u'%s : %s' % (start, end)

View File

@ -424,12 +424,12 @@ class ThemeManager(QtGui.QWidget):
unicode(translate('OpenLP.ThemeManager', unicode(translate('OpenLP.ThemeManager',
'OpenLP Themes (*.theme *.otz)'))) 'OpenLP Themes (*.theme *.otz)')))
log.info(u'New Themes %s', unicode(files)) log.info(u'New Themes %s', unicode(files))
if not files:
return
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
if files: for file in files:
for file in files: SettingsManager.set_last_dir(self.settingsSection, unicode(file))
SettingsManager.set_last_dir( self.unzipTheme(file, self.path)
self.settingsSection, unicode(file))
self.unzipTheme(file, self.path)
self.loadThemes() self.loadThemes()
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
@ -502,16 +502,16 @@ class ThemeManager(QtGui.QWidget):
def unzipTheme(self, filename, dir): def unzipTheme(self, filename, dir):
""" """
Unzip the theme, remove the preview file if stored Unzip the theme, remove the preview file if stored
Generate a new preview fileCheck the XML theme version and upgrade if Generate a new preview file. Check the XML theme version and upgrade if
necessary. necessary.
""" """
log.debug(u'Unzipping theme %s', filename) log.debug(u'Unzipping theme %s', filename)
filename = unicode(filename) filename = unicode(filename)
zip = None zip = None
outfile = None outfile = None
filexml = None
try: try:
zip = zipfile.ZipFile(filename) zip = zipfile.ZipFile(filename)
filexml = None
themename = None themename = None
for file in zip.namelist(): for file in zip.namelist():
ucsfile = file_is_unicode(file) ucsfile = file_is_unicode(file)
@ -547,7 +547,7 @@ class ThemeManager(QtGui.QWidget):
else: else:
outfile = open(fullpath, u'wb') outfile = open(fullpath, u'wb')
outfile.write(zip.read(file)) outfile.write(zip.read(file))
except (IOError, NameError): except (IOError, NameError, zipfile.BadZipfile):
critical_error_message_box( critical_error_message_box(
translate('OpenLP.ThemeManager', 'Validation Error'), translate('OpenLP.ThemeManager', 'Validation Error'),
translate('OpenLP.ThemeManager', 'File is not a valid theme.')) translate('OpenLP.ThemeManager', 'File is not a valid theme.'))
@ -562,7 +562,9 @@ class ThemeManager(QtGui.QWidget):
if filexml: if filexml:
theme = self._createThemeFromXml(filexml, self.path) theme = self._createThemeFromXml(filexml, self.path)
self.generateAndSaveImage(dir, themename, theme) self.generateAndSaveImage(dir, themename, theme)
else: # Only show the error message, when IOError was not raised (in this
# case the error message has already been shown).
elif zip is not None:
critical_error_message_box( critical_error_message_box(
translate('OpenLP.ThemeManager', 'Validation Error'), translate('OpenLP.ThemeManager', 'Validation Error'),
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',

View File

@ -275,14 +275,33 @@ def clean_song(manager, song):
sxml = SongXML() sxml = SongXML()
# Rebuild the song's verses, to remove any wrong verse names (for example # Rebuild the song's verses, to remove any wrong verse names (for example
# translated ones), which might have been added prior to 1.9.5. # translated ones), which might have been added prior to 1.9.5.
# List for later comparison.
compare_order = []
for verse in verses: for verse in verses:
type = VerseType.Tags[VerseType.from_loose_input(verse[0][u'type'])]
sxml.add_verse_to_lyrics( sxml.add_verse_to_lyrics(
VerseType.Tags[VerseType.from_loose_input(verse[0][u'type'])], type,
verse[0][u'label'], verse[0][u'label'],
verse[1], verse[1],
verse[0][u'lang'] if verse[0].has_key(u'lang') else None verse[0][u'lang'] if verse[0].has_key(u'lang') else None
) )
compare_order.append((u'%s%s' % (type, verse[0][u'label'])).upper())
song.lyrics = unicode(sxml.extract_xml(), u'utf-8') song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
# Rebuild the verse order, to convert translated verse tags, which might
# have been added prior to 1.9.5.
order = song.verse_order.strip().split()
new_order = []
for verse_def in order:
new_order.append((u'%s%s' % (
VerseType.Tags[VerseType.from_loose_input(verse_def[0])],
verse_def[1:])).upper()
)
song.verse_order = u' '.join(new_order)
# Check if the verse order contains tags for verses which do not exist.
for order in new_order:
if order not in compare_order:
song.verse_order = u''
break
# The song does not have any author, add one. # The song does not have any author, add one.
if not song.authors: if not song.authors:
name = SongStrings.AuthorUnknown name = SongStrings.AuthorUnknown

View File

@ -461,5 +461,5 @@ class SongMediaItem(MediaManagerItem):
""" """
Locale aware collation of song titles Locale aware collation of song titles
""" """
return locale.strcoll(unicode(song_1.title.lower()), return locale.strcoll(unicode(song_1.title.lower()),
unicode(song_2.title.lower())) unicode(song_2.title.lower()))

View File

@ -309,7 +309,7 @@ class SofImport(OooImport):
self.add_verse(lyrics, tag) self.add_verse(lyrics, tag)
if not self.is_chorus and u'C1' in self.verse_order_list_generated: if not self.is_chorus and u'C1' in self.verse_order_list_generated:
self.verse_order_list_generated.append(u'C1') self.verse_order_list_generated.append(u'C1')
self.verse_order_list_generated_useful = True self.verse_order_list_generated_useful = True
def uncap_text(self, text): def uncap_text(self, text):
""" """

View File

@ -225,7 +225,7 @@ class SongImport(QtCore.QObject):
self.verse_counts[verse_def[0]] = int(verse_def[1:]) self.verse_counts[verse_def[0]] = int(verse_def[1:])
self.verses.append([verse_def, verse_text.rstrip(), lang]) self.verses.append([verse_def, verse_text.rstrip(), lang])
self.verse_order_list_generated.append(verse_def) self.verse_order_list_generated.append(verse_def)
def repeat_verse(self): def repeat_verse(self):
""" """
Repeat the previous verse in the verse order Repeat the previous verse in the verse order

View File

@ -131,7 +131,7 @@ class SongShowPlusImport(SongImport):
lengthDescriptor, = struct.unpack("B", songData.read(1)) lengthDescriptor, = struct.unpack("B", songData.read(1))
data = songData.read(lengthDescriptor) data = songData.read(lengthDescriptor)
if blockKey == TITLE: if blockKey == TITLE:
self.title = unicode(data, u'cp1252') self.title = unicode(data, u'cp1252')
elif blockKey == AUTHOR: elif blockKey == AUTHOR:
authors = data.split(" / ") authors = data.split(" / ")
for author in authors: for author in authors:

View File

@ -62,7 +62,41 @@ setup(
description="Open source Church presentation and lyrics projection application.", description="Open source Church presentation and lyrics projection application.",
long_description="""\ long_description="""\
OpenLP (previously openlp.org) is free church presentation software, or lyrics projection software, used to display slides of songs, Bible verses, videos, images, and even presentations (if PowerPoint is installed) for church worship using a computer and a data projector.""", OpenLP (previously openlp.org) is free church presentation software, or lyrics projection software, used to display slides of songs, Bible verses, videos, images, and even presentations (if PowerPoint is installed) for church worship using a computer and a data projector.""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[
'Development Status :: 4 - Beta',
'Environment :: MacOS X',
'Environment :: Win32 (MS Windows)',
'Environment :: X11 Applications',
'Environment :: X11 Applications :: Qt',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Religion',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Natural Language :: Afrikaans',
'Natural Language :: Dutch',
'Natural Language :: English',
'Natural Language :: French',
'Natural Language :: German',
'Natural Language :: Hungarian',
'Natural Language :: Indonesian',
'Natural Language :: Japanese',
'Natural Language :: Norwegian',
'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Russian',
'Natural Language :: Swedish',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: BSD :: FreeBSD',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Topic :: Desktop Environment :: Gnome',
'Topic :: Desktop Environment :: K Desktop Environment (KDE)',
'Topic :: Multimedia',
'Topic :: Multimedia :: Graphics :: Presentation',
'Topic :: Multimedia :: Sound/Audio',
'Topic :: Multimedia :: Video',
'Topic :: Religion'
], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='open source church presentation lyrics projection song bible display project', keywords='open source church presentation lyrics projection song bible display project',
author='Raoul Snyman', author='Raoul Snyman',
author_email='raoulsnyman@openlp.org', author_email='raoulsnyman@openlp.org',