catch case, when no bibles are installed to avoid a IndexError

correct spelling error 'Corinthans' in osisbooks.csv
This commit is contained in:
M2j 2011-01-05 19:25:40 +01:00
parent a6566a1f84
commit cdd22d695a
3 changed files with 15 additions and 6 deletions

View File

@ -257,6 +257,14 @@ class BibleManager(object):
- Genesis 1:1-10,2:1-10
"""
log.debug(u'BibleManager.get_verses("%s", "%s")', bible, versetext)
if not bible:
QtGui.QMessageBox.information(self.parent.mediaItem,
translate('BiblesPlugin.BibleManager',
'No Bibles available'),
translate('BiblesPlugin.BibleManager',
'There are no Bibles currently installed. Please use the '
'Import Wizard to install one or more Bibles.'))
return None
reflist = parse_reference(versetext)
if reflist:
return self.db_cache[bible].get_verses(reflist)

View File

@ -626,6 +626,7 @@ class BibleMediaItem(MediaManagerItem):
Displays the search results in the media manager. All data needed for
further action is saved for/in each row.
"""
verse_separator = get_reference_match(u'sep_v_display')
version = self.parent.manager.get_meta_data(bible, u'Version')
copyright = self.parent.manager.get_meta_data(bible, u'Copyright')
permissions = self.parent.manager.get_meta_data(bible, u'Permissions')
@ -661,8 +662,8 @@ class BibleMediaItem(MediaManagerItem):
}
except IndexError:
break
bible_text = u' %s %d:%d (%s, %s)' % (verse.book.name,
verse.chapter, verse.verse, version.value,
bible_text = u' %s %d%s%d (%s, %s)' % (verse.book.name,
verse.chapter, verse_separator, verse.verse, version.value,
second_version.value)
else:
vdict = {
@ -680,8 +681,8 @@ class BibleMediaItem(MediaManagerItem):
'second_permissions': QtCore.QVariant(u''),
'second_text': QtCore.QVariant(u'')
}
bible_text = u'%s %d:%d (%s)' % (verse.book.name,
verse.chapter, verse.verse, version.value)
bible_text = u'%s %d%s%d (%s)' % (verse.book.name,
verse.chapter, verse_separator, verse.verse, version.value)
bible_verse = QtGui.QListWidgetItem(bible_text)
bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(vdict))
self.listView.addItem(bible_verse)

View File

@ -43,8 +43,8 @@ Luke,Luke,Luke
John,John,John
Acts,Acts,Acts
Rom,Romans,Rom
1Cor,1 Corinthans,1Cor
2Cor,2 Corinthans,2Cor
1Cor,1 Corinthians,1Cor
2Cor,2 Corinthians,2Cor
Gal,Galatians,Gal
Eph,Ephesians,Eph
Phil,Philippians,Phil

1 Gen Genesis Gen
43 John John John
44 Acts Acts Acts
45 Rom Romans Rom
46 1Cor 1 Corinthans 1 Corinthians 1Cor
47 2Cor 2 Corinthans 2 Corinthians 2Cor
48 Gal Galatians Gal
49 Eph Ephesians Eph
50 Phil Philippians Phil