Merge branch 'bible-fixes' into 'master'

Fixes for the bible plugin.

See merge request openlp/openlp!290
This commit is contained in:
Tim Bentley 2021-01-21 07:59:35 +00:00
commit c7112a1f78
3 changed files with 5 additions and 2 deletions

View File

@ -761,7 +761,7 @@ class AlternativeBookNamesDB(Manager):
If necessary loads up the database and creates the tables if the database doesn't exist. If necessary loads up the database and creates the tables if the database doesn't exist.
""" """
if AlternativeBookNamesDB.cursor is None: if AlternativeBookNamesDB.cursor is None:
file_path = AppLocation.get_directory(AppLocation.DataDir) / 'bibles' / 'alternative_book_names.sqlite' file_path = AppLocation.get_section_data_path('bibles') / 'alternative_book_names.sqlite'
exists = file_path.exists() exists = file_path.exists()
AlternativeBookNamesDB.conn = sqlite3.connect(str(file_path)) AlternativeBookNamesDB.conn = sqlite3.connect(str(file_path))
if not exists: if not exists:

View File

@ -344,6 +344,8 @@ class BibleMediaItem(MediaManagerItem):
# set the default value # set the default value
bible = self.settings.value('bibles/primary bible') bible = self.settings.value('bibles/primary bible')
find_and_set_in_combo_box(self.version_combo_box, bible) find_and_set_in_combo_box(self.version_combo_box, bible)
# make sure the selected bible ripples down to other gui elements
self.on_version_combo_box_index_changed()
def reload_bibles(self): def reload_bibles(self):
""" """

View File

@ -328,7 +328,8 @@ def test_populate_bible_combo_boxes(media_item):
media_item.plugin.manager.get_bibles.return_value = \ media_item.plugin.manager.get_bibles.return_value = \
{'Bible 2': bible_2, 'Bible 1': bible_1, 'Bible 3': bible_3} {'Bible 2': bible_2, 'Bible 1': bible_1, 'Bible 3': bible_3}
with patch('openlp.plugins.bibles.lib.mediaitem.get_locale_key', side_effect=lambda x: x), \ with patch('openlp.plugins.bibles.lib.mediaitem.get_locale_key', side_effect=lambda x: x), \
patch('openlp.plugins.bibles.lib.mediaitem.find_and_set_in_combo_box'): patch('openlp.plugins.bibles.lib.mediaitem.find_and_set_in_combo_box'), \
patch.object(media_item, 'on_version_combo_box_index_changed'):
# WHEN: Calling populate_bible_combo_boxes # WHEN: Calling populate_bible_combo_boxes
media_item.populate_bible_combo_boxes() media_item.populate_bible_combo_boxes()