forked from openlp/openlp
- Turned the one try statement into multiple so the existing data could be loaded if some fields were missing.
This commit is contained in:
parent
f3ce137233
commit
f45ee8ac17
@ -61,24 +61,32 @@ class EditBibleForm(QtWidgets.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
log.debug('Load Bible')
|
log.debug('Load Bible')
|
||||||
self.bible = bible
|
self.bible = bible
|
||||||
|
book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language')
|
||||||
"""
|
"""
|
||||||
Try loading the metadata, if the field does not exist in the metadata, continue executing the code,
|
Try loading the metadata, if the field does not exist in the metadata, continue executing the code,
|
||||||
missing fields will be created on "self.accept" (save). Also set "book_name_language",
|
missing fields will be created on "self.accept" (save).
|
||||||
there would otherwise be a traceback for reference before assignment.
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self.version_name_edit.setText(self.manager.get_meta_data(self.bible, 'name').value)
|
self.version_name_edit.setText(self.manager.get_meta_data(self.bible, 'name').value)
|
||||||
self.version_name_edit.setPlaceholderText(UiStrings().RequiredShowInFooter)
|
|
||||||
self.copyright_edit.setText(self.manager.get_meta_data(self.bible, 'copyright').value)
|
|
||||||
self.copyright_edit.setPlaceholderText(UiStrings().RequiredShowInFooter)
|
|
||||||
self.permissions_edit.setText(self.manager.get_meta_data(self.bible, 'permissions').value)
|
|
||||||
self.permissions_edit.setPlaceholderText(UiStrings().OptionalShowInFooter)
|
|
||||||
self.full_license_edit.setPlainText(self.manager.get_meta_data(self.bible, 'full_license').value)
|
|
||||||
self.full_license_edit.setPlaceholderText(UiStrings().OptionalHideInFooter)
|
|
||||||
book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language')
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language')
|
|
||||||
pass
|
pass
|
||||||
|
try:
|
||||||
|
self.copyright_edit.setText(self.manager.get_meta_data(self.bible, 'copyright').value)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
self.permissions_edit.setText(self.manager.get_meta_data(self.bible, 'permissions').value)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
self.full_license_edit.setPlainText(self.manager.get_meta_data(self.bible, 'full_license').value)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
# Set placeholder texts for the fields.
|
||||||
|
self.version_name_edit.setPlaceholderText(UiStrings().RequiredShowInFooter)
|
||||||
|
self.copyright_edit.setPlaceholderText(UiStrings().RequiredShowInFooter)
|
||||||
|
self.permissions_edit.setPlaceholderText(UiStrings().OptionalShowInFooter)
|
||||||
|
self.full_license_edit.setPlaceholderText(UiStrings().OptionalHideInFooter)
|
||||||
if book_name_language and book_name_language.value != 'None':
|
if book_name_language and book_name_language.value != 'None':
|
||||||
self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1)
|
self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1)
|
||||||
self.books = {}
|
self.books = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user