forked from openlp/openlp
- Created a working "Full license" field for Bible editor.
Problem: If metadata does not already have full_license field = traceback.
This commit is contained in:
parent
690d5e770a
commit
0c93d6b032
@ -68,6 +68,14 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.permissions_edit.setObjectName('permissions_edit')
|
self.permissions_edit.setObjectName('permissions_edit')
|
||||||
self.permissions_label.setBuddy(self.permissions_edit)
|
self.permissions_label.setBuddy(self.permissions_edit)
|
||||||
self.license_details_layout.addRow(self.permissions_label, self.permissions_edit)
|
self.license_details_layout.addRow(self.permissions_label, self.permissions_edit)
|
||||||
|
# QTextEdit
|
||||||
|
self.full_license_label = QtWidgets.QLabel(self.license_details_group_box)
|
||||||
|
self.full_license_label.setObjectName('full_license_label')
|
||||||
|
self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_group_box)
|
||||||
|
self.full_license_edit.setObjectName('full_license_edit')
|
||||||
|
self.full_license_label.setBuddy(self.full_license_edit)
|
||||||
|
self.license_details_layout.addRow(self.full_license_label, self.full_license_edit)
|
||||||
|
|
||||||
self.meta_tab_layout.addWidget(self.license_details_group_box)
|
self.meta_tab_layout.addWidget(self.license_details_group_box)
|
||||||
self.language_selection_group_box = QtWidgets.QGroupBox(self.meta_tab)
|
self.language_selection_group_box = QtWidgets.QGroupBox(self.meta_tab)
|
||||||
self.language_selection_group_box.setObjectName('language_selection_group_box')
|
self.language_selection_group_box.setObjectName('language_selection_group_box')
|
||||||
@ -132,6 +140,7 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
|
self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:'))
|
||||||
self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
|
self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:'))
|
||||||
self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
|
self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:'))
|
||||||
|
self.full_license_label.setText(translate('BiblesPlugin.EditBibleForm', 'Full license:'))
|
||||||
self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
|
self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language'))
|
||||||
self.language_selection_label.setText(
|
self.language_selection_label.setText(
|
||||||
translate('BiblesPlugin.EditBibleForm', 'Book name language in search field, search results and '
|
translate('BiblesPlugin.EditBibleForm', 'Book name language in search field, search results and '
|
||||||
|
@ -64,6 +64,7 @@ class EditBibleForm(QtWidgets.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
|||||||
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.copyright_edit.setText(self.manager.get_meta_data(self.bible, 'copyright').value)
|
self.copyright_edit.setText(self.manager.get_meta_data(self.bible, 'copyright').value)
|
||||||
self.permissions_edit.setText(self.manager.get_meta_data(self.bible, 'permissions').value)
|
self.permissions_edit.setText(self.manager.get_meta_data(self.bible, 'permissions').value)
|
||||||
|
self.full_license_edit.setPlainText(self.manager.get_meta_data(self.bible, 'full_license').value)
|
||||||
book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language')
|
book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language')
|
||||||
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)
|
||||||
@ -107,6 +108,7 @@ class EditBibleForm(QtWidgets.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
|||||||
version = self.version_name_edit.text()
|
version = self.version_name_edit.text()
|
||||||
copyright = self.copyright_edit.text()
|
copyright = self.copyright_edit.text()
|
||||||
permissions = self.permissions_edit.text()
|
permissions = self.permissions_edit.text()
|
||||||
|
full_license = self.full_license_edit.toPlainText()
|
||||||
book_name_language = self.language_selection_combo_box.currentIndex() - 1
|
book_name_language = self.language_selection_combo_box.currentIndex() - 1
|
||||||
if book_name_language == -1:
|
if book_name_language == -1:
|
||||||
book_name_language = None
|
book_name_language = None
|
||||||
@ -121,7 +123,7 @@ class EditBibleForm(QtWidgets.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
|||||||
if not self.validate_book(custom_names[abbr], abbr):
|
if not self.validate_book(custom_names[abbr], abbr):
|
||||||
return
|
return
|
||||||
self.application.set_busy_cursor()
|
self.application.set_busy_cursor()
|
||||||
self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language)
|
self.manager.save_meta_data(self.bible, version, copyright, permissions, full_license, book_name_language)
|
||||||
if not self.web_bible:
|
if not self.web_bible:
|
||||||
for abbr, book in self.books.items():
|
for abbr, book in self.books.items():
|
||||||
if book:
|
if book:
|
||||||
|
@ -376,17 +376,17 @@ class BibleManager(RegistryProperties):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def save_meta_data(self, bible, version, copyright, permissions, book_name_language=None):
|
def save_meta_data(self, bible, version, copyright, permissions, full_license, book_name_language=None):
|
||||||
"""
|
"""
|
||||||
Saves the bibles meta data.
|
Saves the bibles meta data.
|
||||||
"""
|
"""
|
||||||
log.debug('save_meta data {bible}, {version}, {copyright}, {perms}'.format(bible=bible,
|
log.debug('save_meta data {bible}, {version}, {copyright},'
|
||||||
version=version,
|
' {perms}, {full_license}'.format(bible=bible, version=version, copyright=copyright,
|
||||||
copyright=copyright,
|
perms=permissions, full_license=full_license))
|
||||||
perms=permissions))
|
|
||||||
self.db_cache[bible].save_meta('name', version)
|
self.db_cache[bible].save_meta('name', version)
|
||||||
self.db_cache[bible].save_meta('copyright', copyright)
|
self.db_cache[bible].save_meta('copyright', copyright)
|
||||||
self.db_cache[bible].save_meta('permissions', permissions)
|
self.db_cache[bible].save_meta('permissions', permissions)
|
||||||
|
self.db_cache[bible].save_meta('full_license', full_license)
|
||||||
self.db_cache[bible].save_meta('book_name_language', book_name_language)
|
self.db_cache[bible].save_meta('book_name_language', book_name_language)
|
||||||
|
|
||||||
def get_meta_data(self, bible, key):
|
def get_meta_data(self, bible, key):
|
||||||
|
Loading…
Reference in New Issue
Block a user