From e6cfad921a51a61e5c8a73c7fbe92c13f398bd81 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 4 Dec 2010 21:42:03 +0100 Subject: [PATCH 01/18] olpv1 bible importer --- openlp/plugins/bibles/lib/db.py | 2 +- openlp/plugins/bibles/lib/manager.py | 1 + openlp/plugins/bibles/lib/olp1import.py | 98 +++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100755 openlp/plugins/bibles/lib/olp1import.py diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 9852ed16b..cdc81d408 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -231,7 +231,7 @@ class BibleDB(QtCore.QObject, Manager): def create_chapter(self, book_id, chapter, textlist): """ - Add a chapter and it's verses to a book. + Add a chapter and its verses to a book. ``book_id`` The id of the book being appended. diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 6b4d7c800..6c8b9f4ab 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -61,6 +61,7 @@ class BibleFormat(object): CSV = 1 OpenSong = 2 WebDownload = 3 + OpenLPv1 = 4 @staticmethod def get_class(format): diff --git a/openlp/plugins/bibles/lib/olp1import.py b/openlp/plugins/bibles/lib/olp1import.py new file mode 100755 index 000000000..75bb2e643 --- /dev/null +++ b/openlp/plugins/bibles/lib/olp1import.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +import logging +import sqlite + +#from openlp.core.lib import Receiver +from db import BibleDB + +log = logging.getLogger(__name__) + +class OpenLPv1BibleImporter(BibleDB): + """ + This class provides the OpenLPv1 bible importer. + """ + def _init__(self, parent, **kwargs): + """ + Constructor. + """ + BibleDB.__init__(self, parent, **kwargs) + if 'filename' not in kwargs: + raise KeyError(u'You have to supply a file name to import from.') + self.filename = kwargs['filename'] +# QtCore.QObject.connect(Receiver.get_receiver(), +# QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import) + + def do_import(self): + """ + Imports an openlp.org v1 bible. + """ + connection = None + cursor = None + #self.wizard.incrementProgressBar(u'Preparing for import...') + try: + connection = sqlite.connect(self.filename) + cursor = connection.cursor() + except: + return False + # Import the meta data. + cursor.execute(u'SELECT "key", "value" FROM metadata') + meta_data = cursor.fetchall() + for data in meta_data: + key = unicode(data[0], u'cp1252') + value = unicode(data[1], u'cp1252') + if key == u'Permission': + key = u'Permissions' + self.create_meta(self, key, value) + # Import the testaments. + cursor.execute(u'SELECT id, name FROM testament') + testaments = cursor.fetchall() + for testament in testaments: + id = int(testament[0]) + name = unicode(testament[1], u'cp1252') + sql_params = (id, name) + # TODO: complete testament import. + # Import books. + cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book') + books = cursor.fetchall() + for book in books: + testament_id = int(book[1]) + name = unicode(book[2], u'cp1252') + abbreviation = unicode(book[3], u'cp1252') + self.create_book(name, abbreviation, testament_id) + # Import chapters/verses. + cursor.execute(u'SELECT id, book_id, chapter, verse, text || \'\' AS ' + 'text FROM verse') + verses = old_cursor.fetchall() + for verse in verses: + book_id = int(verse[1]) + chapter = int(verse[2]) + verse_number = int(verse[3]) + text = unicode(verse[4], u'cp1252') + self.create_verse(book_id, chapter, verse_number, text) + return True + From b8e6da0417857ee4eddf6ffbf419016abaa6dda0 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 5 Dec 2010 16:47:23 +0100 Subject: [PATCH 02/18] completed work --- openlp/plugins/bibles/lib/olp1.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/openlp/plugins/bibles/lib/olp1.py b/openlp/plugins/bibles/lib/olp1.py index c0106a980..cc5a5550e 100755 --- a/openlp/plugins/bibles/lib/olp1.py +++ b/openlp/plugins/bibles/lib/olp1.py @@ -73,15 +73,17 @@ class OpenLP1Bible(BibleDB): self.create_book(name, abbreviation, testament_id) self.session.commit() # Import chapters/verses. - cursor.execute(u'SELECT id, book_id, chapter, verse, text || \'\' AS ' - 'text FROM verse') - verses = cursor.fetchall() - for verse in verses: - book_id = int(verse[1]) - chapter = int(verse[2]) - verse_number = int(verse[3]) - text = unicode(verse[4], u'cp1252') - self.create_verse(book_id, chapter, verse_number, text) - self.session.commit() + for book in books: + print u'Importiere %s' % book + cursor.execute(u'SELECT id, book_id, chapter, verse, text || \'\' ' + 'AS text FROM verse WHERE book_id=%s' % book) + verses = cursor.fetchall() + for verse in verses: + book_id = int(verse[1]) + chapter = int(verse[2]) + verse_number = int(verse[3]) + text = unicode(verse[4], u'cp1252') + self.create_verse(book_id, chapter, verse_number, text) + self.session.commit() return True From e3cb6a6508375e377e6b0ae94ebef4452d5624b4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 5 Dec 2010 17:07:16 +0100 Subject: [PATCH 03/18] changed --- openlp/plugins/bibles/lib/olp1.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/openlp/plugins/bibles/lib/olp1.py b/openlp/plugins/bibles/lib/olp1.py index cc5a5550e..98a7e4da7 100755 --- a/openlp/plugins/bibles/lib/olp1.py +++ b/openlp/plugins/bibles/lib/olp1.py @@ -63,27 +63,25 @@ class OpenLP1Bible(BibleDB): cursor = connection.cursor() except: return False - # Import books. + # Create all books. cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book') books = cursor.fetchall() for book in books: + book_id = int(book[0]) testament_id = int(book[1]) name = unicode(book[2], u'cp1252') abbreviation = unicode(book[3], u'cp1252') + self.wizard.incrementProgressBar(unicode('%s %s' % (translate( + 'BiblesPlugin.olp1', 'Importing'), name))) self.create_book(name, abbreviation, testament_id) - self.session.commit() - # Import chapters/verses. - for book in books: - print u'Importiere %s' % book - cursor.execute(u'SELECT id, book_id, chapter, verse, text || \'\' ' - 'AS text FROM verse WHERE book_id=%s' % book) + # Import the verses for this book. + cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM ' + 'verse WHERE book_id=%s' % book_id) verses = cursor.fetchall() for verse in verses: - book_id = int(verse[1]) - chapter = int(verse[2]) - verse_number = int(verse[3]) - text = unicode(verse[4], u'cp1252') + chapter = int(verse[0]) + verse_number = int(verse[1]) + text = unicode(verse[2], u'cp1252') self.create_verse(book_id, chapter, verse_number, text) - self.session.commit() + self.session.commit() return True - From d5e0643b4552ec2dcd91f07b6cfb1e433cb5fec8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 6 Dec 2010 20:30:04 +0100 Subject: [PATCH 04/18] attempt to clean up bible importers --- .../plugins/bibles/forms/bibleimportform.py | 13 ++++--- openlp/plugins/bibles/lib/csvbible.py | 25 ++++++-------- openlp/plugins/bibles/lib/http.py | 13 ++----- openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/bibles/lib/olp1.py | 27 ++++++++------- openlp/plugins/bibles/lib/opensong.py | 11 ++---- openlp/plugins/bibles/lib/osis.py | 34 ++++++++----------- 7 files changed, 56 insertions(+), 69 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 4a3b8ecde..f4f527e6b 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -405,6 +405,9 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): Receiver.send_message(u'openlp_process_events') def preImport(self): + """ + Prepare the UI for the import. + """ bible_type = self.field(u'source_format').toInt()[0] self.finishButton.setVisible(False) self.ImportProgressBar.setMinimum(0) @@ -420,6 +423,9 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): Receiver.send_message(u'openlp_process_events') def performImport(self): + """ + Perform the actual import. + """ bible_type = self.field(u'source_format').toInt()[0] license_version = unicode(self.field(u'license_version').toString()) license_copyright = unicode(self.field(u'license_copyright').toString()) @@ -469,7 +475,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): elif bible_type == BibleFormat.OLP1: # Import an openlp.org 1.x bible. importer = self.manager.import_bible(BibleFormat.OLP1, - name=license_version, + name=license_version, filename=unicode(self.field(u'OLP1_location').toString()) ) if importer.do_import(): @@ -485,9 +491,8 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): self.ImportProgressLabel.setText(translate( 'BiblesPlugin.ImportWizardForm', 'Finished import.')) else: - self.ImportProgressLabel.setText( - translate('BiblesPlugin.ImportWizardForm', - 'Your Bible import failed.')) + self.ImportProgressLabel.setText(translate( + 'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.')) delete_database(self.bibleplugin.settingsSection, importer.file) def postImport(self): diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index cc981059c..2b92891ab 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -30,7 +30,7 @@ import csv from PyQt4 import QtCore -from openlp.core.lib import Receiver +from openlp.core.lib import Receiver, translate from db import BibleDB log = logging.getLogger(__name__) @@ -46,28 +46,25 @@ class CSVBible(BibleDB): This class assumes the files contain all the information and a clean bible is being loaded. """ - BibleDB.__init__(self, parent, **kwargs) log.info(self.__class__.__name__) - if u'booksfile' not in kwargs: - raise KeyError(u'You have to supply a file to import books from.') + BibleDB.__init__(self, parent, **kwargs) self.booksfile = kwargs[u'booksfile'] - if u'versefile' not in kwargs: - raise KeyError(u'You have to supply a file to import verses from.') self.versesfile = kwargs[u'versefile'] QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import) def do_import(self): - #Populate the Tables success = True books_file = None + book_ptr = None + verse_file = None + # Populate the Tables try: books_file = open(self.booksfile, 'r') dialect = csv.Sniffer().sniff(books_file.read(1024)) books_file.seek(0) books_reader = csv.reader(books_file, dialect) for line in books_reader: - # cancel pressed if self.stop_import_flag: break details = chardet.detect(line[1]) @@ -82,25 +79,24 @@ class CSVBible(BibleDB): books_file.close() if not success: return False - verse_file = None try: - book_ptr = None verse_file = open(self.versesfile, 'r') dialect = csv.Sniffer().sniff(verse_file.read(1024)) verse_file.seek(0) verse_reader = csv.reader(verse_file, dialect) for line in verse_reader: - if self.stop_import_flag: # cancel pressed + if self.stop_import_flag: break details = chardet.detect(line[3]) if book_ptr != line[0]: book = self.get_book(line[0]) book_ptr = book.name - self.wizard.incrementProgressBar( - u'Importing %s %s' % (book.name, line[1])) + self.wizard.incrementProgressBar(u'%s %s %s...' % ( + translate('BiblesPlugin.CSVImport', 'Importing'), + book.name, line[1])) self.session.commit() self.create_verse(book.id, line[1], line[2], - unicode(line[3], details['encoding'])) + unicode(line[3], details['encoding'])) Receiver.send_message(u'openlp_process_events') self.session.commit() except IOError: @@ -110,7 +106,6 @@ class CSVBible(BibleDB): if verse_file: verse_file.close() if self.stop_import_flag: - self.wizard.incrementProgressBar(u'Import canceled!') return False else: return success diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index fa47dd7f5..dade3ad44 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -333,24 +333,17 @@ class HTTPBible(BibleDB): Init confirms the bible exists and stores the database path. """ BibleDB.__init__(self, parent, **kwargs) - if u'download_source' not in kwargs: - raise KeyError(u'Missing keyword argument "download_source"') - if u'download_name' not in kwargs: - raise KeyError(u'Missing keyword argument "download_name"') self.download_source = kwargs[u'download_source'] self.download_name = kwargs[u'download_name'] + self.proxy_server = None + self.proxy_username = None + self.proxy_password = None if u'proxy_server' in kwargs: self.proxy_server = kwargs[u'proxy_server'] - else: - self.proxy_server = None if u'proxy_username' in kwargs: self.proxy_username = kwargs[u'proxy_username'] - else: - self.proxy_username = None if u'proxy_password' in kwargs: self.proxy_password = kwargs[u'proxy_password'] - else: - self.proxy_password = None def do_import(self): """ diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 737822016..d2c281877 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -34,10 +34,10 @@ from openlp.plugins.bibles.lib import parse_reference from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta from csvbible import CSVBible +from http import HTTPBible from olp1 import OpenLP1Bible from opensong import OpenSongBible from osis import OSISBible -from http import HTTPBible log = logging.getLogger(__name__) diff --git a/openlp/plugins/bibles/lib/olp1.py b/openlp/plugins/bibles/lib/olp1.py index 4655289a6..6e453c3b3 100755 --- a/openlp/plugins/bibles/lib/olp1.py +++ b/openlp/plugins/bibles/lib/olp1.py @@ -27,8 +27,9 @@ import logging import sqlite -#from openlp.core.lib import Receiver, translate -from openlp.core.lib import translate +from PyQt4 import QtCore + +from openlp.core.lib import Receiver, translate from db import BibleDB log = logging.getLogger(__name__) @@ -41,22 +42,19 @@ class OpenLP1Bible(BibleDB): """ Constructor. """ - log.debug(__name__) + log.debug(self.__class__.__name__) BibleDB.__init__(self, parent, **kwargs) - if 'filename' not in kwargs: - raise KeyError(u'You have to supply a file name to import from.') - self.filename = kwargs['filename'] -# QtCore.QObject.connect(Receiver.get_receiver(), -# QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import) + self.filename = kwargs[u'filename'] + self.name = kwargs[u'name'] + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import) def do_import(self): """ Imports an openlp.org v1 bible. """ - # TODO: stop_import_flag connection = None cursor = None - self.wizard.incrementProgressBar(u'Preparing for import...') try: connection = sqlite.connect(self.filename) cursor = connection.cursor() @@ -66,18 +64,23 @@ class OpenLP1Bible(BibleDB): cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book') books = cursor.fetchall() for book in books: + if self.stop_import_flag: + return False book_id = int(book[0]) testament_id = int(book[1]) name = unicode(book[2], u'cp1252') abbreviation = unicode(book[3], u'cp1252') - self.wizard.incrementProgressBar(unicode('%s %s' % (translate( - 'BiblesPlugin.olp1', 'Importing'), name))) self.create_book(name, abbreviation, testament_id) + # Update the progess bar. + self.wizard.incrementProgressBar(u'%s %s...' % (translate( + 'BiblesPlugin.OpenLP1Import', 'Importing'), name)) # Import the verses for this book. cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM ' 'verse WHERE book_id=%s' % book_id) verses = cursor.fetchall() for verse in verses: + if self.stop_import_flag: + return False chapter = int(verse[0]) verse_number = int(verse[1]) text = unicode(verse[2], u'cp1252') diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index 8644a9f47..14454a69f 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -44,10 +44,8 @@ class OpenSongBible(BibleDB): Constructor to create and set up an instance of the OpenSongBible class. This class is used to import Bibles from OpenSong's XML format. """ - log.debug(__name__) + log.debug(self.__class__.__name__) BibleDB.__init__(self, parent, **kwargs) - if 'filename' not in kwargs: - raise KeyError(u'You have to supply a file name to import from.') self.filename = kwargs['filename'] QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import) @@ -59,7 +57,6 @@ class OpenSongBible(BibleDB): log.debug(u'Starting OpenSong import from "%s"' % self.filename) if not isinstance(self.filename, unicode): self.filename = unicode(self.filename, u'utf8') - self.wizard.incrementProgressBar(u'Preparing for import...') file = None success = True try: @@ -87,10 +84,9 @@ class OpenSongBible(BibleDB): unicode(verse.text) ) Receiver.send_message(u'openlp_process_events') - self.wizard.incrementProgressBar( - QtCore.QString('%s %s %s' % ( + self.wizard.incrementProgressBar(u'%s %s %s...' % ( translate('BiblesPlugin.Opensong', 'Importing'), - db_book.name, chapter.attrib[u'n']))) + db_book.name, chapter.attrib[u'n'])) self.session.commit() except IOError: log.exception(u'Loading bible from OpenSong file failed') @@ -99,7 +95,6 @@ class OpenSongBible(BibleDB): if file: file.close() if self.stop_import_flag: - self.wizard.incrementProgressBar(u'Import canceled!') return False else: return success diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index a0b6a1828..53a6f152c 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -33,7 +33,7 @@ import re from PyQt4 import QtCore -from openlp.core.lib import Receiver +from openlp.core.lib import Receiver, translate from openlp.core.utils import AppLocation from db import BibleDB @@ -50,11 +50,11 @@ class OSISBible(BibleDB): Constructor to create and set up an instance of the OpenSongBible class. This class is used to import Bibles from OpenSong's XML format. """ - log.debug(__name__) + log.debug(self.__class__.__name__) BibleDB.__init__(self, parent, **kwargs) - if u'filename' not in kwargs: - raise KeyError(u'You have to supply a file name to import from.') self.filename = kwargs[u'filename'] + fbibles = None + self.books = {} self.verse_regex = re.compile( r'(.*?)') self.note_regex = re.compile(r'(.*?)') @@ -72,11 +72,9 @@ class OSISBible(BibleDB): self.divineName_regex = re.compile( r'(.*?)') self.spaces_regex = re.compile(r'([ ]{2,})') - self.books = {} filepath = os.path.join( AppLocation.get_directory(AppLocation.PluginsDir), u'bibles', u'resources', u'osisbooks.csv') - fbibles = None try: fbibles = open(filepath, u'r') for line in fbibles: @@ -96,9 +94,15 @@ class OSISBible(BibleDB): Loads a Bible from file. """ log.debug(u'Starting OSIS import from "%s"' % self.filename) - self.wizard.incrementProgressBar( - u'Detecting encoding (this may take a few minutes)...') detect_file = None + db_book = None + osis = None + success = True + last_chapter = 0 + testament = 1 + match_count = 0 + self.wizard.incrementProgressBar(translate('BiblesPlugin.OsisImport', + 'Detecting encoding (this may take a few minutes)...')) try: detect_file = open(self.filename, u'r') details = chardet.detect(detect_file.read(1048576)) @@ -108,14 +112,8 @@ class OSISBible(BibleDB): finally: if detect_file: detect_file.close() - osis = None - success = True try: osis = codecs.open(self.filename, u'r', details['encoding']) - last_chapter = 0 - testament = 1 - match_count = 0 - db_book = None for file_record in osis: if self.stop_import_flag: break @@ -142,9 +140,9 @@ class OSISBible(BibleDB): if last_chapter != chapter: if last_chapter != 0: self.session.commit() - self.wizard.incrementProgressBar( - u'Importing %s %s...' % \ - (self.books[match.group(1)][0], chapter)) + self.wizard.incrementProgressBar(u'%s %s %s...' % ( + translate('BiblesPlugin.OsisImport', 'Importing'), + self.books[match.group(1)][0], chapter)) last_chapter = chapter # All of this rigmarol below is because the mod2osis # tool from the Sword library embeds XML in the OSIS @@ -171,7 +169,6 @@ class OSISBible(BibleDB): self.create_verse(db_book.id, chapter, verse, verse_text) Receiver.send_message(u'openlp_process_events') self.session.commit() - self.wizard.incrementProgressBar(u'Finishing import...') if match_count == 0: success = False except (ValueError, IOError): @@ -181,7 +178,6 @@ class OSISBible(BibleDB): if osis: osis.close() if self.stop_import_flag: - self.wizard.incrementProgressBar(u'Import canceled!') return False else: return success From 6fd338c492501d5c00d8197c2448e297245fdba2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 7 Dec 2010 17:34:19 +0100 Subject: [PATCH 05/18] tweaked importer --- openlp/plugins/bibles/lib/olp1.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/olp1.py b/openlp/plugins/bibles/lib/olp1.py index 6e453c3b3..7bd47d99f 100755 --- a/openlp/plugins/bibles/lib/olp1.py +++ b/openlp/plugins/bibles/lib/olp1.py @@ -85,5 +85,6 @@ class OpenLP1Bible(BibleDB): verse_number = int(verse[1]) text = unicode(verse[2], u'cp1252') self.create_verse(book_id, chapter, verse_number, text) - self.session.commit() + Receiver.send_message(u'openlp_process_events') + self.session.commit() return True From 12e7c96463fb5ac0ffaee3083a72cfc9efe5620b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 8 Dec 2010 18:18:12 +0100 Subject: [PATCH 06/18] camelCase changes --- .../plugins/bibles/forms/bibleimportform.py | 130 ++-- .../plugins/bibles/forms/bibleimportwizard.py | 640 +++++++++--------- 2 files changed, 385 insertions(+), 385 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index f4f527e6b..3255eb7a6 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -31,7 +31,7 @@ import os.path from PyQt4 import QtCore, QtGui -from bibleimportwizard import Ui_BibleImportWizard +from bibleimportwizard import Ui_bibleImportWizard from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.lib.db import delete_database from openlp.core.utils import AppLocation @@ -54,7 +54,7 @@ class WebDownload(object): return cls.Names[name] -class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): +class BibleImportForm(QtGui.QWizard, Ui_bibleImportWizard): """ This is the Bible Import Wizard, which allows easy importing of Bibles into OpenLP from other formats like OSIS, CSV and OpenSong. @@ -84,22 +84,22 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): self.manager.set_process_dialog(self) self.web_bible_list = {} self.loadWebBibles() - QtCore.QObject.connect(self.LocationComboBox, + QtCore.QObject.connect(self.locationComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onLocationComboBoxChanged) - QtCore.QObject.connect(self.OsisFileButton, + QtCore.QObject.connect(self.osisFileButton, QtCore.SIGNAL(u'clicked()'), self.onOsisFileButtonClicked) - QtCore.QObject.connect(self.BooksFileButton, + QtCore.QObject.connect(self.booksFileButton, QtCore.SIGNAL(u'clicked()'), self.onBooksFileButtonClicked) - QtCore.QObject.connect(self.CsvVersesFileButton, + QtCore.QObject.connect(self.csvVersesFileButton, QtCore.SIGNAL(u'clicked()'), self.onCsvVersesFileButtonClicked) - QtCore.QObject.connect(self.OpenSongBrowseButton, + QtCore.QObject.connect(self.openSongBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onOpenSongBrowseButtonClicked) - QtCore.QObject.connect(self.OLP1FileButton, + QtCore.QObject.connect(self.openlp1FileButton, QtCore.SIGNAL(u'clicked()'), self.onOLP1FileButtonClicked) QtCore.QObject.connect(self.cancelButton, @@ -143,7 +143,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'You need to specify a file with books of ' 'the Bible to use in the import.')) - self.BooksLocationEdit.setFocus() + self.booksLocationEdit.setFocus() return False elif not self.field(u'csv_versefile').toString(): QtGui.QMessageBox.critical(self, @@ -152,7 +152,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'You need to specify a file of Bible ' 'verses to import.')) - self.CsvVerseLocationEdit.setFocus() + self.csvVerseLocationEdit.setFocus() return False elif self.field(u'source_format').toInt()[0] == \ BibleFormat.OpenSong: @@ -163,7 +163,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'You need to specify an OpenSong Bible ' 'file to import.')) - self.OpenSongFileEdit.setFocus() + self.openSongFileEdit.setFocus() return False elif self.field(u'source_format').toInt()[0] == BibleFormat.OLP1: if not self.field(u'OLP1_location').toString(): @@ -173,7 +173,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'You need to specify a file to import your ' 'Bible from.')) - self.OLP1LocationEdit.setFocus() + self.openlp1LocationEdit.setFocus() return False return True elif self.currentId() == 2: @@ -187,7 +187,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): 'Empty Version Name'), translate('BiblesPlugin.ImportWizardForm', 'You need to specify a version name for your Bible.')) - self.VersionNameEdit.setFocus() + self.versionNameEdit.setFocus() return False elif not license_copyright: QtGui.QMessageBox.critical(self, @@ -196,7 +196,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'You need to set a copyright for your Bible. ' 'Bibles in the Public Domain need to be marked as such.')) - self.CopyrightEdit.setFocus() + self.copyrightEdit.setFocus() return False elif self.manager.exists(license_version): QtGui.QMessageBox.critical(self, @@ -204,7 +204,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'This Bible already exists. Please import ' 'a different Bible or first delete the existing one.')) - self.VersionNameEdit.setFocus() + self.versionNameEdit.setFocus() return False return True if self.currentId() == 3: @@ -219,12 +219,12 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): ``index`` The index of the combo box. """ - self.BibleComboBox.clear() + self.bibleComboBox.clear() bibles = [unicode(translate('BiblesPlugin.ImportWizardForm', bible)) for bible in self.web_bible_list[index].keys()] bibles.sort() for bible in bibles: - self.BibleComboBox.addItem(bible) + self.bibleComboBox.addItem(bible) def onOsisFileButtonClicked(self): """ @@ -240,14 +240,14 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): """ self.getFileName( translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'), - self.BooksLocationEdit) + self.booksLocationEdit) def onCsvVersesFileButtonClicked(self): """ Show the file open dialog for the verses CSV file. """ self.getFileName(translate('BiblesPlugin.ImportWizardForm', - 'Open Verses CSV File'), self.CsvVerseLocationEdit) + 'Open Verses CSV File'), self.csvVerseLocationEdit) def onOpenSongBrowseButtonClicked(self): """ @@ -255,7 +255,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): """ self.getFileName( translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'), - self.OpenSongFileEdit) + self.openSongFileEdit) def onOLP1FileButtonClicked(self): """ @@ -263,7 +263,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): """ self.getFileName( translate('BiblesPlugin.ImportWizardForm', - 'Open openlp.org 1.x Bible'), self.OLP1LocationEdit) + 'Open openlp.org 1.x Bible'), self.openlp1LocationEdit) def onCancelButtonClicked(self, checked): """ @@ -280,34 +280,34 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): self.postImport() def registerFields(self): - self.SelectPage.registerField( - u'source_format', self.FormatComboBox) - self.SelectPage.registerField( + self.selectPage.registerField( + u'source_format', self.formatComboBox) + self.selectPage.registerField( u'osis_location', self.OSISLocationEdit) - self.SelectPage.registerField( - u'csv_booksfile', self.BooksLocationEdit) - self.SelectPage.registerField( - u'csv_versefile', self.CsvVerseLocationEdit) - self.SelectPage.registerField( - u'opensong_file', self.OpenSongFileEdit) - self.SelectPage.registerField( - u'web_location', self.LocationComboBox) - self.SelectPage.registerField( - u'web_biblename', self.BibleComboBox) - self.SelectPage.registerField( - u'proxy_server', self.AddressEdit) - self.SelectPage.registerField( - u'proxy_username', self.UsernameEdit) - self.SelectPage.registerField( - u'proxy_password', self.PasswordEdit) - self.SelectPage.registerField( - u'OLP1_location', self.OLP1LocationEdit) - self.LicenseDetailsPage.registerField( - u'license_version', self.VersionNameEdit) - self.LicenseDetailsPage.registerField( - u'license_copyright', self.CopyrightEdit) - self.LicenseDetailsPage.registerField( - u'license_permissions', self.PermissionsEdit) + self.selectPage.registerField( + u'csv_booksfile', self.booksLocationEdit) + self.selectPage.registerField( + u'csv_versefile', self.csvVerseLocationEdit) + self.selectPage.registerField( + u'opensong_file', self.openSongFileEdit) + self.selectPage.registerField( + u'web_location', self.locationComboBox) + self.selectPage.registerField( + u'web_biblename', self.bibleComboBox) + self.selectPage.registerField( + u'proxy_server', self.addressEdit) + self.selectPage.registerField( + u'proxy_username', self.usernameEdit) + self.selectPage.registerField( + u'proxy_password', self.passwordEdit) + self.selectPage.registerField( + u'OLP1_location', self.openlp1LocationEdit) + self.licenseDetailsPage.registerField( + u'license_version', self.versionNameEdit) + self.licenseDetailsPage.registerField( + u'license_copyright', self.copyrightEdit) + self.licenseDetailsPage.registerField( + u'license_permissions', self.permissionsEdit) def setDefaults(self): settings = QtCore.QSettings() @@ -322,7 +322,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): self.setField(u'opensong_file', QtCore.QVariant('')) self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk)) self.setField(u'web_biblename', - QtCore.QVariant(self.BibleComboBox.currentIndex())) + QtCore.QVariant(self.bibleComboBox.currentIndex())) self.setField(u'proxy_server', settings.value(u'proxy address', QtCore.QVariant(u''))) self.setField(u'proxy_username', @@ -331,11 +331,11 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): settings.value(u'proxy password', QtCore.QVariant(u''))) self.setField(u'OLP1_location', QtCore.QVariant('')) self.setField(u'license_version', - QtCore.QVariant(self.VersionNameEdit.text())) + QtCore.QVariant(self.versionNameEdit.text())) self.setField(u'license_copyright', - QtCore.QVariant(self.CopyrightEdit.text())) + QtCore.QVariant(self.copyrightEdit.text())) self.setField(u'license_permissions', - QtCore.QVariant(self.PermissionsEdit.text())) + QtCore.QVariant(self.permissionsEdit.text())) self.onLocationComboBoxChanged(WebDownload.Crosswalk) settings.endGroup() @@ -400,8 +400,8 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): def incrementProgressBar(self, status_text): log.debug(u'IncrementBar %s', status_text) - self.ImportProgressLabel.setText(status_text) - self.ImportProgressBar.setValue(self.ImportProgressBar.value() + 1) + self.importProgressLabel.setText(status_text) + self.importProgressBar.setValue(self.importProgressBar.value() + 1) Receiver.send_message(u'openlp_process_events') def preImport(self): @@ -410,15 +410,15 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): """ bible_type = self.field(u'source_format').toInt()[0] self.finishButton.setVisible(False) - self.ImportProgressBar.setMinimum(0) - self.ImportProgressBar.setMaximum(1188) - self.ImportProgressBar.setValue(0) + self.importProgressBar.setMinimum(0) + self.importProgressBar.setMaximum(1188) + self.importProgressBar.setValue(0) if bible_type == BibleFormat.WebDownload: - self.ImportProgressLabel.setText(translate( + self.importProgressLabel.setText(translate( 'BiblesPlugin.ImportWizardForm', 'Starting Registering bible...')) else: - self.ImportProgressLabel.setText(translate( + self.importProgressLabel.setText(translate( 'BiblesPlugin.ImportWizardForm', 'Starting import...')) Receiver.send_message(u'openlp_process_events') @@ -453,9 +453,9 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): ) elif bible_type == BibleFormat.WebDownload: # Import a bible from the web. - self.ImportProgressBar.setMaximum(1) + self.importProgressBar.setMaximum(1) download_location = self.field(u'web_location').toInt()[0] - bible_version = unicode(self.BibleComboBox.currentText()) + bible_version = unicode(self.bibleComboBox.currentText()) if download_location == WebDownload.Crosswalk: bible = \ self.web_bible_list[WebDownload.Crosswalk][bible_version] @@ -483,20 +483,20 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): license_copyright, license_permissions) self.manager.reload_bibles() if bible_type == BibleFormat.WebDownload: - self.ImportProgressLabel.setText( + self.importProgressLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Registered ' 'bible. Please note, that verses will be downloaded on\n' 'demand and thus an internet connection is required.')) else: - self.ImportProgressLabel.setText(translate( + self.importProgressLabel.setText(translate( 'BiblesPlugin.ImportWizardForm', 'Finished import.')) else: - self.ImportProgressLabel.setText(translate( + self.importProgressLabel.setText(translate( 'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.')) delete_database(self.bibleplugin.settingsSection, importer.file) def postImport(self): - self.ImportProgressBar.setValue(self.ImportProgressBar.maximum()) + self.importProgressBar.setValue(self.importProgressBar.maximum()) self.finishButton.setVisible(True) self.cancelButton.setVisible(False) Receiver.send_message(u'openlp_process_events') diff --git a/openlp/plugins/bibles/forms/bibleimportwizard.py b/openlp/plugins/bibles/forms/bibleimportwizard.py index bb5049344..d60dfbbea 100644 --- a/openlp/plugins/bibles/forms/bibleimportwizard.py +++ b/openlp/plugins/bibles/forms/bibleimportwizard.py @@ -28,392 +28,392 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate -class Ui_BibleImportWizard(object): - def setupUi(self, BibleImportWizard): - BibleImportWizard.setObjectName(u'BibleImportWizard') - BibleImportWizard.resize(550, 386) - BibleImportWizard.setModal(True) - BibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle) - BibleImportWizard.setOptions( +class Ui_bibleImportWizard(object): + def setupUi(self, bibleImportWizard): + bibleImportWizard.setObjectName(u'bibleImportWizard') + bibleImportWizard.resize(550, 386) + bibleImportWizard.setModal(True) + bibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle) + bibleImportWizard.setOptions( QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage) # Welcome page - self.WelcomePage = QtGui.QWizardPage() - self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, + self.welcomePage = QtGui.QWizardPage() + self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(u':/wizards/wizard_importbible.bmp')) - self.WelcomePage.setObjectName(u'WelcomePage') - self.WelcomeLayout = QtGui.QVBoxLayout(self.WelcomePage) - self.WelcomeLayout.setSpacing(8) - self.WelcomeLayout.setMargin(0) - self.WelcomeLayout.setObjectName(u'WelcomeLayout') - self.TitleLabel = QtGui.QLabel(self.WelcomePage) - self.TitleLabel.setObjectName(u'TitleLabel') - self.WelcomeLayout.addWidget(self.TitleLabel) + self.welcomePage.setObjectName(u'WelcomePage') + self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage) + self.welcomeLayout.setSpacing(8) + self.welcomeLayout.setMargin(0) + self.welcomeLayout.setObjectName(u'WelcomeLayout') + self.titleLabel = QtGui.QLabel(self.welcomePage) + self.titleLabel.setObjectName(u'TitleLabel') + self.welcomeLayout.addWidget(self.titleLabel) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.WelcomeLayout.addItem(spacerItem) - self.InformationLabel = QtGui.QLabel(self.WelcomePage) - self.InformationLabel.setWordWrap(True) - self.InformationLabel.setMargin(10) - self.InformationLabel.setObjectName(u'InformationLabel') - self.WelcomeLayout.addWidget(self.InformationLabel) + self.welcomeLayout.addItem(spacerItem) + self.informationLabel = QtGui.QLabel(self.welcomePage) + self.informationLabel.setWordWrap(True) + self.informationLabel.setMargin(10) + self.informationLabel.setObjectName(u'InformationLabel') + self.welcomeLayout.addWidget(self.informationLabel) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.WelcomeLayout.addItem(spacerItem1) - BibleImportWizard.addPage(self.WelcomePage) + self.welcomeLayout.addItem(spacerItem1) + bibleImportWizard.addPage(self.welcomePage) # Select page - self.SelectPage = QtGui.QWizardPage() - self.SelectPage.setObjectName(u'SelectPage') - self.selectPageLayout = QtGui.QVBoxLayout(self.SelectPage) + self.selectPage = QtGui.QWizardPage() + self.selectPage.setObjectName(u'SelectPage') + self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage) self.selectPageLayout.setSpacing(8) self.selectPageLayout.setMargin(20) self.selectPageLayout.setObjectName(u'selectPageLayout') - self.FormatSelectLayout = QtGui.QHBoxLayout() - self.FormatSelectLayout.setSpacing(8) - self.FormatSelectLayout.setObjectName(u'FormatSelectLayout') - self.FormatLabel = QtGui.QLabel(self.SelectPage) - self.FormatLabel.setObjectName(u'FormatLabel') - self.FormatSelectLayout.addWidget(self.FormatLabel) - self.FormatComboBox = QtGui.QComboBox(self.SelectPage) - self.FormatComboBox.setObjectName(u'FormatComboBox') - self.FormatComboBox.addItem(u'') - self.FormatComboBox.addItem(u'') - self.FormatComboBox.addItem(u'') - self.FormatComboBox.addItem(u'') - self.FormatComboBox.addItem(u'') - self.FormatSelectLayout.addWidget(self.FormatComboBox) + self.formatSelectLayout = QtGui.QHBoxLayout() + self.formatSelectLayout.setSpacing(8) + self.formatSelectLayout.setObjectName(u'FormatSelectLayout') + self.formatLabel = QtGui.QLabel(self.selectPage) + self.formatLabel.setObjectName(u'FormatLabel') + self.formatSelectLayout.addWidget(self.formatLabel) + self.formatComboBox = QtGui.QComboBox(self.selectPage) + self.formatComboBox.setObjectName(u'FormatComboBox') + self.formatComboBox.addItem(u'') + self.formatComboBox.addItem(u'') + self.formatComboBox.addItem(u'') + self.formatComboBox.addItem(u'') + self.formatComboBox.addItem(u'') + self.formatSelectLayout.addWidget(self.formatComboBox) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.FormatSelectLayout.addItem(spacerItem2) - self.selectPageLayout.addLayout(self.FormatSelectLayout) - self.FormatWidget = QtGui.QStackedWidget(self.SelectPage) - self.FormatWidget.setObjectName(u'FormatWidget') + self.formatSelectLayout.addItem(spacerItem2) + self.selectPageLayout.addLayout(self.formatSelectLayout) + self.formatWidget = QtGui.QStackedWidget(self.selectPage) + self.formatWidget.setObjectName(u'FormatWidget') generalIcon = build_icon(u':/general/general_open.png') - self.OsisPage = QtGui.QWidget() - self.OsisPage.setObjectName(u'OsisPage') - self.OsisLayout = QtGui.QFormLayout(self.OsisPage) - self.OsisLayout.setFieldGrowthPolicy( + self.osisPage = QtGui.QWidget() + self.osisPage.setObjectName(u'OsisPage') + self.osisLayout = QtGui.QFormLayout(self.osisPage) + self.osisLayout.setFieldGrowthPolicy( QtGui.QFormLayout.ExpandingFieldsGrow) - self.OsisLayout.setMargin(0) - self.OsisLayout.setSpacing(8) - self.OsisLayout.setObjectName(u'OsisLayout') - self.OsisLocationLabel = QtGui.QLabel(self.OsisPage) - self.OsisLocationLabel.setObjectName(u'OsisLocationLabel') - self.OsisLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.OsisLocationLabel) - self.OsisLocationLayout = QtGui.QHBoxLayout() - self.OsisLocationLayout.setSpacing(8) - self.OsisLocationLayout.setObjectName(u'OsisLocationLayout') - self.OSISLocationEdit = QtGui.QLineEdit(self.OsisPage) + self.osisLayout.setMargin(0) + self.osisLayout.setSpacing(8) + self.osisLayout.setObjectName(u'OsisLayout') + self.osisLocationLabel = QtGui.QLabel(self.osisPage) + self.osisLocationLabel.setObjectName(u'OsisLocationLabel') + self.osisLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.osisLocationLabel) + self.osisLocationLayout = QtGui.QHBoxLayout() + self.osisLocationLayout.setSpacing(8) + self.osisLocationLayout.setObjectName(u'OsisLocationLayout') + self.OSISLocationEdit = QtGui.QLineEdit(self.osisPage) self.OSISLocationEdit.setObjectName(u'OSISLocationEdit') - self.OsisLocationLayout.addWidget(self.OSISLocationEdit) - self.OsisFileButton = QtGui.QToolButton(self.OsisPage) - self.OsisFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) - self.OsisFileButton.setIcon(generalIcon) - self.OsisFileButton.setObjectName(u'OsisFileButton') - self.OsisLocationLayout.addWidget(self.OsisFileButton) - self.OsisLayout.setLayout(1, QtGui.QFormLayout.FieldRole, - self.OsisLocationLayout) - self.FormatWidget.addWidget(self.OsisPage) - self.CsvPage = QtGui.QWidget() - self.CsvPage.setObjectName(u'CsvPage') - self.CsvSourceLayout = QtGui.QFormLayout(self.CsvPage) - self.CsvSourceLayout.setFieldGrowthPolicy( + self.osisLocationLayout.addWidget(self.OSISLocationEdit) + self.osisFileButton = QtGui.QToolButton(self.osisPage) + self.osisFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) + self.osisFileButton.setIcon(generalIcon) + self.osisFileButton.setObjectName(u'OsisFileButton') + self.osisLocationLayout.addWidget(self.osisFileButton) + self.osisLayout.setLayout(1, QtGui.QFormLayout.FieldRole, + self.osisLocationLayout) + self.formatWidget.addWidget(self.osisPage) + self.csvPage = QtGui.QWidget() + self.csvPage.setObjectName(u'CsvPage') + self.csvSourceLayout = QtGui.QFormLayout(self.csvPage) + self.csvSourceLayout.setFieldGrowthPolicy( QtGui.QFormLayout.ExpandingFieldsGrow) - self.CsvSourceLayout.setLabelAlignment(QtCore.Qt.AlignBottom | + self.csvSourceLayout.setLabelAlignment(QtCore.Qt.AlignBottom | QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing) - self.CsvSourceLayout.setFormAlignment(QtCore.Qt.AlignLeading | + self.csvSourceLayout.setFormAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) - self.CsvSourceLayout.setMargin(0) - self.CsvSourceLayout.setSpacing(8) - self.CsvSourceLayout.setObjectName(u'CsvSourceLayout') - self.BooksLocationLabel = QtGui.QLabel(self.CsvPage) - self.BooksLocationLabel.setObjectName(u'BooksLocationLabel') - self.CsvSourceLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.BooksLocationLabel) - self.CsvBooksLayout = QtGui.QHBoxLayout() - self.CsvBooksLayout.setSpacing(8) - self.CsvBooksLayout.setObjectName(u'CsvBooksLayout') - self.BooksLocationEdit = QtGui.QLineEdit(self.CsvPage) - self.BooksLocationEdit.setObjectName(u'BooksLocationEdit') - self.CsvBooksLayout.addWidget(self.BooksLocationEdit) - self.BooksFileButton = QtGui.QToolButton(self.CsvPage) - self.BooksFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) - self.BooksFileButton.setIcon(generalIcon) - self.BooksFileButton.setObjectName(u'BooksFileButton') - self.CsvBooksLayout.addWidget(self.BooksFileButton) - self.CsvSourceLayout.setLayout(0, QtGui.QFormLayout.FieldRole, - self.CsvBooksLayout) - self.VerseLocationLabel = QtGui.QLabel(self.CsvPage) - self.VerseLocationLabel.setObjectName(u'VerseLocationLabel') - self.CsvSourceLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.VerseLocationLabel) - self.CsvVerseLayout = QtGui.QHBoxLayout() - self.CsvVerseLayout.setSpacing(8) - self.CsvVerseLayout.setObjectName(u'CsvVerseLayout') - self.CsvVerseLocationEdit = QtGui.QLineEdit(self.CsvPage) - self.CsvVerseLocationEdit.setObjectName(u'CsvVerseLocationEdit') - self.CsvVerseLayout.addWidget(self.CsvVerseLocationEdit) - self.CsvVersesFileButton = QtGui.QToolButton(self.CsvPage) - self.CsvVersesFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) - self.CsvVersesFileButton.setIcon(generalIcon) - self.CsvVersesFileButton.setObjectName(u'CsvVersesFileButton') - self.CsvVerseLayout.addWidget(self.CsvVersesFileButton) - self.CsvSourceLayout.setLayout(1, QtGui.QFormLayout.FieldRole, - self.CsvVerseLayout) - self.FormatWidget.addWidget(self.CsvPage) - self.OpenSongPage = QtGui.QWidget() - self.OpenSongPage.setObjectName(u'OpenSongPage') - self.OpenSongLayout = QtGui.QFormLayout(self.OpenSongPage) - self.OpenSongLayout.setMargin(0) - self.OpenSongLayout.setSpacing(8) - self.OpenSongLayout.setObjectName(u'OpenSongLayout') - self.OpenSongFileLabel = QtGui.QLabel(self.OpenSongPage) - self.OpenSongFileLabel.setObjectName(u'OpenSongFileLabel') - self.OpenSongLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.OpenSongFileLabel) - self.OpenSongFileLayout = QtGui.QHBoxLayout() - self.OpenSongFileLayout.setSpacing(8) - self.OpenSongFileLayout.setObjectName(u'OpenSongFileLayout') - self.OpenSongFileEdit = QtGui.QLineEdit(self.OpenSongPage) - self.OpenSongFileEdit.setObjectName(u'OpenSongFileEdit') - self.OpenSongFileLayout.addWidget(self.OpenSongFileEdit) - self.OpenSongBrowseButton = QtGui.QToolButton(self.OpenSongPage) - self.OpenSongBrowseButton.setIcon(generalIcon) - self.OpenSongBrowseButton.setObjectName(u'OpenSongBrowseButton') - self.OpenSongFileLayout.addWidget(self.OpenSongBrowseButton) - self.OpenSongLayout.setLayout(0, QtGui.QFormLayout.FieldRole, - self.OpenSongFileLayout) - self.FormatWidget.addWidget(self.OpenSongPage) - self.WebDownloadPage = QtGui.QWidget() - self.WebDownloadPage.setObjectName(u'WebDownloadPage') - self.WebDownloadLayout = QtGui.QVBoxLayout(self.WebDownloadPage) - self.WebDownloadLayout.setSpacing(8) - self.WebDownloadLayout.setMargin(0) - self.WebDownloadLayout.setObjectName(u'WebDownloadLayout') - self.WebDownloadTabWidget = QtGui.QTabWidget(self.WebDownloadPage) - self.WebDownloadTabWidget.setObjectName(u'WebDownloadTabWidget') - self.DownloadOptionsTab = QtGui.QWidget() - self.DownloadOptionsTab.setObjectName(u'DownloadOptionsTab') - self.DownloadOptionsLayout = QtGui.QFormLayout(self.DownloadOptionsTab) - self.DownloadOptionsLayout.setMargin(8) - self.DownloadOptionsLayout.setSpacing(8) - self.DownloadOptionsLayout.setObjectName(u'DownloadOptionsLayout') - self.LocationLabel = QtGui.QLabel(self.DownloadOptionsTab) - self.LocationLabel.setObjectName(u'LocationLabel') - self.DownloadOptionsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.LocationLabel) - self.LocationComboBox = QtGui.QComboBox(self.DownloadOptionsTab) - self.LocationComboBox.setObjectName(u'LocationComboBox') - self.LocationComboBox.addItem(u'') - self.LocationComboBox.addItem(u'') - self.DownloadOptionsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.LocationComboBox) - self.BibleLabel = QtGui.QLabel(self.DownloadOptionsTab) - self.BibleLabel.setObjectName(u'BibleLabel') - self.DownloadOptionsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.BibleLabel) - self.BibleComboBox = QtGui.QComboBox(self.DownloadOptionsTab) - self.BibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) - self.BibleComboBox.setObjectName(u'BibleComboBox') - self.BibleComboBox.addItem(u'') - self.BibleComboBox.addItem(u'') - self.BibleComboBox.addItem(u'') - self.DownloadOptionsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.BibleComboBox) - self.WebDownloadTabWidget.addTab(self.DownloadOptionsTab, u'') - self.ProxyServerTab = QtGui.QWidget() - self.ProxyServerTab.setObjectName(u'ProxyServerTab') - self.ProxyServerLayout = QtGui.QFormLayout(self.ProxyServerTab) - self.ProxyServerLayout.setObjectName(u'ProxyServerLayout') - self.AddressLabel = QtGui.QLabel(self.ProxyServerTab) - self.AddressLabel.setObjectName(u'AddressLabel') - self.ProxyServerLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.AddressLabel) - self.AddressEdit = QtGui.QLineEdit(self.ProxyServerTab) - self.AddressEdit.setObjectName(u'AddressEdit') - self.ProxyServerLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.AddressEdit) - self.UsernameLabel = QtGui.QLabel(self.ProxyServerTab) - self.UsernameLabel.setObjectName(u'UsernameLabel') - self.ProxyServerLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.UsernameLabel) - self.UsernameEdit = QtGui.QLineEdit(self.ProxyServerTab) - self.UsernameEdit.setObjectName(u'UsernameEdit') - self.ProxyServerLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.UsernameEdit) - self.PasswordLabel = QtGui.QLabel(self.ProxyServerTab) - self.PasswordLabel.setObjectName(u'PasswordLabel') - self.ProxyServerLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.PasswordLabel) - self.PasswordEdit = QtGui.QLineEdit(self.ProxyServerTab) - self.PasswordEdit.setObjectName(u'PasswordEdit') - self.ProxyServerLayout.setWidget(2, QtGui.QFormLayout.FieldRole, - self.PasswordEdit) - self.WebDownloadTabWidget.addTab(self.ProxyServerTab, u'') - self.WebDownloadLayout.addWidget(self.WebDownloadTabWidget) - self.FormatWidget.addWidget(self.WebDownloadPage) - self.OLP1Page = QtGui.QWidget() - self.OLP1Page.setObjectName(u'OLP1Page') - self.OLP1Layout = QtGui.QFormLayout(self.OLP1Page) - self.OLP1Layout.setFieldGrowthPolicy( + self.csvSourceLayout.setMargin(0) + self.csvSourceLayout.setSpacing(8) + self.csvSourceLayout.setObjectName(u'CsvSourceLayout') + self.booksLocationLabel = QtGui.QLabel(self.csvPage) + self.booksLocationLabel.setObjectName(u'BooksLocationLabel') + self.csvSourceLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.booksLocationLabel) + self.csvBooksLayout = QtGui.QHBoxLayout() + self.csvBooksLayout.setSpacing(8) + self.csvBooksLayout.setObjectName(u'CsvBooksLayout') + self.booksLocationEdit = QtGui.QLineEdit(self.csvPage) + self.booksLocationEdit.setObjectName(u'BooksLocationEdit') + self.csvBooksLayout.addWidget(self.booksLocationEdit) + self.booksFileButton = QtGui.QToolButton(self.csvPage) + self.booksFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) + self.booksFileButton.setIcon(generalIcon) + self.booksFileButton.setObjectName(u'BooksFileButton') + self.csvBooksLayout.addWidget(self.booksFileButton) + self.csvSourceLayout.setLayout(0, QtGui.QFormLayout.FieldRole, + self.csvBooksLayout) + self.verseLocationLabel = QtGui.QLabel(self.csvPage) + self.verseLocationLabel.setObjectName(u'VerseLocationLabel') + self.csvSourceLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.verseLocationLabel) + self.csvVerseLayout = QtGui.QHBoxLayout() + self.csvVerseLayout.setSpacing(8) + self.csvVerseLayout.setObjectName(u'CsvVerseLayout') + self.csvVerseLocationEdit = QtGui.QLineEdit(self.csvPage) + self.csvVerseLocationEdit.setObjectName(u'CsvVerseLocationEdit') + self.csvVerseLayout.addWidget(self.csvVerseLocationEdit) + self.csvVersesFileButton = QtGui.QToolButton(self.csvPage) + self.csvVersesFileButton.setMaximumSize(QtCore.QSize(32, 16777215)) + self.csvVersesFileButton.setIcon(generalIcon) + self.csvVersesFileButton.setObjectName(u'CsvVersesFileButton') + self.csvVerseLayout.addWidget(self.csvVersesFileButton) + self.csvSourceLayout.setLayout(1, QtGui.QFormLayout.FieldRole, + self.csvVerseLayout) + self.formatWidget.addWidget(self.csvPage) + self.openSongPage = QtGui.QWidget() + self.openSongPage.setObjectName(u'OpenSongPage') + self.openSongLayout = QtGui.QFormLayout(self.openSongPage) + self.openSongLayout.setMargin(0) + self.openSongLayout.setSpacing(8) + self.openSongLayout.setObjectName(u'OpenSongLayout') + self.openSongFileLabel = QtGui.QLabel(self.openSongPage) + self.openSongFileLabel.setObjectName(u'OpenSongFileLabel') + self.openSongLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.openSongFileLabel) + self.openSongFileLayout = QtGui.QHBoxLayout() + self.openSongFileLayout.setSpacing(8) + self.openSongFileLayout.setObjectName(u'OpenSongFileLayout') + self.openSongFileEdit = QtGui.QLineEdit(self.openSongPage) + self.openSongFileEdit.setObjectName(u'OpenSongFileEdit') + self.openSongFileLayout.addWidget(self.openSongFileEdit) + self.openSongBrowseButton = QtGui.QToolButton(self.openSongPage) + self.openSongBrowseButton.setIcon(generalIcon) + self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton') + self.openSongFileLayout.addWidget(self.openSongBrowseButton) + self.openSongLayout.setLayout(0, QtGui.QFormLayout.FieldRole, + self.openSongFileLayout) + self.formatWidget.addWidget(self.openSongPage) + self.webDownloadPage = QtGui.QWidget() + self.webDownloadPage.setObjectName(u'WebDownloadPage') + self.webDownloadLayout = QtGui.QVBoxLayout(self.webDownloadPage) + self.webDownloadLayout.setSpacing(8) + self.webDownloadLayout.setMargin(0) + self.webDownloadLayout.setObjectName(u'WebDownloadLayout') + self.webDownloadTabWidget = QtGui.QTabWidget(self.webDownloadPage) + self.webDownloadTabWidget.setObjectName(u'WebDownloadTabWidget') + self.downloadOptionsTab = QtGui.QWidget() + self.downloadOptionsTab.setObjectName(u'DownloadOptionsTab') + self.downloadOptionsLayout = QtGui.QFormLayout(self.downloadOptionsTab) + self.downloadOptionsLayout.setMargin(8) + self.downloadOptionsLayout.setSpacing(8) + self.downloadOptionsLayout.setObjectName(u'DownloadOptionsLayout') + self.locationLabel = QtGui.QLabel(self.downloadOptionsTab) + self.locationLabel.setObjectName(u'LocationLabel') + self.downloadOptionsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.locationLabel) + self.locationComboBox = QtGui.QComboBox(self.downloadOptionsTab) + self.locationComboBox.setObjectName(u'LocationComboBox') + self.locationComboBox.addItem(u'') + self.locationComboBox.addItem(u'') + self.downloadOptionsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.locationComboBox) + self.bibleLabel = QtGui.QLabel(self.downloadOptionsTab) + self.bibleLabel.setObjectName(u'BibleLabel') + self.downloadOptionsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.bibleLabel) + self.bibleComboBox = QtGui.QComboBox(self.downloadOptionsTab) + self.bibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) + self.bibleComboBox.setObjectName(u'BibleComboBox') + self.bibleComboBox.addItem(u'') + self.bibleComboBox.addItem(u'') + self.bibleComboBox.addItem(u'') + self.downloadOptionsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.bibleComboBox) + self.webDownloadTabWidget.addTab(self.downloadOptionsTab, u'') + self.proxyServerTab = QtGui.QWidget() + self.proxyServerTab.setObjectName(u'ProxyServerTab') + self.proxyServerLayout = QtGui.QFormLayout(self.proxyServerTab) + self.proxyServerLayout.setObjectName(u'ProxyServerLayout') + self.addressLabel = QtGui.QLabel(self.proxyServerTab) + self.addressLabel.setObjectName(u'AddressLabel') + self.proxyServerLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.addressLabel) + self.addressEdit = QtGui.QLineEdit(self.proxyServerTab) + self.addressEdit.setObjectName(u'AddressEdit') + self.proxyServerLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.addressEdit) + self.usernameLabel = QtGui.QLabel(self.proxyServerTab) + self.usernameLabel.setObjectName(u'UsernameLabel') + self.proxyServerLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.usernameLabel) + self.usernameEdit = QtGui.QLineEdit(self.proxyServerTab) + self.usernameEdit.setObjectName(u'UsernameEdit') + self.proxyServerLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.usernameEdit) + self.passwordLabel = QtGui.QLabel(self.proxyServerTab) + self.passwordLabel.setObjectName(u'PasswordLabel') + self.proxyServerLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.passwordLabel) + self.passwordEdit = QtGui.QLineEdit(self.proxyServerTab) + self.passwordEdit.setObjectName(u'PasswordEdit') + self.proxyServerLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.passwordEdit) + self.webDownloadTabWidget.addTab(self.proxyServerTab, u'') + self.webDownloadLayout.addWidget(self.webDownloadTabWidget) + self.formatWidget.addWidget(self.webDownloadPage) + self.openlp1Page = QtGui.QWidget() + self.openlp1Page.setObjectName(u'OLP1Page') + self.openlp1Layout = QtGui.QFormLayout(self.openlp1Page) + self.openlp1Layout.setFieldGrowthPolicy( QtGui.QFormLayout.ExpandingFieldsGrow) - self.OLP1Layout.setMargin(0) - self.OLP1Layout.setSpacing(8) - self.OLP1Layout.setObjectName(u'OLP1Layout') - self.OLP1LocationLabel = QtGui.QLabel(self.OLP1Page) - self.OLP1LocationLabel.setObjectName(u'OLP1LocationLabel') - self.OLP1Layout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.OLP1LocationLabel) - self.OLP1LocationLayout = QtGui.QHBoxLayout() - self.OLP1LocationLayout.setSpacing(8) - self.OLP1LocationLayout.setObjectName(u'OLP1LocationLayout') - self.OLP1LocationEdit = QtGui.QLineEdit(self.OLP1Page) - self.OLP1LocationEdit.setObjectName(u'OLP1LocationEdit') - self.OLP1LocationLayout.addWidget(self.OLP1LocationEdit) - self.OLP1FileButton = QtGui.QToolButton(self.OLP1Page) - self.OLP1FileButton.setMaximumSize(QtCore.QSize(32, 16777215)) - self.OLP1FileButton.setIcon(generalIcon) - self.OLP1FileButton.setObjectName(u'OLP1FileButton') - self.OLP1LocationLayout.addWidget(self.OLP1FileButton) - self.OLP1Layout.setLayout(1, QtGui.QFormLayout.FieldRole, - self.OLP1LocationLayout) - self.FormatWidget.addWidget(self.OLP1Page) - self.selectPageLayout.addWidget(self.FormatWidget) - BibleImportWizard.addPage(self.SelectPage) + self.openlp1Layout.setMargin(0) + self.openlp1Layout.setSpacing(8) + self.openlp1Layout.setObjectName(u'OLP1Layout') + self.openlp1LocationLabel = QtGui.QLabel(self.openlp1Page) + self.openlp1LocationLabel.setObjectName(u'OLP1LocationLabel') + self.openlp1Layout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.openlp1LocationLabel) + self.openlp1LocationLayout = QtGui.QHBoxLayout() + self.openlp1LocationLayout.setSpacing(8) + self.openlp1LocationLayout.setObjectName(u'OLP1LocationLayout') + self.openlp1LocationEdit = QtGui.QLineEdit(self.openlp1Page) + self.openlp1LocationEdit.setObjectName(u'OLP1LocationEdit') + self.openlp1LocationLayout.addWidget(self.openlp1LocationEdit) + self.openlp1FileButton = QtGui.QToolButton(self.openlp1Page) + self.openlp1FileButton.setMaximumSize(QtCore.QSize(32, 16777215)) + self.openlp1FileButton.setIcon(generalIcon) + self.openlp1FileButton.setObjectName(u'OLP1FileButton') + self.openlp1LocationLayout.addWidget(self.openlp1FileButton) + self.openlp1Layout.setLayout(1, QtGui.QFormLayout.FieldRole, + self.openlp1LocationLayout) + self.formatWidget.addWidget(self.openlp1Page) + self.selectPageLayout.addWidget(self.formatWidget) + bibleImportWizard.addPage(self.selectPage) # License page - self.LicenseDetailsPage = QtGui.QWizardPage() - self.LicenseDetailsPage.setObjectName(u'LicenseDetailsPage') - self.LicenseDetailsLayout = QtGui.QFormLayout(self.LicenseDetailsPage) - self.LicenseDetailsLayout.setMargin(20) - self.LicenseDetailsLayout.setSpacing(8) - self.LicenseDetailsLayout.setObjectName(u'LicenseDetailsLayout') - self.VersionNameLabel = QtGui.QLabel(self.LicenseDetailsPage) - self.VersionNameLabel.setObjectName(u'VersionNameLabel') - self.LicenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.VersionNameLabel) - self.VersionNameEdit = QtGui.QLineEdit(self.LicenseDetailsPage) - self.VersionNameEdit.setObjectName(u'VersionNameEdit') - self.LicenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.VersionNameEdit) - self.CopyrightLabel = QtGui.QLabel(self.LicenseDetailsPage) - self.CopyrightLabel.setObjectName(u'CopyrightLabel') - self.LicenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.CopyrightLabel) - self.CopyrightEdit = QtGui.QLineEdit(self.LicenseDetailsPage) - self.CopyrightEdit.setObjectName(u'CopyrightEdit') - self.LicenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, - self.CopyrightEdit) - self.PermissionsLabel = QtGui.QLabel(self.LicenseDetailsPage) - self.PermissionsLabel.setObjectName(u'PermissionsLabel') - self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.PermissionsLabel) - self.PermissionsEdit = QtGui.QLineEdit(self.LicenseDetailsPage) - self.PermissionsEdit.setObjectName(u'PermissionsEdit') - self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, - self.PermissionsEdit) - BibleImportWizard.addPage(self.LicenseDetailsPage) + self.licenseDetailsPage = QtGui.QWizardPage() + self.licenseDetailsPage.setObjectName(u'LicenseDetailsPage') + self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage) + self.licenseDetailsLayout.setMargin(20) + self.licenseDetailsLayout.setSpacing(8) + self.licenseDetailsLayout.setObjectName(u'LicenseDetailsLayout') + self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage) + self.versionNameLabel.setObjectName(u'VersionNameLabel') + self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.versionNameLabel) + self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsPage) + self.versionNameEdit.setObjectName(u'VersionNameEdit') + self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, + self.versionNameEdit) + self.copyrightLabel = QtGui.QLabel(self.licenseDetailsPage) + self.copyrightLabel.setObjectName(u'CopyrightLabel') + self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, + self.copyrightLabel) + self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsPage) + self.copyrightEdit.setObjectName(u'CopyrightEdit') + self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.copyrightEdit) + self.permissionsLabel = QtGui.QLabel(self.licenseDetailsPage) + self.permissionsLabel.setObjectName(u'PermissionsLabel') + self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, + self.permissionsLabel) + self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsPage) + self.permissionsEdit.setObjectName(u'PermissionsEdit') + self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.permissionsEdit) + bibleImportWizard.addPage(self.licenseDetailsPage) # Progress page - self.ImportPage = QtGui.QWizardPage() - self.ImportPage.setObjectName(u'ImportPage') - self.ImportLayout = QtGui.QVBoxLayout(self.ImportPage) - self.ImportLayout.setSpacing(8) - self.ImportLayout.setMargin(50) - self.ImportLayout.setObjectName(u'ImportLayout') - self.ImportProgressLabel = QtGui.QLabel(self.ImportPage) - self.ImportProgressLabel.setObjectName(u'ImportProgressLabel') - self.ImportLayout.addWidget(self.ImportProgressLabel) - self.ImportProgressBar = QtGui.QProgressBar(self.ImportPage) - self.ImportProgressBar.setValue(0) - self.ImportProgressBar.setObjectName(u'ImportProgressBar') - self.ImportLayout.addWidget(self.ImportProgressBar) - BibleImportWizard.addPage(self.ImportPage) + self.importPage = QtGui.QWizardPage() + self.importPage.setObjectName(u'ImportPage') + self.importLayout = QtGui.QVBoxLayout(self.importPage) + self.importLayout.setSpacing(8) + self.importLayout.setMargin(50) + self.importLayout.setObjectName(u'ImportLayout') + self.importProgressLabel = QtGui.QLabel(self.importPage) + self.importProgressLabel.setObjectName(u'ImportProgressLabel') + self.importLayout.addWidget(self.importProgressLabel) + self.importProgressBar = QtGui.QProgressBar(self.importPage) + self.importProgressBar.setValue(0) + self.importProgressBar.setObjectName(u'ImportProgressBar') + self.importLayout.addWidget(self.importProgressBar) + bibleImportWizard.addPage(self.importPage) - self.retranslateUi(BibleImportWizard) - self.FormatWidget.setCurrentIndex(0) - self.WebDownloadTabWidget.setCurrentIndex(0) - QtCore.QObject.connect(self.FormatComboBox, + self.retranslateUi(bibleImportWizard) + self.formatWidget.setCurrentIndex(0) + self.webDownloadTabWidget.setCurrentIndex(0) + QtCore.QObject.connect(self.formatComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), - self.FormatWidget.setCurrentIndex) - QtCore.QMetaObject.connectSlotsByName(BibleImportWizard) + self.formatWidget.setCurrentIndex) + QtCore.QMetaObject.connectSlotsByName(bibleImportWizard) - def retranslateUi(self, BibleImportWizard): - BibleImportWizard.setWindowTitle( + def retranslateUi(self, bibleImportWizard): + bibleImportWizard.setWindowTitle( translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard')) - self.TitleLabel.setText( + self.titleLabel.setText( u'%s' % \ translate('BiblesPlugin.ImportWizardForm', 'Welcome to the Bible Import Wizard')) - self.InformationLabel.setText( + self.informationLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'This wizard will help you to import Bibles from a ' 'variety of formats. Click the next button below to start the ' 'process by selecting a format to import from.')) - self.SelectPage.setTitle(translate('BiblesPlugin.ImportWizardForm', + self.selectPage.setTitle(translate('BiblesPlugin.ImportWizardForm', 'Select Import Source')) - self.SelectPage.setSubTitle( + self.selectPage.setSubTitle( translate('BiblesPlugin.ImportWizardForm', 'Select the import format, and where to import from.')) - self.FormatLabel.setText( + self.formatLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Format:')) - self.FormatComboBox.setItemText(0, + self.formatComboBox.setItemText(0, translate('BiblesPlugin.ImportWizardForm', 'OSIS')) - self.FormatComboBox.setItemText(1, + self.formatComboBox.setItemText(1, translate('BiblesPlugin.ImportWizardForm', 'CSV')) - self.FormatComboBox.setItemText(2, + self.formatComboBox.setItemText(2, translate('BiblesPlugin.ImportWizardForm', 'OpenSong')) - self.FormatComboBox.setItemText(3, + self.formatComboBox.setItemText(3, translate('BiblesPlugin.ImportWizardForm', 'Web Download')) - self.FormatComboBox.setItemText(4, + self.formatComboBox.setItemText(4, translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x')) - self.OLP1LocationLabel.setText( + self.openlp1LocationLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'File location:')) - self.OsisLocationLabel.setText( + self.osisLocationLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'File location:')) - self.BooksLocationLabel.setText( + self.booksLocationLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Books location:')) - self.VerseLocationLabel.setText( + self.verseLocationLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Verse location:')) - self.OpenSongFileLabel.setText( + self.openSongFileLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Bible filename:')) - self.LocationLabel.setText( + self.locationLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Location:')) - self.LocationComboBox.setItemText(0, + self.locationComboBox.setItemText(0, translate('BiblesPlugin.ImportWizardForm', 'Crosswalk')) - self.LocationComboBox.setItemText(1, + self.locationComboBox.setItemText(1, translate('BiblesPlugin.ImportWizardForm', 'BibleGateway')) - self.BibleLabel.setText( + self.bibleLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Bible:')) - self.WebDownloadTabWidget.setTabText( - self.WebDownloadTabWidget.indexOf(self.DownloadOptionsTab), + self.webDownloadTabWidget.setTabText( + self.webDownloadTabWidget.indexOf(self.downloadOptionsTab), translate('BiblesPlugin.ImportWizardForm', 'Download Options')) - self.AddressLabel.setText( + self.addressLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Server:')) - self.UsernameLabel.setText( + self.usernameLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Username:')) - self.PasswordLabel.setText( + self.passwordLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Password:')) - self.WebDownloadTabWidget.setTabText( - self.WebDownloadTabWidget.indexOf(self.ProxyServerTab), + self.webDownloadTabWidget.setTabText( + self.webDownloadTabWidget.indexOf(self.proxyServerTab), translate('BiblesPlugin.ImportWizardForm', 'Proxy Server (Optional)')) - self.LicenseDetailsPage.setTitle( + self.licenseDetailsPage.setTitle( translate('BiblesPlugin.ImportWizardForm', 'License Details')) - self.LicenseDetailsPage.setSubTitle( + self.licenseDetailsPage.setSubTitle( translate('BiblesPlugin.ImportWizardForm', 'Set up the Bible\'s license details.')) - self.VersionNameLabel.setText( + self.versionNameLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Version name:')) - self.CopyrightLabel.setText( + self.copyrightLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Copyright:')) - self.PermissionsLabel.setText( + self.permissionsLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Permissions:')) - self.ImportPage.setTitle( + self.importPage.setTitle( translate('BiblesPlugin.ImportWizardForm', 'Importing')) - self.ImportPage.setSubTitle( + self.importPage.setSubTitle( translate('BiblesPlugin.ImportWizardForm', 'Please wait while your Bible is imported.')) - self.ImportProgressLabel.setText( + self.importProgressLabel.setText( translate('BiblesPlugin.ImportWizardForm', 'Ready.')) - self.ImportProgressBar.setFormat(u'%p%') + self.importProgressBar.setFormat(u'%p%') From b044226332ef9e1ca82cfa5408cb97410ce28e04 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 8 Dec 2010 18:19:51 +0100 Subject: [PATCH 07/18] changed class name --- openlp/plugins/bibles/forms/bibleimportform.py | 4 ++-- openlp/plugins/bibles/forms/bibleimportwizard.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 3255eb7a6..6fcedc28b 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -31,7 +31,7 @@ import os.path from PyQt4 import QtCore, QtGui -from bibleimportwizard import Ui_bibleImportWizard +from bibleimportwizard import uiBibleImportWizard from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.lib.db import delete_database from openlp.core.utils import AppLocation @@ -54,7 +54,7 @@ class WebDownload(object): return cls.Names[name] -class BibleImportForm(QtGui.QWizard, Ui_bibleImportWizard): +class BibleImportForm(QtGui.QWizard, uiBibleImportWizard): """ This is the Bible Import Wizard, which allows easy importing of Bibles into OpenLP from other formats like OSIS, CSV and OpenSong. diff --git a/openlp/plugins/bibles/forms/bibleimportwizard.py b/openlp/plugins/bibles/forms/bibleimportwizard.py index d60dfbbea..c60490086 100644 --- a/openlp/plugins/bibles/forms/bibleimportwizard.py +++ b/openlp/plugins/bibles/forms/bibleimportwizard.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate -class Ui_bibleImportWizard(object): +class uiBibleImportWizard(object): def setupUi(self, bibleImportWizard): bibleImportWizard.setObjectName(u'bibleImportWizard') bibleImportWizard.resize(550, 386) From aca56b78b5165923ba0b21ed3021a5f3669cc812 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 8 Dec 2010 18:46:22 +0100 Subject: [PATCH 08/18] changed olp1 to OpenLP1 --- openlp/plugins/bibles/forms/bibleimportform.py | 6 +++--- openlp/plugins/bibles/lib/manager.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 6fcedc28b..2fd82ed1d 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -165,7 +165,7 @@ class BibleImportForm(QtGui.QWizard, uiBibleImportWizard): 'file to import.')) self.openSongFileEdit.setFocus() return False - elif self.field(u'source_format').toInt()[0] == BibleFormat.OLP1: + elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1: if not self.field(u'OLP1_location').toString(): QtGui.QMessageBox.critical(self, translate('BiblesPlugin.ImportWizardForm', @@ -472,9 +472,9 @@ class BibleImportForm(QtGui.QWizard, uiBibleImportWizard): unicode(self.field(u'proxy_username').toString()), proxy_password=unicode(self.field(u'proxy_password').toString()) ) - elif bible_type == BibleFormat.OLP1: + elif bible_type == BibleFormat.OpenLP1: # Import an openlp.org 1.x bible. - importer = self.manager.import_bible(BibleFormat.OLP1, + importer = self.manager.import_bible(BibleFormat.OpenLP1, name=license_version, filename=unicode(self.field(u'OLP1_location').toString()) ) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index d2c281877..e2639d6ff 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -62,7 +62,7 @@ class BibleFormat(object): CSV = 1 OpenSong = 2 WebDownload = 3 - OLP1 = 4 + OpenLP1 = 4 @staticmethod def get_class(format): @@ -80,7 +80,7 @@ class BibleFormat(object): return OpenSongBible elif format == BibleFormat.WebDownload: return HTTPBible - elif format == BibleFormat.OLP1: + elif format == BibleFormat.OpenLP1: return OpenLP1Bible else: return None @@ -95,7 +95,7 @@ class BibleFormat(object): BibleFormat.CSV, BibleFormat.OpenSong, BibleFormat.WebDownload, - BibleFormat.OLP1 + BibleFormat.OpenLP1 ] From 9f6a0f7c641389034625967b559c8e43e1a0aa7c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 8 Dec 2010 18:56:29 +0100 Subject: [PATCH 09/18] moved file --- openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/bibles/lib/{olp1.py => openlp1.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename openlp/plugins/bibles/lib/{olp1.py => openlp1.py} (100%) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index e2639d6ff..794c9c5f7 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -35,7 +35,7 @@ from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta from csvbible import CSVBible from http import HTTPBible -from olp1 import OpenLP1Bible +from openlp1 import OpenLP1Bible from opensong import OpenSongBible from osis import OSISBible diff --git a/openlp/plugins/bibles/lib/olp1.py b/openlp/plugins/bibles/lib/openlp1.py similarity index 100% rename from openlp/plugins/bibles/lib/olp1.py rename to openlp/plugins/bibles/lib/openlp1.py From c33654c68c169a5e7cf918bd25b1c0932a3ec392 Mon Sep 17 00:00:00 2001 From: M2j Date: Wed, 8 Dec 2010 23:55:28 +0100 Subject: [PATCH 10/18] Bug #659019 --- openlp/plugins/songs/forms/songimportform.py | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 67ef4d8c1..a2a915efd 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -118,9 +118,6 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): QtCore.QObject.connect(self.songBeamerRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onSongBeamerRemoveButtonClicked) - QtCore.QObject.connect(self.cancelButton, - QtCore.SIGNAL(u'clicked(bool)'), - self.onCancelButtonClicked) QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged) @@ -132,6 +129,17 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): self.setDefaults() return QtGui.QWizard.exec_(self) + def reject(self): + """ + Stop the import on pressing the cancel or close button. + """ + log.debug('Import canceled by user.') + if self.currentId() == 2: + Receiver.send_message(u'songs_stop_import') + else: + self.hide() + self.setResult(-1) + def validateCurrentPage(self): """ Validate the current page before moving on to the next page. @@ -394,14 +402,6 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): def onSongBeamerRemoveButtonClicked(self): self.removeSelectedItems(self.songBeamerFileListWidget) - def onCancelButtonClicked(self, checked): - """ - Stop the import on pressing the cancel button. - """ - log.debug('Cancel button pressed!') - if self.currentId() == 2: - Receiver.send_message(u'songs_stop_import') - def onCurrentIdChanged(self, id): if id == 2: self.preImport() From b465d763cda7efe8e6852bf61dbfdb589ad6dd30 Mon Sep 17 00:00:00 2001 From: M2j Date: Thu, 9 Dec 2010 00:33:38 +0100 Subject: [PATCH 11/18] use the same call as in the Qt sources --- openlp/plugins/songs/forms/songimportform.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index a2a915efd..cade0254a 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -131,14 +131,13 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): def reject(self): """ - Stop the import on pressing the cancel or close button. + Stop the import on cancel button, close button or ESC key. """ log.debug('Import canceled by user.') if self.currentId() == 2: Receiver.send_message(u'songs_stop_import') else: - self.hide() - self.setResult(-1) + self.done(QtGui.QDialog.Rejected) def validateCurrentPage(self): """ From 20b1c33a4b43e1cab5cc9ec046a35e02cd045841 Mon Sep 17 00:00:00 2001 From: M2j Date: Thu, 9 Dec 2010 00:40:28 +0100 Subject: [PATCH 12/18] making 'cancel bible import' work --- .../plugins/bibles/forms/bibleimportform.py | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 749f1f938..98fc5dae2 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -99,9 +99,6 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): QtCore.QObject.connect(self.OpenSongBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onOpenSongBrowseButtonClicked) - QtCore.QObject.connect(self.cancelButton, - QtCore.SIGNAL(u'clicked(bool)'), - self.onCancelButtonClicked) QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged) @@ -113,6 +110,16 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): self.setDefaults() return QtGui.QWizard.exec_(self) + def reject(self): + """ + Stop the import on cancel button, close button or ESC key. + """ + log.debug('Import canceled by user.') + if self.currentId() == 3: + Receiver.send_message(u'bibles_stop_import') + else: + self.done(QtGui.QDialog.Rejected) + def validateCurrentPage(self): """ Validate the current page before moving on to the next page. @@ -244,14 +251,6 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'), self.OpenSongFileEdit) - def onCancelButtonClicked(self, checked): - """ - Stop the import on pressing the cancel button. - """ - log.debug('Cancel button pressed!') - if self.currentId() == 3: - Receiver.send_message(u'bibles_stop_import') - def onCurrentIdChanged(self, pageId): if pageId == 3: self.preImport() From 01fad9972c40e1d451f27881e5912f8236bbc73c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 9 Dec 2010 13:49:15 +0100 Subject: [PATCH 13/18] added comments back --- openlp/plugins/bibles/lib/csvbible.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index 2b92891ab..d02ff2a70 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -65,6 +65,7 @@ class CSVBible(BibleDB): books_file.seek(0) books_reader = csv.reader(books_file, dialect) for line in books_reader: + # cancel pressed if self.stop_import_flag: break details = chardet.detect(line[1]) @@ -85,7 +86,7 @@ class CSVBible(BibleDB): verse_file.seek(0) verse_reader = csv.reader(verse_file, dialect) for line in verse_reader: - if self.stop_import_flag: + if self.stop_import_flag: # cancel pressed break details = chardet.detect(line[3]) if book_ptr != line[0]: From 465515d71edb486e56fd62aaa44027fd9b5bb60b Mon Sep 17 00:00:00 2001 From: M2j Date: Thu, 9 Dec 2010 14:30:23 +0100 Subject: [PATCH 14/18] unicode in song title search strings --- openlp/plugins/songs/lib/mediaitem.py | 6 ++++-- openlp/plugins/songs/songsplugin.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index a2281128e..d559809ec 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -25,6 +25,7 @@ ############################################################################### import logging +import re from PyQt4 import QtCore, QtGui @@ -61,6 +62,7 @@ class SongMediaItem(MediaManagerItem): # which Song is required. self.remoteSong = -1 self.editItem = None + self.whitespace = re.compile(r'\W+', re.UNICODE) def requiredIcons(self): MediaManagerItem.requiredIcons(self) @@ -173,8 +175,8 @@ class SongMediaItem(MediaManagerItem): if search_type == 0: log.debug(u'Titles Search') search_results = self.parent.manager.get_all_objects(Song, - Song.search_title.like(u'%' + search_keywords.lower() + u'%'), - Song.search_title.asc()) + Song.search_title.like(u'%' + self.whitespace.sub(u' ', + search_keywords.lower()) + u'%'), Song.search_title.asc()) self.displayResultsSong(search_results) elif search_type == 1: log.debug(u'Lyrics Search') diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index b2df06401..32336c507 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -56,7 +56,7 @@ class SongsPlugin(Plugin): self.manager = Manager(u'songs', init_schema) self.icon_path = u':/plugins/plugin_songs.png' self.icon = build_icon(self.icon_path) - self.whitespace = re.compile(r'\W+') + self.whitespace = re.compile(r'\W+', re.UNICODE) def getSettingsTab(self): visible_name = self.getString(StringContent.VisibleName) From 7e86da26f2b8aae3c6302e44147fb024250a883a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 9 Dec 2010 14:35:17 +0100 Subject: [PATCH 15/18] close connection when finished, removed unused variable --- openlp/plugins/bibles/lib/openlp1.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/openlp1.py b/openlp/plugins/bibles/lib/openlp1.py index 7bd47d99f..7f8a8d17e 100755 --- a/openlp/plugins/bibles/lib/openlp1.py +++ b/openlp/plugins/bibles/lib/openlp1.py @@ -45,7 +45,6 @@ class OpenLP1Bible(BibleDB): log.debug(self.__class__.__name__) BibleDB.__init__(self, parent, **kwargs) self.filename = kwargs[u'filename'] - self.name = kwargs[u'name'] QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import) @@ -65,6 +64,7 @@ class OpenLP1Bible(BibleDB): books = cursor.fetchall() for book in books: if self.stop_import_flag: + connection.close() return False book_id = int(book[0]) testament_id = int(book[1]) @@ -80,6 +80,7 @@ class OpenLP1Bible(BibleDB): verses = cursor.fetchall() for verse in verses: if self.stop_import_flag: + connection.close() return False chapter = int(verse[0]) verse_number = int(verse[1]) @@ -87,4 +88,5 @@ class OpenLP1Bible(BibleDB): self.create_verse(book_id, chapter, verse_number, text) Receiver.send_message(u'openlp_process_events') self.session.commit() + connection.close() return True From 7e221a6e9809946d79dae755358de0e1e6052ca9 Mon Sep 17 00:00:00 2001 From: M2j Date: Thu, 9 Dec 2010 16:08:04 +0100 Subject: [PATCH 16/18] locale aware song sorting --- openlp/plugins/songs/lib/mediaitem.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index d559809ec..dc8310e9d 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -25,6 +25,7 @@ ############################################################################### import logging +import locale import re from PyQt4 import QtCore, QtGui @@ -215,6 +216,7 @@ class SongMediaItem(MediaManagerItem): def displayResultsSong(self, searchresults): log.debug(u'display results Song') self.listView.clear() + searchresults.sort(cmp=self.collateSongTitles) for song in searchresults: author_list = u'' for author in song.authors: @@ -439,3 +441,9 @@ class SongMediaItem(MediaManagerItem): if editId != 0: Receiver.send_message(u'service_item_update', u'%s:%s' %(editId, uuid)) + + def collateSongTitles(self, song_1, song_2): + """ + Locale aware collation of song titles + """ + return locale.strcoll(unicode(song_1.title), unicode(song_2.title)) From a15aebcc32751eb60364dd848aa9dadf3c5bf2ee Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 9 Dec 2010 17:53:48 +0100 Subject: [PATCH 17/18] latest changes for merge --- .../plugins/bibles/forms/bibleimportform.py | 39 +++++++------------ .../plugins/bibles/forms/bibleimportwizard.py | 2 +- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 2fd82ed1d..0c25f51cf 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -31,7 +31,7 @@ import os.path from PyQt4 import QtCore, QtGui -from bibleimportwizard import uiBibleImportWizard +from bibleimportwizard import Ui_BibleImportWizard from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.lib.db import delete_database from openlp.core.utils import AppLocation @@ -54,7 +54,7 @@ class WebDownload(object): return cls.Names[name] -class BibleImportForm(QtGui.QWizard, uiBibleImportWizard): +class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): """ This is the Bible Import Wizard, which allows easy importing of Bibles into OpenLP from other formats like OSIS, CSV and OpenSong. @@ -166,7 +166,7 @@ class BibleImportForm(QtGui.QWizard, uiBibleImportWizard): self.openSongFileEdit.setFocus() return False elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1: - if not self.field(u'OLP1_location').toString(): + if not self.field(u'openlp1_location').toString(): QtGui.QMessageBox.critical(self, translate('BiblesPlugin.ImportWizardForm', 'Invalid Bible Location'), @@ -280,28 +280,19 @@ class BibleImportForm(QtGui.QWizard, uiBibleImportWizard): self.postImport() def registerFields(self): - self.selectPage.registerField( - u'source_format', self.formatComboBox) - self.selectPage.registerField( - u'osis_location', self.OSISLocationEdit) - self.selectPage.registerField( - u'csv_booksfile', self.booksLocationEdit) + self.selectPage.registerField(u'source_format', self.formatComboBox) + self.selectPage.registerField(u'osis_location', self.OSISLocationEdit) + self.selectPage.registerField(u'csv_booksfile', self.booksLocationEdit) self.selectPage.registerField( u'csv_versefile', self.csvVerseLocationEdit) + self.selectPage.registerField(u'opensong_file', self.openSongFileEdit) + self.selectPage.registerField(u'web_location', self.locationComboBox) + self.selectPage.registerField(u'web_biblename', self.bibleComboBox) + self.selectPage.registerField(u'proxy_server', self.addressEdit) + self.selectPage.registerField(u'proxy_username', self.usernameEdit) + self.selectPage.registerField(u'proxy_password', self.passwordEdit) self.selectPage.registerField( - u'opensong_file', self.openSongFileEdit) - self.selectPage.registerField( - u'web_location', self.locationComboBox) - self.selectPage.registerField( - u'web_biblename', self.bibleComboBox) - self.selectPage.registerField( - u'proxy_server', self.addressEdit) - self.selectPage.registerField( - u'proxy_username', self.usernameEdit) - self.selectPage.registerField( - u'proxy_password', self.passwordEdit) - self.selectPage.registerField( - u'OLP1_location', self.openlp1LocationEdit) + u'openlp1_location', self.openlp1LocationEdit) self.licenseDetailsPage.registerField( u'license_version', self.versionNameEdit) self.licenseDetailsPage.registerField( @@ -329,7 +320,7 @@ class BibleImportForm(QtGui.QWizard, uiBibleImportWizard): settings.value(u'proxy username', QtCore.QVariant(u''))) self.setField(u'proxy_password', settings.value(u'proxy password', QtCore.QVariant(u''))) - self.setField(u'OLP1_location', QtCore.QVariant('')) + self.setField(u'openlp1_location', QtCore.QVariant('')) self.setField(u'license_version', QtCore.QVariant(self.versionNameEdit.text())) self.setField(u'license_copyright', @@ -476,7 +467,7 @@ class BibleImportForm(QtGui.QWizard, uiBibleImportWizard): # Import an openlp.org 1.x bible. importer = self.manager.import_bible(BibleFormat.OpenLP1, name=license_version, - filename=unicode(self.field(u'OLP1_location').toString()) + filename=unicode(self.field(u'openlp1_location').toString()) ) if importer.do_import(): self.manager.save_meta_data(license_version, license_version, diff --git a/openlp/plugins/bibles/forms/bibleimportwizard.py b/openlp/plugins/bibles/forms/bibleimportwizard.py index c60490086..4b68c21a8 100644 --- a/openlp/plugins/bibles/forms/bibleimportwizard.py +++ b/openlp/plugins/bibles/forms/bibleimportwizard.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate -class uiBibleImportWizard(object): +class Ui_BibleImportWizard(object): def setupUi(self, bibleImportWizard): bibleImportWizard.setObjectName(u'bibleImportWizard') bibleImportWizard.resize(550, 386) From 5d3337674035e796294171182717aafb1a222519 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 9 Dec 2010 19:01:04 +0100 Subject: [PATCH 18/18] again changed olp to openlp --- openlp/plugins/bibles/forms/bibleimportform.py | 4 ++-- openlp/plugins/bibles/forms/bibleimportwizard.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 0c25f51cf..6c9bef1ba 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -101,7 +101,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): self.onOpenSongBrowseButtonClicked) QtCore.QObject.connect(self.openlp1FileButton, QtCore.SIGNAL(u'clicked()'), - self.onOLP1FileButtonClicked) + self.onOpenlp1FileButtonClicked) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL(u'clicked(bool)'), self.onCancelButtonClicked) @@ -257,7 +257,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'), self.openSongFileEdit) - def onOLP1FileButtonClicked(self): + def onOpenlp1FileButtonClicked(self): """ Show the file open dialog for the openlp.org 1.x file. """ diff --git a/openlp/plugins/bibles/forms/bibleimportwizard.py b/openlp/plugins/bibles/forms/bibleimportwizard.py index 4b68c21a8..4f6e0f624 100644 --- a/openlp/plugins/bibles/forms/bibleimportwizard.py +++ b/openlp/plugins/bibles/forms/bibleimportwizard.py @@ -255,27 +255,27 @@ class Ui_BibleImportWizard(object): self.webDownloadLayout.addWidget(self.webDownloadTabWidget) self.formatWidget.addWidget(self.webDownloadPage) self.openlp1Page = QtGui.QWidget() - self.openlp1Page.setObjectName(u'OLP1Page') + self.openlp1Page.setObjectName(u'Openlp1Page') self.openlp1Layout = QtGui.QFormLayout(self.openlp1Page) self.openlp1Layout.setFieldGrowthPolicy( QtGui.QFormLayout.ExpandingFieldsGrow) self.openlp1Layout.setMargin(0) self.openlp1Layout.setSpacing(8) - self.openlp1Layout.setObjectName(u'OLP1Layout') + self.openlp1Layout.setObjectName(u'Openlp1Layout') self.openlp1LocationLabel = QtGui.QLabel(self.openlp1Page) - self.openlp1LocationLabel.setObjectName(u'OLP1LocationLabel') + self.openlp1LocationLabel.setObjectName(u'Openlp1LocationLabel') self.openlp1Layout.setWidget(1, QtGui.QFormLayout.LabelRole, self.openlp1LocationLabel) self.openlp1LocationLayout = QtGui.QHBoxLayout() self.openlp1LocationLayout.setSpacing(8) - self.openlp1LocationLayout.setObjectName(u'OLP1LocationLayout') + self.openlp1LocationLayout.setObjectName(u'Openlp1LocationLayout') self.openlp1LocationEdit = QtGui.QLineEdit(self.openlp1Page) - self.openlp1LocationEdit.setObjectName(u'OLP1LocationEdit') + self.openlp1LocationEdit.setObjectName(u'Openlp1LocationEdit') self.openlp1LocationLayout.addWidget(self.openlp1LocationEdit) self.openlp1FileButton = QtGui.QToolButton(self.openlp1Page) self.openlp1FileButton.setMaximumSize(QtCore.QSize(32, 16777215)) self.openlp1FileButton.setIcon(generalIcon) - self.openlp1FileButton.setObjectName(u'OLP1FileButton') + self.openlp1FileButton.setObjectName(u'Openlp1FileButton') self.openlp1LocationLayout.addWidget(self.openlp1FileButton) self.openlp1Layout.setLayout(1, QtGui.QFormLayout.FieldRole, self.openlp1LocationLayout)