forked from openlp/openlp
some fixes in relation with the extened LanguageForm
close cursor from OldBibleDB
This commit is contained in:
parent
24d7b7b038
commit
c435127585
@ -706,7 +706,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
name=license_version,
|
name=license_version,
|
||||||
filename=unicode(self.field(u'openlp1_location').toString())
|
filename=unicode(self.field(u'openlp1_location').toString())
|
||||||
)
|
)
|
||||||
if importer.do_import():
|
if importer.do_import(license_version):
|
||||||
self.manager.save_meta_data(license_version, license_version,
|
self.manager.save_meta_data(license_version, license_version,
|
||||||
license_copyright, license_permissions)
|
license_copyright, license_permissions)
|
||||||
self.manager.reload_bibles()
|
self.manager.reload_bibles()
|
||||||
|
@ -324,6 +324,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
oldbible = OldBibleDB(self.mediaItem, path=self.path,
|
oldbible = OldBibleDB(self.mediaItem, path=self.path,
|
||||||
file=filename)
|
file=filename)
|
||||||
oldname = oldbible.get_name()
|
oldname = oldbible.get_name()
|
||||||
|
oldbible.close_cursor()
|
||||||
if not version_name:
|
if not version_name:
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.UpgradeWizardForm',
|
translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
|
@ -55,11 +55,7 @@ class LanguageForm(QDialog, Ui_LanguageDialog):
|
|||||||
def exec_(self, bible_name):
|
def exec_(self, bible_name):
|
||||||
self.languageComboBox.addItem(u'')
|
self.languageComboBox.addItem(u'')
|
||||||
if bible_name:
|
if bible_name:
|
||||||
self.infoLabel.setText(unicode(translate(
|
self.bibleLabel.setText(unicode(bible_name))
|
||||||
'BiblesPlugin.LanguageDialog',
|
|
||||||
'OpenLP is unable to determine the language of this translation'
|
|
||||||
' of the Bible. Please select the language for "%s" from the '
|
|
||||||
'list below.')) % bible_name)
|
|
||||||
items = BiblesResourcesDB.get_languages()
|
items = BiblesResourcesDB.get_languages()
|
||||||
for item in items:
|
for item in items:
|
||||||
self.languageComboBox.addItem(item[u'name'])
|
self.languageComboBox.addItem(item[u'name'])
|
||||||
|
@ -92,7 +92,7 @@ class CSVBible(BibleDB):
|
|||||||
self.booksfile = kwargs[u'booksfile']
|
self.booksfile = kwargs[u'booksfile']
|
||||||
self.versesfile = kwargs[u'versefile']
|
self.versesfile = kwargs[u'versefile']
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self, bible_name=None):
|
||||||
"""
|
"""
|
||||||
Import the bible books and verses.
|
Import the bible books and verses.
|
||||||
"""
|
"""
|
||||||
@ -100,10 +100,9 @@ class CSVBible(BibleDB):
|
|||||||
self.wizard.progressBar.setMinimum(0)
|
self.wizard.progressBar.setMinimum(0)
|
||||||
self.wizard.progressBar.setMaximum(66)
|
self.wizard.progressBar.setMaximum(66)
|
||||||
success = True
|
success = True
|
||||||
language_id = self.get_language()
|
language_id = self.get_language(bible_name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Importing books from "%s" '\
|
log.exception(u'Importing books from "%s" failed' % self.filename)
|
||||||
'failed' % self.filename)
|
|
||||||
return False
|
return False
|
||||||
books_file = None
|
books_file = None
|
||||||
book_list = {}
|
book_list = {}
|
||||||
|
@ -999,6 +999,13 @@ class OldBibleDB(QtCore.QObject, Manager):
|
|||||||
self.cursor = conn.cursor()
|
self.cursor = conn.cursor()
|
||||||
return self.cursor
|
return self.cursor
|
||||||
|
|
||||||
|
def close_cursor(self):
|
||||||
|
"""
|
||||||
|
Close the cursor
|
||||||
|
"""
|
||||||
|
if self.cursor:
|
||||||
|
self.cursor.close()
|
||||||
|
|
||||||
def run_sql(self, query, parameters=()):
|
def run_sql(self, query, parameters=()):
|
||||||
"""
|
"""
|
||||||
Run an SQL query on the database, returning the results.
|
Run an SQL query on the database, returning the results.
|
||||||
|
@ -375,7 +375,7 @@ class HTTPBible(BibleDB):
|
|||||||
if u'proxy_password' in kwargs:
|
if u'proxy_password' in kwargs:
|
||||||
self.proxy_password = kwargs[u'proxy_password']
|
self.proxy_password = kwargs[u'proxy_password']
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self, bible_name=None):
|
||||||
"""
|
"""
|
||||||
Run the import. This method overrides the parent class method. Returns
|
Run the import. This method overrides the parent class method. Returns
|
||||||
``True`` on success, ``False`` on failure.
|
``True`` on success, ``False`` on failure.
|
||||||
@ -414,7 +414,7 @@ class HTTPBible(BibleDB):
|
|||||||
language_id = bible[u'language_id']
|
language_id = bible[u'language_id']
|
||||||
self.create_meta(u'language_id', language_id)
|
self.create_meta(u'language_id', language_id)
|
||||||
else:
|
else:
|
||||||
language_id = self.get_language()
|
language_id = self.get_language(bible_name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Importing books from %s " '\
|
log.exception(u'Importing books from %s " '\
|
||||||
'failed' % self.filename)
|
'failed' % self.filename)
|
||||||
|
@ -46,7 +46,7 @@ class OpenLP1Bible(BibleDB):
|
|||||||
BibleDB.__init__(self, parent, **kwargs)
|
BibleDB.__init__(self, parent, **kwargs)
|
||||||
self.filename = kwargs[u'filename']
|
self.filename = kwargs[u'filename']
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self, bible_name=None):
|
||||||
"""
|
"""
|
||||||
Imports an openlp.org v1 bible.
|
Imports an openlp.org v1 bible.
|
||||||
"""
|
"""
|
||||||
@ -58,10 +58,9 @@ class OpenLP1Bible(BibleDB):
|
|||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
#Create the bible language
|
#Create the bible language
|
||||||
language_id = self.get_language()
|
language_id = self.get_language(bible_name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Importing books from "%s " '\
|
log.exception(u'Importing books from "%s" failed' % self.filename)
|
||||||
'failed' % self.filename)
|
|
||||||
return False
|
return False
|
||||||
# Create all books.
|
# Create all books.
|
||||||
cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book')
|
cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book')
|
||||||
|
@ -46,7 +46,7 @@ class OpenSongBible(BibleDB):
|
|||||||
BibleDB.__init__(self, parent, **kwargs)
|
BibleDB.__init__(self, parent, **kwargs)
|
||||||
self.filename = kwargs['filename']
|
self.filename = kwargs['filename']
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self, bible_name=None):
|
||||||
"""
|
"""
|
||||||
Loads a Bible from file.
|
Loads a Bible from file.
|
||||||
"""
|
"""
|
||||||
@ -62,7 +62,7 @@ class OpenSongBible(BibleDB):
|
|||||||
file = open(self.filename, u'r')
|
file = open(self.filename, u'r')
|
||||||
opensong = objectify.parse(file)
|
opensong = objectify.parse(file)
|
||||||
bible = opensong.getroot()
|
bible = opensong.getroot()
|
||||||
language_id = self.get_language()
|
language_id = self.get_language(bible_name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Importing books from "%s" '\
|
log.exception(u'Importing books from "%s" '\
|
||||||
'failed' % self.filename)
|
'failed' % self.filename)
|
||||||
|
@ -86,7 +86,7 @@ class OSISBible(BibleDB):
|
|||||||
if fbibles:
|
if fbibles:
|
||||||
fbibles.close()
|
fbibles.close()
|
||||||
|
|
||||||
def do_import(self):
|
def do_import(self, bible_name=None):
|
||||||
"""
|
"""
|
||||||
Loads a Bible from file.
|
Loads a Bible from file.
|
||||||
"""
|
"""
|
||||||
@ -109,10 +109,9 @@ class OSISBible(BibleDB):
|
|||||||
if detect_file:
|
if detect_file:
|
||||||
detect_file.close()
|
detect_file.close()
|
||||||
# Set meta language_id
|
# Set meta language_id
|
||||||
language_id = self.get_language()
|
language_id = self.get_language(bible_name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Importing books from "%s" '\
|
log.exception(u'Importing books from "%s" failed' % self.filename)
|
||||||
'failed' % self.filename)
|
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
osis = codecs.open(self.filename, u'r', details['encoding'])
|
osis = codecs.open(self.filename, u'r', details['encoding'])
|
||||||
|
Loading…
Reference in New Issue
Block a user