def retranslateUi(self, edit_bible_dialog): self.book_names = BibleStrings().BookNames edit_bible_dialog.setWindowTitle(translate('BiblesPlugin.EditBibleForm', 'Bible Editor')) # Meta tab self.bible_tab_widget.setTabText( self.bible_tab_widget.indexOf(self.meta_tab), translate('SongsPlugin.EditBibleForm', 'Meta Data')) self.license_details_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'License Details')) self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:')) self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:')) self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:')) self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language')) self.language_selection_label.setText(translate('BiblesPlugin.EditBibleForm', 'Book name language in search field, search results and on display:')) self.language_selection_combo_box.setItemText(0, translate('BiblesPlugin.EditBibleForm', 'Global Settings')) self.language_selection_combo_box.setItemText(LanguageSelection.Bible + 1, translate('BiblesPlugin.EditBibleForm', 'Bible Language')) self.language_selection_combo_box.setItemText(LanguageSelection.Application + 1, translate('BiblesPlugin.EditBibleForm', 'Application Language')) self.language_selection_combo_box.setItemText(LanguageSelection.English + 1, translate('BiblesPlugin.EditBibleForm', 'English')) # Book name tab self.bible_tab_widget.setTabText(self.bible_tab_widget.indexOf(self.book_name_tab), translate('SongsPlugin.EditBibleForm', 'Custom Book Names')) for book in BiblesResourcesDB.get_books(): self.book_name_label[book['abbreviation']].setText('%s:' % str(self.book_names[book['abbreviation']]))
def retranslateUi(self, edit_bible_dialog): self.book_names = BibleStrings().BookNames edit_bible_dialog.setWindowTitle(translate('BiblesPlugin.EditBibleForm', 'Bible Editor')) # Meta tab self.bible_tab_widget.setTabText( self.bible_tab_widget.indexOf(self.meta_tab), translate('SongsPlugin.EditBibleForm', 'Meta Data')) self.license_details_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'License Details')) self.version_name_label.setText(translate('BiblesPlugin.EditBibleForm', 'Version name:')) self.copyright_label.setText(translate('BiblesPlugin.EditBibleForm', 'Copyright:')) self.permissions_label.setText(translate('BiblesPlugin.EditBibleForm', 'Permissions:')) self.language_selection_group_box.setTitle(translate('BiblesPlugin.EditBibleForm', 'Default Bible Language')) self.language_selection_label.setText( translate('BiblesPlugin.EditBibleForm', 'Book name language in search field, search results and ' 'on display:')) self.language_selection_combo_box.setItemText(0, translate('BiblesPlugin.EditBibleForm', 'Global Settings')) self.language_selection_combo_box.setItemText( LanguageSelection.Bible + 1, translate('BiblesPlugin.EditBibleForm', 'Bible Language')) self.language_selection_combo_box.setItemText( LanguageSelection.Application + 1, translate('BiblesPlugin.EditBibleForm', 'Application Language')) self.language_selection_combo_box.setItemText( LanguageSelection.English + 1, translate('BiblesPlugin.EditBibleForm', 'English')) # Book name tab self.bible_tab_widget.setTabText( self.bible_tab_widget.indexOf(self.book_name_tab), translate('SongsPlugin.EditBibleForm', 'Custom Book Names')) for book in BiblesResourcesDB.get_books(): self.book_name_label[book['abbreviation']].setText('%s:' % str(self.book_names[book['abbreviation']]))
def load_bible(self, bible): """ Loads a bible. ``bible`` :param bible: The name of the bible. """ log.debug('Load 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, missing fields will be created on "self.accept" (save). """ meta = self.manager.get_meta_data(self.bible, 'name') copyright = self.manager.get_meta_data(self.bible, 'copyright') permission = self.manager.get_meta_data(self.bible, 'permissions') full_license = self.manager.get_meta_data(self.bible, 'full_license') if meta: self.version_name_edit.setText(meta.value) if copyright: self.copyright_edit.setText(copyright.value) if permission: self.permissions_edit.setText(permission.value) if full_license: self.full_license_edit.setPlainText(full_license.value) # 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': self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1) self.books = {} self.web_bible = self.manager.get_meta_data(self.bible, 'download_source') if self.web_bible: self.book_name_notice.setText( translate('BiblesPlugin.EditBibleForm', 'This is a Web Download Bible.\nIt is not possible to customize the Book Names.')) self.scroll_area.hide() else: self.book_name_notice.setText( translate('BiblesPlugin.EditBibleForm', 'To use the customized book names, "Bible language" must be selected on the Meta Data tab ' 'or, if "Global settings" is selected, on the Bible page in Configure OpenLP.')) for book in BiblesResourcesDB.get_books(): self.books[book['abbreviation']] = self.manager.get_book_by_id(self.bible, book['id']) if self.books[book['abbreviation']] and not self.web_bible: self.book_name_edit[book['abbreviation']].setText(self.books[book['abbreviation']].name) else: # It is necessary to remove the Widget otherwise there still # exists the vertical spacing in QFormLayout self.book_name_widget_layout.removeWidget(self.book_name_label[book['abbreviation']]) self.book_name_label[book['abbreviation']].hide() self.book_name_widget_layout.removeWidget(self.book_name_edit[book['abbreviation']]) self.book_name_edit[book['abbreviation']].hide()
def load_bible(self, bible): """ Loads a bible. ``bible`` :param bible: The name of the bible. """ log.debug('Load Bible') self.bible = bible 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.permissions_edit.setText( self.manager.get_meta_data(self.bible, 'permissions').value) book_name_language = self.manager.get_meta_data( self.bible, 'book_name_language') if book_name_language and book_name_language.value != 'None': self.language_selection_combo_box.setCurrentIndex( int(book_name_language.value) + 1) self.books = {} self.web_bible = self.manager.get_meta_data(self.bible, 'download_source') if self.web_bible: self.book_name_notice.setText( translate( 'BiblesPlugin.EditBibleForm', 'This is a Web Download Bible.\nIt is not possible to customize the Book Names.' )) self.scroll_area.hide() else: self.book_name_notice.setText( translate( 'BiblesPlugin.EditBibleForm', 'To use the customized book names, "Bible language" must be selected on the Meta Data tab ' 'or, if "Global settings" is selected, on the Bible page in Configure OpenLP.' )) for book in BiblesResourcesDB.get_books(): self.books[book['abbreviation']] = self.manager.get_book_by_id( self.bible, book['id']) if self.books[book['abbreviation']] and not self.web_bible: self.book_name_edit[book['abbreviation']].setText( self.books[book['abbreviation']].name) else: # It is necessary to remove the Widget otherwise there still # exists the vertical spacing in QFormLayout self.book_name_widget_layout.removeWidget( self.book_name_label[book['abbreviation']]) self.book_name_label[book['abbreviation']].hide() self.book_name_widget_layout.removeWidget( self.book_name_edit[book['abbreviation']]) self.book_name_edit[book['abbreviation']].hide()
def reloadComboBox(self): """ Reload the Combobox items """ self.correspondingComboBox.clear() items = BiblesResourcesDB.get_books() for item in items: addBook = True for book in self.books: if book.book_reference_id == item[u'id']: addBook = False break if self.oldTestamentCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 1: addBook = False elif self.newTestamentCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 2: addBook = False elif self.apocryphaCheckBox.checkState() == QtCore.Qt.Unchecked and item[u'testament_id'] == 3: addBook = False if addBook: self.correspondingComboBox.addItem(self.book_names[item[u'abbreviation']])
def reload_combo_box(self): """ Reload the Combobox items """ self.corresponding_combo_box.clear() items = BiblesResourcesDB.get_books() for item in items: add_book = True for book in self.books: if book.book_reference_id == item['id']: add_book = False break if self.old_testament_check_box.checkState() == QtCore.Qt.Unchecked and item['testament_id'] == 1: add_book = False elif self.new_testament_check_box.checkState() == QtCore.Qt.Unchecked and item['testament_id'] == 2: add_book = False elif self.apocrypha_check_box.checkState() == QtCore.Qt.Unchecked and item['testament_id'] == 3: add_book = False if add_book: self.corresponding_combo_box.addItem(self.book_names[item['abbreviation']])
def get_books_from_http(self, version): """ Load a list of all books a Bible contains from BiblesResourcesDB. :param version: The version of the Bible like NIV for New International Version """ log.debug('BSExtract.get_books_from_http("{version}")'.format( version=version)) # Parsing the book list from the website is near impossible, so we use the list from BiblesResourcesDB bible = BIBLESERVER_TRANSLATIONS[version] all_books = BiblesResourcesDB.get_books() books = [] for book in all_books: if book['testament_id'] == 1 and 'OT' in bible['sections']: books.append(book['name']) elif book['testament_id'] == 2 and 'NT' in bible['sections']: books.append(book['name']) elif book['testament_id'] == 3 and 'Apocrypha' in bible['sections']: books.append(book['name']) return books
def load_bible(self, bible): """ Loads a bible. ``bible`` :param bible: The name of the bible. """ log.debug('Load Bible') self.bible = bible 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.permissions_edit.setText(self.manager.get_meta_data(self.bible, 'permissions').value) book_name_language = self.manager.get_meta_data(self.bible, 'book_name_language') if book_name_language and book_name_language.value != 'None': self.language_selection_combo_box.setCurrentIndex(int(book_name_language.value) + 1) self.books = {} self.web_bible = self.manager.get_meta_data(self.bible, 'download_source') if self.web_bible: self.book_name_notice.setText( translate('BiblesPlugin.EditBibleForm', 'This is a Web Download Bible.\nIt is not possible to customize the Book Names.')) self.scroll_area.hide() else: self.book_name_notice.setText( translate('BiblesPlugin.EditBibleForm', 'To use the customized book names, "Bible language" must be selected on the Meta Data tab ' 'or, if "Global settings" is selected, on the Bible page in Configure OpenLP.')) for book in BiblesResourcesDB.get_books(): self.books[book['abbreviation']] = self.manager.get_book_by_id(self.bible, book['id']) if self.books[book['abbreviation']] and not self.web_bible: self.book_name_edit[book['abbreviation']].setText(self.books[book['abbreviation']].name) else: # It is necessary to remove the Widget otherwise there still # exists the vertical spacing in QFormLayout self.book_name_widget_layout.removeWidget(self.book_name_label[book['abbreviation']]) self.book_name_label[book['abbreviation']].hide() self.book_name_widget_layout.removeWidget(self.book_name_edit[book['abbreviation']]) self.book_name_edit[book['abbreviation']].hide()
def setupUi(self, edit_bible_dialog): edit_bible_dialog.setObjectName('edit_bible_dialog') edit_bible_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) edit_bible_dialog.resize(520, 400) edit_bible_dialog.setModal(True) self.dialog_layout = QtWidgets.QVBoxLayout(edit_bible_dialog) self.dialog_layout.setSpacing(8) self.dialog_layout.setContentsMargins(8, 8, 8, 8) self.dialog_layout.setObjectName('dialog_layout') self.bible_tab_widget = QtWidgets.QTabWidget(edit_bible_dialog) self.bible_tab_widget.setObjectName('BibleTabWidget') # Meta tab self.meta_tab = QtWidgets.QWidget() self.meta_tab.setObjectName('meta_tab') self.meta_tab_layout = QtWidgets.QVBoxLayout(self.meta_tab) self.meta_tab_layout.setObjectName('meta_tab_layout') self.license_details_group_box = QtWidgets.QGroupBox(self.meta_tab) self.license_details_group_box.setObjectName('license_details_group_box') self.license_details_layout = QtWidgets.QFormLayout(self.license_details_group_box) self.license_details_layout.setObjectName('license_details_layout') self.version_name_label = QtWidgets.QLabel(self.license_details_group_box) self.version_name_label.setObjectName('version_name_label') self.version_name_edit = QtWidgets.QLineEdit(self.license_details_group_box) self.version_name_edit.setObjectName('version_name_edit') self.version_name_label.setBuddy(self.version_name_edit) self.license_details_layout.addRow(self.version_name_label, self.version_name_edit) self.copyright_label = QtWidgets.QLabel(self.license_details_group_box) self.copyright_label.setObjectName('copyright_label') self.copyright_edit = QtWidgets.QLineEdit(self.license_details_group_box) self.copyright_edit.setObjectName('copyright_edit') self.copyright_label.setBuddy(self.copyright_edit) self.license_details_layout.addRow(self.copyright_label, self.copyright_edit) self.permissions_label = QtWidgets.QLabel(self.license_details_group_box) self.permissions_label.setObjectName('permissions_label') self.permissions_edit = QtWidgets.QLineEdit(self.license_details_group_box) self.permissions_edit.setObjectName('permissions_edit') self.permissions_label.setBuddy(self.permissions_edit) self.license_details_layout.addRow(self.permissions_label, self.permissions_edit) 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.setObjectName('language_selection_group_box') self.language_selection_layout = QtWidgets.QVBoxLayout(self.language_selection_group_box) self.language_selection_label = QtWidgets.QLabel(self.language_selection_group_box) self.language_selection_label.setObjectName('language_selection_label') self.language_selection_combo_box = QtWidgets.QComboBox(self.language_selection_group_box) self.language_selection_combo_box.setObjectName('language_selection_combo_box') self.language_selection_combo_box.addItems(['', '', '', '']) self.language_selection_layout.addWidget(self.language_selection_label) self.language_selection_layout.addWidget(self.language_selection_combo_box) self.meta_tab_layout.addWidget(self.language_selection_group_box) self.meta_tab_layout.addStretch() self.bible_tab_widget.addTab(self.meta_tab, '') # Book name tab self.book_name_tab = QtWidgets.QWidget() self.book_name_tab.setObjectName('book_name_tab') self.book_name_tab_layout = QtWidgets.QVBoxLayout(self.book_name_tab) self.book_name_tab_layout.setObjectName('book_name_tab_layout') self.book_name_notice = QtWidgets.QLabel(self.book_name_tab) self.book_name_notice.setObjectName('book_name_notice') self.book_name_notice.setWordWrap(True) self.book_name_tab_layout.addWidget(self.book_name_notice) self.scroll_area = QtWidgets.QScrollArea(self.book_name_tab) self.scroll_area.setWidgetResizable(True) self.scroll_area.setObjectName('scroll_area') self.scroll_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.book_name_widget = QtWidgets.QWidget(self.scroll_area) self.book_name_widget.setObjectName('book_name_widget') self.book_name_widget_layout = QtWidgets.QFormLayout(self.book_name_widget) self.book_name_widget_layout.setObjectName('book_name_widget_layout') self.book_name_label = {} self.book_name_edit = {} for book in BiblesResourcesDB.get_books(): self.book_name_label[book['abbreviation']] = QtWidgets.QLabel(self.book_name_widget) self.book_name_label[book['abbreviation']].setObjectName('book_name_label[%s]' % book['abbreviation']) self.book_name_edit[book['abbreviation']] = QtWidgets.QLineEdit(self.book_name_widget) self.book_name_edit[book['abbreviation']].setObjectName('book_name_edit[%s]' % book['abbreviation']) self.book_name_widget_layout.addRow( self.book_name_label[book['abbreviation']], self.book_name_edit[book['abbreviation']]) self.scroll_area.setWidget(self.book_name_widget) self.book_name_tab_layout.addWidget(self.scroll_area) self.book_name_tab_layout.addStretch() self.bible_tab_widget.addTab(self.book_name_tab, '') # Last few bits self.dialog_layout.addWidget(self.bible_tab_widget) self.button_box = create_button_box(edit_bible_dialog, 'button_box', ['cancel', 'save']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(edit_bible_dialog) QtCore.QMetaObject.connectSlotsByName(edit_bible_dialog)
def setupUi(self, edit_bible_dialog): edit_bible_dialog.setObjectName('edit_bible_dialog') edit_bible_dialog.resize(520, 400) edit_bible_dialog.setWindowIcon(build_icon(':/icon/openlp-logo-16x16.png')) edit_bible_dialog.setModal(True) self.dialog_layout = QtGui.QVBoxLayout(edit_bible_dialog) self.dialog_layout.setSpacing(8) self.dialog_layout.setContentsMargins(8, 8, 8, 8) self.dialog_layout.setObjectName('dialog_layout') self.bible_tab_widget = QtGui.QTabWidget(edit_bible_dialog) self.bible_tab_widget.setObjectName('BibleTabWidget') # Meta tab self.meta_tab = QtGui.QWidget() self.meta_tab.setObjectName('meta_tab') self.meta_tab_layout = QtGui.QVBoxLayout(self.meta_tab) self.meta_tab_layout.setObjectName('meta_tab_layout') self.license_details_group_box = QtGui.QGroupBox(self.meta_tab) self.license_details_group_box.setObjectName('license_details_group_box') self.license_details_layout = QtGui.QFormLayout(self.license_details_group_box) self.license_details_layout.setObjectName('license_details_layout') self.version_name_label = QtGui.QLabel(self.license_details_group_box) self.version_name_label.setObjectName('version_name_label') self.version_name_edit = QtGui.QLineEdit(self.license_details_group_box) self.version_name_edit.setObjectName('version_name_edit') self.version_name_label.setBuddy(self.version_name_edit) self.license_details_layout.addRow(self.version_name_label, self.version_name_edit) self.copyright_label = QtGui.QLabel(self.license_details_group_box) self.copyright_label.setObjectName('copyright_label') self.copyright_edit = QtGui.QLineEdit(self.license_details_group_box) self.copyright_edit.setObjectName('copyright_edit') self.copyright_label.setBuddy(self.copyright_edit) self.license_details_layout.addRow(self.copyright_label, self.copyright_edit) self.permissions_label = QtGui.QLabel(self.license_details_group_box) self.permissions_label.setObjectName('permissions_label') self.permissions_edit = QtGui.QLineEdit(self.license_details_group_box) self.permissions_edit.setObjectName('permissions_edit') self.permissions_label.setBuddy(self.permissions_edit) self.license_details_layout.addRow(self.permissions_label, self.permissions_edit) self.meta_tab_layout.addWidget(self.license_details_group_box) self.language_selection_group_box = QtGui.QGroupBox(self.meta_tab) self.language_selection_group_box.setObjectName('language_selection_group_box') self.language_selection_layout = QtGui.QVBoxLayout(self.language_selection_group_box) self.language_selection_label = QtGui.QLabel(self.language_selection_group_box) self.language_selection_label.setObjectName('language_selection_label') self.language_selection_combo_box = QtGui.QComboBox(self.language_selection_group_box) self.language_selection_combo_box.setObjectName('language_selection_combo_box') self.language_selection_combo_box.addItems(['', '', '', '']) self.language_selection_layout.addWidget(self.language_selection_label) self.language_selection_layout.addWidget(self.language_selection_combo_box) self.meta_tab_layout.addWidget(self.language_selection_group_box) self.meta_tab_layout.addStretch() self.bible_tab_widget.addTab(self.meta_tab, '') # Book name tab self.book_name_tab = QtGui.QWidget() self.book_name_tab.setObjectName('book_name_tab') self.book_name_tab_layout = QtGui.QVBoxLayout(self.book_name_tab) self.book_name_tab_layout.setObjectName('book_name_tab_layout') self.book_name_notice = QtGui.QLabel(self.book_name_tab) self.book_name_notice.setObjectName('book_name_notice') self.book_name_notice.setWordWrap(True) self.book_name_tab_layout.addWidget(self.book_name_notice) self.scroll_area = QtGui.QScrollArea(self.book_name_tab) self.scroll_area.setWidgetResizable(True) self.scroll_area.setObjectName('scroll_area') self.scroll_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.book_name_widget = QtGui.QWidget(self.scroll_area) self.book_name_widget.setObjectName('book_name_widget') self.book_name_widget_layout = QtGui.QFormLayout(self.book_name_widget) self.book_name_widget_layout.setObjectName('book_name_widget_layout') self.book_name_label = {} self.book_name_edit= {} for book in BiblesResourcesDB.get_books(): self.book_name_label[book['abbreviation']] = QtGui.QLabel(self.book_name_widget) self.book_name_label[book['abbreviation']].setObjectName('book_name_label[%s]' % book['abbreviation']) self.book_name_edit[book['abbreviation']] = QtGui.QLineEdit(self.book_name_widget) self.book_name_edit[book['abbreviation']].setObjectName('book_name_edit[%s]' % book['abbreviation']) self.book_name_widget_layout.addRow( self.book_name_label[book['abbreviation']], self.book_name_edit[book['abbreviation']]) self.scroll_area.setWidget(self.book_name_widget) self.book_name_tab_layout.addWidget(self.scroll_area) self.book_name_tab_layout.addStretch() self.bible_tab_widget.addTab(self.book_name_tab, '') # Last few bits self.dialog_layout.addWidget(self.bible_tab_widget) self.button_box = create_button_box(edit_bible_dialog, 'button_box', ['cancel', 'save']) self.dialog_layout.addWidget(self.button_box) self.retranslateUi(edit_bible_dialog) QtCore.QMetaObject.connectSlotsByName(edit_bible_dialog)
def load_bible(self, bible): """ Loads a bible. ``bible`` :param bible: The name of the bible. """ log.debug('Load 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, missing fields will be created on "self.accept" (save). """ meta = self.manager.get_meta_data(self.bible, 'name') copyright = self.manager.get_meta_data(self.bible, 'copyright') permission = self.manager.get_meta_data(self.bible, 'permissions') full_license = self.manager.get_meta_data(self.bible, 'full_license') if meta: self.version_name_edit.setText(meta.value) if copyright: self.copyright_edit.setText(copyright.value) if permission: self.permissions_edit.setText(permission.value) if full_license: self.full_license_edit.setPlainText(full_license.value) # 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': self.language_selection_combo_box.setCurrentIndex( int(book_name_language.value) + 1) self.books = {} self.web_bible = self.manager.get_meta_data(self.bible, 'download_source') if self.web_bible: self.book_name_notice.setText( translate( 'BiblesPlugin.EditBibleForm', 'This is a Web Download Bible.\nIt is not possible to customize the Book Names.' )) self.scroll_area.hide() else: self.book_name_notice.setText( translate( 'BiblesPlugin.EditBibleForm', 'To use the customized book names, "Bible language" must be selected on the Meta Data tab ' 'or, if "Global settings" is selected, on the Bible page in Configure OpenLP.' )) for book in BiblesResourcesDB.get_books(): self.books[book['abbreviation']] = self.manager.get_book_by_id( self.bible, book['id']) if self.books[book['abbreviation']] and not self.web_bible: self.book_name_edit[book['abbreviation']].setText( self.books[book['abbreviation']].name) else: # It is necessary to remove the Widget otherwise there still # exists the vertical spacing in QFormLayout self.book_name_widget_layout.removeWidget( self.book_name_label[book['abbreviation']]) self.book_name_label[book['abbreviation']].hide() self.book_name_widget_layout.removeWidget( self.book_name_edit[book['abbreviation']]) self.book_name_edit[book['abbreviation']].hide()