From eb1dc880cb9d231710cb58a1eee31114f762104b Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Thu, 10 Mar 2011 03:09:23 +0100 Subject: [PATCH 01/71] using raouls get_version script from http://wiki.openlp.org/Packaging:Version_Script to create the .version file --- resources/osx/build.py | 5 +---- resources/osx/get_version.py | 36 ++++++++++++++++++++++++++++++++++++ resources/osx/openlp.cfg | 1 - resources/osx/version.master | 1 - 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 resources/osx/get_version.py delete mode 100755 resources/osx/version.master diff --git a/resources/osx/build.py b/resources/osx/build.py index 93fe453ad..ff7f6bdfd 100644 --- a/resources/osx/build.py +++ b/resources/osx/build.py @@ -394,10 +394,7 @@ if __name__ == '__main__': --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() }) + os.system('python get_version.py > .version') # prepare variables app_name_lower = settings['openlp_appname'].lower() diff --git a/resources/osx/get_version.py b/resources/osx/get_version.py new file mode 100644 index 000000000..30ebd7886 --- /dev/null +++ b/resources/osx/get_version.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import sys +import os +from bzrlib.branch import Branch + +def get_version(path): + b = Branch.open_containing(path)[0] + b.lock_read() + result = '0.0.0' + try: + # Get the branch's latest revision number. + revno = b.revno() + # Convert said revision number into a bzr revision id. + revision_id = b.dotted_revno_to_revision_id((revno,)) + # Get a dict of tags, with the revision id as the key. + tags = b.tags.get_reverse_tag_dict() + # Check if the latest + if revision_id in tags: + result = tags[revision_id][0] + else: + result = '%s-bzr%s' % (sorted(b.tags.get_tag_dict().keys())[-1], revno) + finally: + b.unlock() + return result + +def get_path(): + if len(sys.argv) > 1: + return os.path.abspath(sys.argv[1]) + else: + return os.path.abspath('.') + +if __name__ == u'__main__': + path = get_path() + print get_version(path) + diff --git a/resources/osx/openlp.cfg b/resources/osx/openlp.cfg index 1f04861b5..3be085dc0 100755 --- a/resources/osx/openlp.cfg +++ b/resources/osx/openlp.cfg @@ -2,7 +2,6 @@ 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 diff --git a/resources/osx/version.master b/resources/osx/version.master deleted file mode 100755 index d517a51bc..000000000 --- a/resources/osx/version.master +++ /dev/null @@ -1 +0,0 @@ -%(openlp_full_version)s From 1312e0c913a04e1f4024882315fbb8e9a0856181 Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Thu, 10 Mar 2011 03:13:05 +0100 Subject: [PATCH 02/71] fixed the language configuration save/load bug on OS X --- openlp/core/utils/languagemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index caea3bfdd..9dbf9a779 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -91,7 +91,7 @@ class LanguageManager(object): """ Retrieve a saved language to use from settings """ - settings = QtCore.QSettings(u'OpenLP', u'OpenLP') + settings = QtCore.QSettings() language = unicode(settings.value( u'general/language', QtCore.QVariant(u'[en]')).toString()) log.info(u'Language file: \'%s\' Loaded from conf file' % language) From 1ce88e7a2a852446750c61ee1eb460a002fc0880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 15 Mar 2011 00:29:02 +0200 Subject: [PATCH 03/71] Prevent possible crash, if label field is empty in database. --- openlp/plugins/songs/forms/editsongform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 0d9121c45..069e1e4a8 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -269,6 +269,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): if index is None: index = VerseType.Other verse[0][u'type'] = VerseType.Tags[index] + if verse[0][u'label'] == u'': + verse[0][u'label'] = u'1' verse_def = u'%s%s' % (verse[0][u'type'], verse[0][u'label']) item = QtGui.QTableWidgetItem(verse[1]) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(verse_def)) From e5b664663a335666b6b509860b53f4392f10e3c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 15 Mar 2011 01:05:31 +0200 Subject: [PATCH 04/71] Fix tracebacks, if user has no internet connection and he still presses Finish. --- openlp/core/ui/mainwindow.py | 2 ++ openlp/plugins/songs/songsplugin.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 06b809a20..2af6f3e59 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -678,6 +678,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): plugin.firstTime() Receiver.send_message(u'openlp_process_events') temp_dir = os.path.join(unicode(gettempdir()), u'openlp') + if not os.path.isdir(temp_dir): + return for filename in os.listdir(temp_dir): os.remove(os.path.join(temp_dir, filename)) os.removedirs(temp_dir) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index bd953ffac..1d3f12ede 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -255,6 +255,8 @@ class SongsPlugin(Plugin): """ db_dir = unicode(os.path.join(gettempdir(), u'openlp')) song_dbs = [] + if not os.path.isdir(db_dir): + return for sfile in os.listdir(db_dir): if sfile.startswith(u'songs_') and sfile.endswith(u'.sqlite'): song_dbs.append(os.path.join(db_dir, sfile)) From 077337066221ceaec3ce98a753bc753b8f00633b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 15 Mar 2011 16:38:16 +0200 Subject: [PATCH 05/71] Fix for #65 --- openlp/core/ui/servicemanager.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index fa2bc50f5..b43463d32 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -556,6 +556,13 @@ class ServiceManager(QtGui.QWidget): log.exception(u'File contains no service data') except (IOError, NameError): log.exception(u'Problem loading service file %s' % fileName) + except zipfile.BadZipfile: + log.exception(u'Service file is corrupt: %s' % fileName) + QtGui.QMessageBox.information(self, + translate('OpenLP.ServiceManager', 'File Is Corrupt'), + translate('OpenLP.ServiceManager', 'This service file is ' + 'either corrupt or is not an OpenLP 2 service file.')) + return finally: if fileTo: fileTo.close() From b502ad549c022fc66e13f194f7eac0f0431a0b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Wed, 16 Mar 2011 09:55:08 +0200 Subject: [PATCH 06/71] Differentiated error message for zero sized service. --- openlp/core/ui/servicemanager.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index b43463d32..18b9bf8a2 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -557,11 +557,19 @@ class ServiceManager(QtGui.QWidget): except (IOError, NameError): log.exception(u'Problem loading service file %s' % fileName) except zipfile.BadZipfile: - log.exception(u'Service file is corrupt: %s' % fileName) - QtGui.QMessageBox.information(self, - translate('OpenLP.ServiceManager', 'File Is Corrupt'), - translate('OpenLP.ServiceManager', 'This service file is ' - 'either corrupt or is not an OpenLP 2 service file.')) + if os.path.getsize(fileName) == 0: + log.exception(u'Service file is zero sized: %s' % fileName) + QtGui.QMessageBox.information(self, + translate('OpenLP.ServiceManager', 'File Is Empty'), + translate('OpenLP.ServiceManager', 'This service file is ' + 'zero size and does not contain any data.')) + else: + log.exception(u'Service file is cannot be extracted as zip: ' + u'%s' % fileName) + QtGui.QMessageBox.information(self, + translate('OpenLP.ServiceManager', 'File Is Corrupt'), + translate('OpenLP.ServiceManager', 'This service file is ' + 'either corrupt or is not an OpenLP 2 service file.')) return finally: if fileTo: From d83f14f8fb1e92a3ee96787ce1f4b26856a7ff16 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 Mar 2011 21:07:19 +0100 Subject: [PATCH 07/71] import topics from usr files, clean ups --- openlp/plugins/songs/lib/cclifileimport.py | 98 ++++++++++++---------- 1 file changed, 53 insertions(+), 45 deletions(-) diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/cclifileimport.py index f9e2963d1..2cbaa000d 100644 --- a/openlp/plugins/songs/lib/cclifileimport.py +++ b/openlp/plugins/songs/lib/cclifileimport.py @@ -30,6 +30,7 @@ import chardet import codecs from openlp.core.lib import translate +from openlp.plugins.songs.lib import VerseType from songimport import SongImport log = logging.getLogger(__name__) @@ -67,6 +68,7 @@ class CCLIFileImport(SongImport): (song_count, song_total)) filename = unicode(filename) log.debug(u'Importing CCLI File: %s', filename) + self.set_defaults() lines = [] if os.path.isfile(filename): detect_file = open(filename, u'r') @@ -108,35 +110,46 @@ class CCLIFileImport(SongImport): ``[File]`` USR file format first line + ``Type=`` Indicates the file type e.g. *Type=SongSelect Import File* + ``Version=3.0`` File format version + ``[S A2672885]`` Contains the CCLI Song number e.g. *2672885* + ``Title=`` Contains the song title (e.g. *Title=Above All*) + ``Author=`` Contains a | delimited list of the song authors e.g. *Author=LeBlanc, Lenny | Baloche, Paul* + ``Copyright=`` Contains a | delimited list of the song copyrights e.g. Copyright=1999 Integrity's Hosanna! Music | LenSongs Publishing (Verwaltet von Gerth Medien Musikverlag) + ``Admin=`` Contains the song administrator e.g. *Admin=Gerth Medien Musikverlag* + ``Themes=`` Contains a /t delimited list of the song themes e.g. *Themes=Cross/tKingship/tMajesty/tRedeemer* + ``Keys=`` Contains the keys in which the music is played?? e.g. *Keys=A* + ``Fields=`` Contains a list of the songs fields in order /t delimited e.g. *Fields=Vers 1/tVers 2/tChorus 1/tAndere 1* + ``Words=`` Contains the songs various lyrics in order as shown by the *Fields* description @@ -144,57 +157,60 @@ class CCLIFileImport(SongImport): """ log.debug(u'USR file text: %s', textList) - self.set_defaults() + song_author = u'' + song_topics = u'' for line in textList: if line.startswith(u'Title='): - song_name = line[6:].strip() + self.title = line[6:].strip() elif line.startswith(u'Author='): song_author = line[7:].strip() elif line.startswith(u'Copyright='): - song_copyright = line[10:].strip() + self.copyright = line[10:].strip() + elif line.startswith(u'Themes='): + song_topics = line[7:].strip() elif line.startswith(u'[S A'): - song_ccli = line[4:-3].strip() + self.ccli_number = line[4:-3].strip() elif line.startswith(u'Fields='): - #Fields contain single line indicating verse, chorus, etc, - #/t delimited, same as with words field. store seperately - #and process at end. + #Fields contain single line indicating verse, chorus, etc, + #/t delimited, same as with words field. store seperately + #and process at end. song_fields = line[7:].strip() elif line.startswith(u'Words='): song_words = line[6:].strip() - #Unhandled usr keywords:Type,Version,Admin,Themes,Keys - #Process Fields and words sections + # Unhandled usr keywords: Type, Version, Admin, Keys + # Process Fields and words sections. check_first_verse_line = False field_list = song_fields.split(u'/t') words_list = song_words.split(u'/t') for counter in range(0, len(field_list)): if field_list[counter].startswith(u'Ver'): - verse_type = u'V' + verse_type = VerseType.Tags[VerseType.Verse] elif field_list[counter].startswith(u'Ch'): - verse_type = u'C' + verse_type = VerseType.Tags[VerseType.Chorus] elif field_list[counter].startswith(u'Br'): - verse_type = u'B' - else: #Other - verse_type = u'O' + verse_type = VerseType.Tags[VerseType.Bridge] + else: + verse_type = VerseType.Tags[VerseType.Other] check_first_verse_line = True verse_text = unicode(words_list[counter]) verse_text = verse_text.replace(u'/n', u'\n') verse_lines = verse_text.split(u'\n', 1) if check_first_verse_line: if verse_lines[0].startswith(u'(PRE-CHORUS'): - verse_type = u'P' + verse_type = VerseType.Tags[VerseType.PreChorus] log.debug(u'USR verse PRE-CHORUS: %s', verse_lines[0]) verse_text = verse_lines[1] elif verse_lines[0].startswith(u'(BRIDGE'): - verse_type = u'B' + verse_type = VerseType.Tags[VerseType.Bridge] log.debug(u'USR verse BRIDGE') verse_text = verse_lines[1] elif verse_lines[0].startswith(u'('): - verse_type = u'O' + verse_type = VerseType.Tags[VerseType.Other] verse_text = verse_lines[1] if len(verse_text) > 0: self.add_verse(verse_text, verse_type) check_first_verse_line = False - #Handle multiple authors + # Handle multiple authors author_list = song_author.split(u'/') if len(author_list) < 2: author_list = song_author.split(u'|') @@ -204,9 +220,7 @@ class CCLIFileImport(SongImport): self.add_author(u' '.join(reversed(separated))) else: self.add_author(author) - self.title = song_name - self.copyright = song_copyright - self.ccli_number = song_ccli + self.topics = [topic.strip() for topic in song_topics.split(u'/t')] self.finish() def do_import_txt_file(self, textList): @@ -243,12 +257,11 @@ class CCLIFileImport(SongImport): """ log.debug(u'TXT file text: %s', textList) - self.set_defaults() line_number = 0 check_first_verse_line = False verse_text = u'' - song_comments = u'' - song_copyright = u'' + song_author = u'' + song_topics = u'' verse_start = False for line in textList: clean_line = line.strip() @@ -258,12 +271,12 @@ class CCLIFileImport(SongImport): elif verse_start: if verse_text: self.add_verse(verse_text, verse_type) - verse_text = '' + verse_text = u'' verse_start = False else: #line_number=0, song title if line_number == 0: - song_name = clean_line + self.title = clean_line line_number += 1 #line_number=1, verses elif line_number == 1: @@ -271,37 +284,37 @@ class CCLIFileImport(SongImport): if clean_line.startswith(u'CCLI'): line_number += 1 ccli_parts = clean_line.split(' ') - song_ccli = ccli_parts[len(ccli_parts)-1] + self.ccli_number = ccli_parts[len(ccli_parts)-1] elif not verse_start: # We have the verse descriptor - verse_desc_parts = clean_line.split(' ') + verse_desc_parts = clean_line.split(u' ') if len(verse_desc_parts) == 2: if verse_desc_parts[0].startswith(u'Ver'): - verse_type = u'V' + verse_type = VerseType.Tags[VerseType.Verse] elif verse_desc_parts[0].startswith(u'Ch'): - verse_type = u'C' + verse_type = VerseType.Tags[VerseType.Chorus] elif verse_desc_parts[0].startswith(u'Br'): - verse_type = u'B' + verse_type = VerseType.Tags[VerseType.Bridge] else: #we need to analyse the next line for #verse type, so set flag - verse_type = u'O' + verse_type = VerseType.Tags[VerseType.Other] check_first_verse_line = True verse_number = verse_desc_parts[1] else: - verse_type = u'O' + verse_type = VerseType.Tags[VerseType.Other] verse_number = 1 verse_start = True else: #check first line for verse type if check_first_verse_line: if line.startswith(u'(PRE-CHORUS'): - verse_type = u'P' + verse_type = VerseType.Tags[VerseType.PreChorus] elif line.startswith(u'(BRIDGE'): - verse_type = u'B' + verse_type = VerseType.Tags[VerseType.Bridge] # Handle all other misc types elif line.startswith(u'('): - verse_type = u'O' + verse_type = VerseType.Tags[VerseType.Other] else: verse_text = verse_text + line check_first_verse_line = False @@ -313,24 +326,19 @@ class CCLIFileImport(SongImport): #line_number=2, copyright if line_number == 2: line_number += 1 - song_copyright = clean_line + self.copyright = clean_line #n=3, authors elif line_number == 3: line_number += 1 song_author = clean_line #line_number=4, comments lines before last line - elif (line_number == 4) and \ - (not clean_line.startswith(u'CCL')): - song_comments = song_comments + clean_line + elif line_number == 4 and not clean_line.startswith(u'CCL'): + self.comments += clean_line # split on known separators author_list = song_author.split(u'/') if len(author_list) < 2: author_list = song_author.split(u'|') - #Clean spaces before and after author names + # Clean spaces before and after author names. for author_name in author_list: self.add_author(author_name.strip()) - self.title = song_name - self.copyright = song_copyright - self.ccli_number = song_ccli - self.comments = song_comments self.finish() From 41f0be38fbe4d1c05e424ca8c98abea6772d51f6 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 Mar 2011 21:45:11 +0100 Subject: [PATCH 08/71] clean ups --- openlp/plugins/songs/lib/cclifileimport.py | 31 +++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/cclifileimport.py index 2cbaa000d..0f1c5c063 100644 --- a/openlp/plugins/songs/lib/cclifileimport.py +++ b/openlp/plugins/songs/lib/cclifileimport.py @@ -37,9 +37,9 @@ log = logging.getLogger(__name__) class CCLIFileImport(SongImport): """ - The :class:`CCLIFileImport` class provides OpenLP with the ability to - import CCLI SongSelect song files in both .txt and .usr formats. - See http://www.ccli.com/ for more details. + The :class:`CCLIFileImport` class provides OpenLP with the ability to import + CCLI SongSelect song files in both .txt and .usr formats. See + ``_ for more details. """ def __init__(self, manager, **kwargs): @@ -56,7 +56,7 @@ class CCLIFileImport(SongImport): def do_import(self): """ - Import either a .usr or a .txt SongSelect file + Import either a ``.usr`` or a ``.txt`` SongSelect file. """ log.debug(u'Starting CCLI File Import') song_total = len(self.import_source) @@ -83,12 +83,10 @@ class CCLIFileImport(SongImport): lines = infile.readlines() ext = os.path.splitext(filename)[1] if ext.lower() == u'.usr': - log.info(u'SongSelect .usr format file found %s: ', - filename) + log.info(u'SongSelect .usr format file found: %s', filename) self.do_import_usr_file(lines) elif ext.lower() == u'.txt': - log.info(u'SongSelect .txt format file found %s: ', - filename) + log.info(u'SongSelect .txt format file found: %s', filename) self.do_import_txt_file(lines) else: log.info(u'Extension %s is not valid', filename) @@ -99,9 +97,8 @@ class CCLIFileImport(SongImport): def do_import_usr_file(self, textList): """ - The :func:`do_import_usr_file` method provides OpenLP - with the ability to import CCLI SongSelect songs in - *USR* file format + The :func:`do_import_usr_file` method provides OpenLP with the ability + to import CCLI SongSelect songs in *USR* file format. ``textList`` An array of strings containing the usr file content. @@ -225,9 +222,8 @@ class CCLIFileImport(SongImport): def do_import_txt_file(self, textList): """ - The :func:`do_import_txt_file` method provides OpenLP - with the ability to import CCLI SongSelect songs in - *TXT* file format + The :func:`do_import_txt_file` method provides OpenLP with the ability + to import CCLI SongSelect songs in *TXT* file format. ``textList`` An array of strings containing the txt file content. @@ -261,7 +257,6 @@ class CCLIFileImport(SongImport): check_first_verse_line = False verse_text = u'' song_author = u'' - song_topics = u'' verse_start = False for line in textList: clean_line = line.strip() @@ -296,8 +291,8 @@ class CCLIFileImport(SongImport): elif verse_desc_parts[0].startswith(u'Br'): verse_type = VerseType.Tags[VerseType.Bridge] else: - #we need to analyse the next line for - #verse type, so set flag + # we need to analyse the next line for + # verse type, so set flag verse_type = VerseType.Tags[VerseType.Other] check_first_verse_line = True verse_number = verse_desc_parts[1] @@ -306,7 +301,7 @@ class CCLIFileImport(SongImport): verse_number = 1 verse_start = True else: - #check first line for verse type + # check first line for verse type if check_first_verse_line: if line.startswith(u'(PRE-CHORUS'): verse_type = VerseType.Tags[VerseType.PreChorus] From 252f316e0e6362a4faed2657d440b57417f7b75a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 Mar 2011 21:51:41 +0100 Subject: [PATCH 09/71] missing spaces --- openlp/plugins/songs/lib/cclifileimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/cclifileimport.py index 0f1c5c063..3f66a6855 100644 --- a/openlp/plugins/songs/lib/cclifileimport.py +++ b/openlp/plugins/songs/lib/cclifileimport.py @@ -279,7 +279,7 @@ class CCLIFileImport(SongImport): if clean_line.startswith(u'CCLI'): line_number += 1 ccli_parts = clean_line.split(' ') - self.ccli_number = ccli_parts[len(ccli_parts)-1] + self.ccli_number = ccli_parts[len(ccli_parts) - 1] elif not verse_start: # We have the verse descriptor verse_desc_parts = clean_line.split(u' ') From f2acce4a77a261fcfef4bb9f228a7a220c93abee Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 Mar 2011 21:59:44 +0100 Subject: [PATCH 10/71] missing spaces --- openlp/plugins/songs/lib/cclifileimport.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/cclifileimport.py index 3f66a6855..dcfab0942 100644 --- a/openlp/plugins/songs/lib/cclifileimport.py +++ b/openlp/plugins/songs/lib/cclifileimport.py @@ -27,7 +27,7 @@ import logging import os import chardet -import codecs +import codecsu from openlp.core.lib import translate from openlp.plugins.songs.lib import VerseType @@ -168,9 +168,9 @@ class CCLIFileImport(SongImport): elif line.startswith(u'[S A'): self.ccli_number = line[4:-3].strip() elif line.startswith(u'Fields='): - #Fields contain single line indicating verse, chorus, etc, - #/t delimited, same as with words field. store seperately - #and process at end. + # Fields contain single line indicating verse, chorus, etc, + # /t delimited, same as with words field. store seperately + # and process at end. song_fields = line[7:].strip() elif line.startswith(u'Words='): song_words = line[6:].strip() From dbefa29054e0dfa69c49283bcb021ab4a29cdfd8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 Mar 2011 22:03:28 +0100 Subject: [PATCH 11/71] fixed mistake --- openlp/plugins/songs/lib/cclifileimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/cclifileimport.py b/openlp/plugins/songs/lib/cclifileimport.py index dcfab0942..03a86c455 100644 --- a/openlp/plugins/songs/lib/cclifileimport.py +++ b/openlp/plugins/songs/lib/cclifileimport.py @@ -27,7 +27,7 @@ import logging import os import chardet -import codecsu +import codecs from openlp.core.lib import translate from openlp.plugins.songs.lib import VerseType From c0f5191d6cd50ed010ef838d08559b2844e9d15f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 27 Mar 2011 19:00:34 +0200 Subject: [PATCH 12/71] clicked rather than pressed --- openlp/plugins/custom/forms/editcustomslideform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index 24ddc3775..7d4e32968 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -45,7 +45,7 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog): self.setupUi(self) # Connecting signals and slots QtCore.QObject.connect(self.splitButton, - QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onSplitButtonPressed) def setText(self, text): """ From 26f144e1eca47cf3ddcad1cedb015d87c3ebfe10 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 27 Mar 2011 20:28:03 +0200 Subject: [PATCH 13/71] fix for ticket #142 --- openlp/core/lib/serviceitem.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 48a277633..2305f1102 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -406,24 +406,28 @@ class ServiceItem(object): def get_rendered_frame(self, row): """ - Returns the correct frame for a given list and - renders it if required. + Returns the correct frame for a given list and renders it if required. """ - if self.service_item_type == ServiceItemType.Text: - return self._display_frames[row][u'html'].split(u'\n')[0] - elif self.service_item_type == ServiceItemType.Image: - return self._raw_frames[row][u'title'] - else: - return self._raw_frames[row][u'image'] + try: + if self.service_item_type == ServiceItemType.Text: + frame = self._display_frames[row][u'html'].split(u'\n')[0] + elif self.service_item_type == ServiceItemType.Image: + frame = self._raw_frames[row][u'title'] + else: + frame = self._raw_frames[row][u'image'] + except IndexError: + frame = u'' + return frame def get_frame_title(self, row=0): """ Returns the title of the raw frame """ try: - return self._raw_frames[row][u'title'] + title = self._raw_frames[row][u'title'] except IndexError: - return u'' + title = u'' + return title def get_frame_path(self, row=0): """ From 3efb36c9e389c870dcbf7b506ebf34ea02812d5f Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 27 Mar 2011 22:25:02 +0200 Subject: [PATCH 14/71] Set the HTML/Qt Help theme when building either one of those, otherwise use the default theme. --- documentation/manual/source/conf.py | 31 ++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/documentation/manual/source/conf.py b/documentation/manual/source/conf.py index 6e9285aed..c10164669 100644 --- a/documentation/manual/source/conf.py +++ b/documentation/manual/source/conf.py @@ -14,6 +14,8 @@ import sys import os +print sys.argv + # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -42,7 +44,7 @@ master_doc = 'index' # General information about the project. project = u'OpenLP' -copyright = u'2010, Raoul Snyman' +copyright = u'2004 - 2011, Raoul Snyman' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -92,19 +94,30 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +if sys.argv[2] == 'qthelp' or sys.argv[2] == 'htmlhelp': + html_theme = 'openlp_qthelp' +else: + html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +if sys.argv[2] == 'html': + html_theme_options = { + 'sidebarbgcolor': '#3a60a9', + 'relbarbgcolor': '#203b6f', + 'footerbgcolor': '#26437c', + 'headtextcolor': '#203b6f', + 'linkcolor': '#26437c', + 'sidebarlinkcolor': '#ceceff' + } # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +html_theme_path = [os.path.join(os.path.abspath('..'), 'themes')] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +html_title = u'OpenLP 2.0 Reference Manual' # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None @@ -125,7 +138,7 @@ html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -165,7 +178,7 @@ html_static_path = ['_static'] #html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'OpenLPdoc' +htmlhelp_basename = 'OpenLP' # -- Options for LaTeX output -------------------------------------------------- @@ -179,7 +192,7 @@ htmlhelp_basename = 'OpenLPdoc' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'OpenLP.tex', u'OpenLP Documentation', + ('index', 'OpenLP.tex', u'OpenLP Reference Manual', u'Wesley Stout', 'manual'), ] @@ -212,6 +225,6 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'openlp', u'OpenLP Documentation', + ('index', 'openlp', u'OpenLP Reference Manual', [u'Wesley Stout'], 1) ] From 63282e71372709695e14fd746e5b9880521aac7e Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 27 Mar 2011 23:01:29 +0200 Subject: [PATCH 15/71] Removed an unnecessary print statement. --- documentation/manual/source/conf.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/documentation/manual/source/conf.py b/documentation/manual/source/conf.py index c10164669..2e9c0a88f 100644 --- a/documentation/manual/source/conf.py +++ b/documentation/manual/source/conf.py @@ -14,8 +14,6 @@ import sys import os -print sys.argv - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. From 1e973c6c8db25ed36fb9c71f82425fd759ed1985 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Sun, 27 Mar 2011 23:28:20 +0100 Subject: [PATCH 16/71] Attempt superscript without affecting line spacing --- openlp/core/lib/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index ddb1ae9b1..a9e8e86f1 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -65,8 +65,9 @@ base_html_expands.append({u'desc': u'White', u'start tag': u'{w}', u'start html': u'', u'end tag': u'{/w}', u'end html': u'', u'protected': True}) base_html_expands.append({u'desc': u'Superscript', u'start tag': u'{su}', - u'start html': u'', u'end tag': u'{/su}', u'end html': u'', - u'protected': True}) + u'start html': u'', u'end tag': u'{/su}', + u'end html': u'', u'protected': True}) base_html_expands.append({u'desc': u'Subscript', u'start tag': u'{sb}', u'start html': u'', u'end tag': u'{/sb}', u'end html': u'', u'protected': True}) From 534c17fbf14e82975e1551147c5c4388c400ac71 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 28 Mar 2011 10:52:37 +0200 Subject: [PATCH 17/71] Changed line endings on make.bat to Windows. --- documentation/manual/make.bat | 224 +++++++++++++++++----------------- 1 file changed, 112 insertions(+), 112 deletions(-) diff --git a/documentation/manual/make.bat b/documentation/manual/make.bat index 8d21b45ce..20bff1ee7 100644 --- a/documentation/manual/make.bat +++ b/documentation/manual/make.bat @@ -1,112 +1,112 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -set SPHINXBUILD=sphinx-build -set ALLSPHINXOPTS=-d build/doctrees %SPHINXOPTS% source -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. changes to make an overview over all changed/added/deprecated items - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (build\*) do rmdir /q /s %%i - del /q /s build\* - goto end -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% build/html - echo. - echo.Build finished. The HTML pages are in build/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% build/dirhtml - echo. - echo.Build finished. The HTML pages are in build/dirhtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% build/pickle - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% build/json - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% build/htmlhelp - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in build/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% build/qthelp - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in build/qthelp, like this: - echo.^> qcollectiongenerator build\qthelp\OpenLP.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile build\qthelp\OpenLP.ghc - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% build/latex - echo. - echo.Build finished; the LaTeX files are in build/latex. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% build/changes - echo. - echo.The overview file is in build/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% build/linkcheck - echo. - echo.Link check complete; look for any errors in the above output ^ -or in build/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% build/doctest - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in build/doctest/output.txt. - goto end -) - -:end +@ECHO OFF + +REM Command file for Sphinx documentation + +set SPHINXBUILD=sphinx-build +set ALLSPHINXOPTS=-d build/doctrees %SPHINXOPTS% source +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. changes to make an overview over all changed/added/deprecated items + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (build\*) do rmdir /q /s %%i + del /q /s build\* + goto end +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% build/html + echo. + echo.Build finished. The HTML pages are in build/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% build/dirhtml + echo. + echo.Build finished. The HTML pages are in build/dirhtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% build/pickle + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% build/json + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% build/htmlhelp + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in build/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% build/qthelp + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in build/qthelp, like this: + echo.^> qcollectiongenerator build\qthelp\OpenLP.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile build\qthelp\OpenLP.ghc + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% build/latex + echo. + echo.Build finished; the LaTeX files are in build/latex. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% build/changes + echo. + echo.The overview file is in build/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% build/linkcheck + echo. + echo.Link check complete; look for any errors in the above output ^ +or in build/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% build/doctest + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in build/doctest/output.txt. + goto end +) + +:end From 3aaaa8895b5102a3054cfd0f04a915b10db0c96a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 28 Mar 2011 19:29:25 +0200 Subject: [PATCH 18/71] fixed a bug in the exception form --- openlp/core/ui/exceptionform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 50cf597ea..0ae9497c9 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -57,6 +57,7 @@ except ImportError: from openlp.core.lib import translate, SettingsManager from openlp.core.lib.mailto import mailto from openlp.core.lib.ui import UiStrings +from openlp.core.utils import get_application_version from exceptiondialog import Ui_ExceptionDialog @@ -78,7 +79,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): return QtGui.QDialog.exec_(self) def _createReport(self): - openlp_version = self.parent().applicationVersion[u'full'] + openlp_version = get_application_version() description = unicode(self.descriptionTextEdit.toPlainText()) traceback = unicode(self.exceptionTextEdit.toPlainText()) system = unicode(translate('OpenLP.ExceptionForm', From 2cce748d20b9fd458add0f4f4ece1f3b54a61e7a Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Mon, 28 Mar 2011 21:18:55 +0100 Subject: [PATCH 19/71] Change superscript so it still works in print. Fix problem with openlp not closing --- openlp.pyw | 16 +++++++++------- openlp/core/lib/__init__.py | 5 ++--- openlp/core/lib/htmlbuilder.py | 7 ++++++- openlp/core/ui/mainwindow.py | 10 ++++++---- openlp/core/ui/printserviceform.py | 4 ++-- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index b8c16c585..c9c5294b5 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -78,12 +78,13 @@ class OpenLP(QtGui.QApplication): class in order to provide the core of the application. """ - def exec_(self): - """ - Override exec method to allow the shared memory to be released on exit - """ - QtGui.QApplication.exec_() - self.sharedMemory.detach() + #def exec_(self): + #""" + #Override exec method to allow the shared memory to be released on exit + #""" + #return QtGui.QApplication.exec_() + #self.sharedMemory.detach() + #return i def run(self): """ @@ -115,7 +116,8 @@ class OpenLP(QtGui.QApplication): # make sure Qt really display the splash screen self.processEvents() # start the main app window - self.mainWindow = MainWindow(screens, self) + self.mainWindow = MainWindow(screens, self.clipboard(), + self.arguments()) self.mainWindow.show() if show_splash: # now kill the splashscreen diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index a9e8e86f1..ddb1ae9b1 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -65,9 +65,8 @@ base_html_expands.append({u'desc': u'White', u'start tag': u'{w}', u'start html': u'', u'end tag': u'{/w}', u'end html': u'', u'protected': True}) base_html_expands.append({u'desc': u'Superscript', u'start tag': u'{su}', - u'start html': u'', u'end tag': u'{/su}', - u'end html': u'', u'protected': True}) + u'start html': u'', u'end tag': u'{/su}', u'end html': u'', + u'protected': True}) base_html_expands.append({u'desc': u'Subscript', u'start tag': u'{sb}', u'start html': u'', u'end tag': u'{/sb}', u'end html': u'', u'protected': True}) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 67a05c6a1..c4361a421 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -85,7 +85,12 @@ body { } /* lyric css */ %s - +sup { + font-size:0.6em; + vertical-align:top; + position:relative; + top:-0.3em; +}