forked from openlp/openlp
- Fixed the missing field traceback
- Created the field for import (This does not work, why?)
This commit is contained in:
parent
0c93d6b032
commit
7ba2bb6d82
@ -378,6 +378,12 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.permissions_edit = QtWidgets.QLineEdit(self.license_details_page)
|
self.permissions_edit = QtWidgets.QLineEdit(self.license_details_page)
|
||||||
self.permissions_edit.setObjectName('PermissionsEdit')
|
self.permissions_edit.setObjectName('PermissionsEdit')
|
||||||
self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.permissions_edit)
|
self.license_details_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.permissions_edit)
|
||||||
|
self.full_license_label = QtWidgets.QLabel(self.license_details_page)
|
||||||
|
self.full_license_label.setObjectName('FullLicenseLabel')
|
||||||
|
self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.full_license_label)
|
||||||
|
self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_page)
|
||||||
|
self.full_license_edit.setObjectName('FullLicenseEdit')
|
||||||
|
self.license_details_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.full_license_edit)
|
||||||
self.addPage(self.license_details_page)
|
self.addPage(self.license_details_page)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
@ -448,6 +454,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.version_name_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
|
self.version_name_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
|
||||||
self.copyright_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
self.copyright_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
|
||||||
self.permissions_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
self.permissions_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
|
||||||
|
self.full_license_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Full license:'))
|
||||||
self.progress_page.setTitle(WizardStrings.Importing)
|
self.progress_page.setTitle(WizardStrings.Importing)
|
||||||
self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
|
self.progress_page.setSubTitle(translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Please wait while your Bible is imported.'))
|
'Please wait while your Bible is imported.'))
|
||||||
@ -471,6 +478,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
elif self.currentPage() == self.select_page:
|
elif self.currentPage() == self.select_page:
|
||||||
self.version_name_edit.clear()
|
self.version_name_edit.clear()
|
||||||
self.permissions_edit.clear()
|
self.permissions_edit.clear()
|
||||||
|
self.full_license_edit.clear()
|
||||||
self.copyright_edit.clear()
|
self.copyright_edit.clear()
|
||||||
if self.field('source_format') == BibleFormat.OSIS:
|
if self.field('source_format') == BibleFormat.OSIS:
|
||||||
if not self.field('osis_location'):
|
if not self.field('osis_location'):
|
||||||
@ -715,6 +723,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.license_details_page.registerField('license_version', self.version_name_edit)
|
self.license_details_page.registerField('license_version', self.version_name_edit)
|
||||||
self.license_details_page.registerField('license_copyright', self.copyright_edit)
|
self.license_details_page.registerField('license_copyright', self.copyright_edit)
|
||||||
self.license_details_page.registerField('license_permissions', self.permissions_edit)
|
self.license_details_page.registerField('license_permissions', self.permissions_edit)
|
||||||
|
self.license_details_page.registerField('license_full_license', self.full_license_edit)
|
||||||
|
|
||||||
def set_defaults(self):
|
def set_defaults(self):
|
||||||
"""
|
"""
|
||||||
@ -741,6 +750,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
self.setField('license_version', self.version_name_edit.text())
|
self.setField('license_version', self.version_name_edit.text())
|
||||||
self.setField('license_copyright', self.copyright_edit.text())
|
self.setField('license_copyright', self.copyright_edit.text())
|
||||||
self.setField('license_permissions', self.permissions_edit.text())
|
self.setField('license_permissions', self.permissions_edit.text())
|
||||||
|
self.setField('license_full_license', self.full_license_edit.toPlainText())
|
||||||
self.on_web_source_combo_box_index_changed(WebDownload.Crosswalk)
|
self.on_web_source_combo_box_index_changed(WebDownload.Crosswalk)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
@ -764,6 +774,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
license_version = self.field('license_version')
|
license_version = self.field('license_version')
|
||||||
license_copyright = self.field('license_copyright')
|
license_copyright = self.field('license_copyright')
|
||||||
license_permissions = self.field('license_permissions')
|
license_permissions = self.field('license_permissions')
|
||||||
|
license_full_license = self.field('license_full_license')
|
||||||
importer = None
|
importer = None
|
||||||
if bible_type == BibleFormat.OSIS:
|
if bible_type == BibleFormat.OSIS:
|
||||||
# Import an OSIS bible.
|
# Import an OSIS bible.
|
||||||
@ -810,7 +821,8 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
sword_key=self.sword_zipbible_combo_box.itemData(
|
sword_key=self.sword_zipbible_combo_box.itemData(
|
||||||
self.sword_zipbible_combo_box.currentIndex()))
|
self.sword_zipbible_combo_box.currentIndex()))
|
||||||
if importer.do_import(license_version):
|
if importer.do_import(license_version):
|
||||||
self.manager.save_meta_data(license_version, license_version, license_copyright, license_permissions)
|
self.manager.save_meta_data(license_version, license_version,
|
||||||
|
license_copyright, license_permissions, license_full_license)
|
||||||
self.manager.reload_bibles()
|
self.manager.reload_bibles()
|
||||||
if bible_type == BibleFormat.WebDownload:
|
if bible_type == BibleFormat.WebDownload:
|
||||||
self.progress_label.setText(
|
self.progress_label.setText(
|
||||||
|
@ -68,14 +68,12 @@ 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 = QtWidgets.QLabel(self.license_details_group_box)
|
||||||
self.full_license_label.setObjectName('full_license_label')
|
self.full_license_label.setObjectName('full_license_label')
|
||||||
self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_group_box)
|
self.full_license_edit = QtWidgets.QPlainTextEdit(self.license_details_group_box)
|
||||||
self.full_license_edit.setObjectName('full_license_edit')
|
self.full_license_edit.setObjectName('full_license_edit')
|
||||||
self.full_license_label.setBuddy(self.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.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')
|
||||||
|
@ -61,11 +61,20 @@ class EditBibleForm(QtWidgets.QDialog, Ui_EditBibleDialog, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
log.debug('Load Bible')
|
log.debug('Load Bible')
|
||||||
self.bible = bible
|
self.bible = bible
|
||||||
|
"""
|
||||||
|
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",
|
||||||
|
there would otherwise be a traceback for reference before assignment.
|
||||||
|
"""
|
||||||
|
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.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)
|
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')
|
||||||
|
except AttributeError:
|
||||||
|
book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language')
|
||||||
|
pass
|
||||||
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