From 282a845a10ef2fe902daf526d8f4970ca72e05b8 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 21 Jan 2021 07:59:34 +0000 Subject: [PATCH] Fixes for the bible plugin. Fix placement of alternative_book_names.sqlite for portable installs. Fix gui elements not updating when only one bible is available. --- openlp/plugins/bibles/lib/db.py | 2 +- openlp/plugins/bibles/lib/mediaitem.py | 2 ++ tests/functional/openlp_plugins/bibles/test_mediaitem.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 8ada2d2ce..cb56b3b85 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -761,7 +761,7 @@ class AlternativeBookNamesDB(Manager): If necessary loads up the database and creates the tables if the database doesn't exist. """ 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() AlternativeBookNamesDB.conn = sqlite3.connect(str(file_path)) if not exists: diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 93df6f10a..e9f2cfafd 100755 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -344,6 +344,8 @@ class BibleMediaItem(MediaManagerItem): # set the default value bible = self.settings.value('bibles/primary 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): """ diff --git a/tests/functional/openlp_plugins/bibles/test_mediaitem.py b/tests/functional/openlp_plugins/bibles/test_mediaitem.py index a78d94b2a..68213bd97 100644 --- a/tests/functional/openlp_plugins/bibles/test_mediaitem.py +++ b/tests/functional/openlp_plugins/bibles/test_mediaitem.py @@ -328,7 +328,8 @@ def test_populate_bible_combo_boxes(media_item): media_item.plugin.manager.get_bibles.return_value = \ {'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), \ - 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 media_item.populate_bible_combo_boxes()