Merge branch '30rc1-fixes' into 'master'

A few bug fixes

Closes #958

See merge request openlp/openlp!382
This commit is contained in:
Tim Bentley 2022-01-21 07:49:55 +00:00
commit 4f9ab2aa05
3 changed files with 10 additions and 4 deletions

View File

@ -62,7 +62,9 @@ class ServiceItemEditForm(QtWidgets.QDialog, Ui_ServiceItemEditDialog, RegistryP
# self.data is only true for images # self.data is only true for images
self.item.slides = [] self.item.slides = []
for item in self.item_list: for item in self.item_list:
self.item.add_from_image(item['path'], item['title']) thumb = item.get('thumbnail', None)
file_hash = item.get('file_hash', None)
self.item.add_from_image(item['path'], item['title'], thumb, file_hash)
return self.item return self.item
def load_data(self): def load_data(self):

View File

@ -762,8 +762,12 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
""" """
# If the file_path is a string, this method will fail. Typecase to Path # If the file_path is a string, this method will fail. Typecase to Path
file_path = Path(file_path) file_path = Path(file_path)
try:
if not file_path.exists(): if not file_path.exists():
return False return False
except OSError:
# if the filename, directory name, or volume label syntax is incorrect it can cause an exception
return False
service_data = None service_data = None
self.application.set_busy_cursor() self.application.set_busy_cursor()
try: try:

View File

@ -84,8 +84,8 @@ def test_get_service_item(form):
assert item is form.item, 'The returned item should be form.item' assert item is form.item, 'The returned item should be form.item'
# FYI: list should be empty because it was cleared but never filled again due to the mock # FYI: list should be empty because it was cleared but never filled again due to the mock
assert item.slides == [], 'The list of slides should have been cleared' assert item.slides == [], 'The list of slides should have been cleared'
assert item.add_from_image.call_args_list == [call('../slide1.jpg', 'slide1.jpg'), assert item.add_from_image.call_args_list == [call('../slide1.jpg', 'slide1.jpg', None, None),
call('../slide2.jpg', 'slide2.jpg')] call('../slide2.jpg', 'slide2.jpg', None, None)]
@patch('openlp.core.ui.serviceitemeditform.QtWidgets.QListWidgetItem') @patch('openlp.core.ui.serviceitemeditform.QtWidgets.QListWidgetItem')