Merge branch 'alpha2-fixes' into 'master'

Various alpha2 fixes

See merge request openlp/openlp!207
This commit is contained in:
Tomas Groth 2020-06-14 19:50:23 +00:00
commit 70ae1a8494
4 changed files with 10 additions and 5 deletions

View File

@ -68,7 +68,11 @@ class AppLocation(object):
path = get_frozen_path(FROZEN_APP_PATH, _get_os_dir_path(dir_type)) / 'i18n'
else:
path = _get_os_dir_path(dir_type)
return path
# resolve() does not work on windows
if is_win():
return Path.cwd() / path
else:
return path.resolve()
@staticmethod
def get_data_path():

View File

@ -365,7 +365,7 @@ class BGExtract(RegistryProperties):
for book in content:
td_element = book.find('td', {'class': 'book-name'})
strings = [text for text in td_element.stripped_strings]
book_name = strings[0]
book_name = strings[2].strip()
if book_name:
books.append(book_name)
return books
@ -381,7 +381,7 @@ class BGExtract(RegistryProperties):
soup = get_soup_for_bible_ref(bible_url)
if not soup:
return None
bible_select = soup.find('select', {'class': 'search-translation-select'})
bible_select = soup.find('select', {'class': 'search-dropdown'})
if not bible_select:
log.debug('No select tags found - did site change?')
return None

View File

@ -538,6 +538,7 @@ class SongMediaItem(MediaManagerItem):
new_media_file.weight = media_file.weight
new_song.media_files.append(new_media_file)
self.plugin.manager.save_object(new_song)
new_song.init_on_load()
self.on_song_list_load()
def generate_slide_data(self, service_item, *, item=None, context=ServiceItemContext.Service, **kwargs):

View File

@ -138,7 +138,7 @@ def test_get_directory_for_app_dir(mocked_get_frozen_path):
directory = AppLocation.get_directory(AppLocation.AppDir)
# THEN: check that the correct directory is returned
assert directory == Path('app', 'dir'), 'Directory should be "app/dir"'
assert directory == Path.cwd() / Path('app', 'dir'), 'Directory should be "app/dir"'
@patch('openlp.core.common.applocation.get_frozen_path')
@ -160,7 +160,7 @@ def test_get_directory_for_plugins_dir(mocked_sys, mocked_split, mocked_abspath,
directory = AppLocation.get_directory(AppLocation.PluginsDir)
# THEN: The correct directory should be returned
assert directory == Path('dir', 'plugins'), 'Directory should be "dir/plugins"'
assert directory == Path.cwd() / Path('dir', 'plugins'), 'Directory should be "dir/plugins"'
@patch('openlp.core.common.sys')