forked from openlp/openlp
A few bug fixes
This commit is contained in:
parent
2143d89d1d
commit
bfce3db902
@ -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):
|
||||||
|
@ -762,7 +762,11 @@ 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)
|
||||||
if not file_path.exists():
|
try:
|
||||||
|
if not file_path.exists():
|
||||||
|
return False
|
||||||
|
except OSError:
|
||||||
|
# if the filename, directory name, or volume label syntax is incorrect it can cause an exception
|
||||||
return False
|
return False
|
||||||
service_data = None
|
service_data = None
|
||||||
self.application.set_busy_cursor()
|
self.application.set_busy_cursor()
|
||||||
|
@ -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')
|
||||||
|
Loading…
Reference in New Issue
Block a user