Exemplo n.º 1
0
 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']]))
Exemplo n.º 2
0
Arquivo: db.py Projeto: simhnna/openlp
 def get_name(self, language_selection=LanguageSelection.Bible):
     if language_selection == LanguageSelection.Bible:
         return self.name
     elif language_selection == LanguageSelection.Application:
         return BibleStrings().BookNames[BiblesResourcesDB.get_book_by_id(self.book_reference_id)['abbreviation']]
     elif language_selection == LanguageSelection.English:
         return BiblesResourcesDB.get_book_by_id(self.book_reference_id)['name']
Exemplo n.º 3
0
Arquivo: db.py Projeto: simhnna/openlp
    def get_book_ref_id_by_localised_name(self, book, language_selection):
        """
        Return the id of a named book.

        :param book: The name of the book, according to the selected language.
        :param language_selection:  The language selection the user has chosen in the settings section of the Bible.
        """
        log.debug('get_book_ref_id_by_localised_name("{book}", "{lang}")'.format(book=book, lang=language_selection))
        from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings
        book_names = BibleStrings().BookNames
        # escape reserved characters
        book_escaped = book
        for character in RESERVED_CHARACTERS:
            book_escaped = book_escaped.replace(character, '\\' + character)
        regex_book = re.compile('\\s*{book}\\s*'.format(book='\\s*'.join(book_escaped.split())), re.IGNORECASE)
        if language_selection == LanguageSelection.Bible:
            db_book = self.get_book(book)
            if db_book:
                return db_book.book_reference_id
        elif language_selection == LanguageSelection.Application:
            books = [key for key in list(book_names.keys()) if regex_book.match(str(book_names[key]))]
            books = [_f for _f in map(BiblesResourcesDB.get_book, books) if _f]
            for value in books:
                if self.get_book_by_book_ref_id(value['id']):
                    return value['id']
        elif language_selection == LanguageSelection.English:
            books = BiblesResourcesDB.get_books_like(book)
            if books:
                book_list = [value for value in books if regex_book.match(value['name'])]
                if not book_list:
                    book_list = books
                for value in book_list:
                    if self.get_book_by_book_ref_id(value['id']):
                        return value['id']
        return False
Exemplo n.º 4
0
 def __init__(self, media_item, parent, manager):
     """
     Constructor
     """
     super(EditBibleForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
     self.media_item = media_item
     self.book_names = BibleStrings().BookNames
     self.setupUi(self)
     self.manager = manager
Exemplo n.º 5
0
 def __init__(self, media_item, parent, manager):
     """
     Constructor
     """
     super(EditBibleForm, self).__init__(parent)
     self.media_item = media_item
     self.book_names = BibleStrings().BookNames
     self.setupUi(self)
     self.manager = manager
Exemplo n.º 6
0
 def __init__(self, parent=None):
     """
     Constructor
     """
     super(BookNameForm, self).__init__(parent)
     self.setupUi(self)
     self.custom_signals()
     self.book_names = BibleStrings().BookNames
     self.book_id = False
Exemplo n.º 7
0
 def __init__(self, parent=None):
     """
     Constructor
     """
     super(BookNameForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
     self.setupUi(self)
     self.custom_signals()
     self.book_names = BibleStrings().BookNames
     self.book_id = False