예제 #1
0
    def __init__(self, parent, bcvTextTuple):
        super().__init__()

        self.parent = parent
        self.b, self.c, self.v, self.text = bcvTextTuple
        self.bcvChain = False
        self.biblesSqlite = BiblesSqlite()
        bibleVerseParser = BibleVerseParser(config.parserStandarisation)
        self.bookNo2Abb = bibleVerseParser.standardAbbreviation
        self.bookNo2Name = bibleVerseParser.standardFullBookName
        self.bookLabel = QLabel("")
        self.chapterLabel = QLabel("")
        self.verseLabel = QLabel("")

        # set title
        self.setWindowTitle(config.thisTranslation["menu_bible"])
        # setup interface
        self.setupUI()
예제 #2
0
    def getBibles(self):
        from db.BiblesSqlite import BiblesSqlite
        from db.BiblesSqlite import Bible

        bibles = BiblesSqlite().getBibleList()
        bibleInfo = []
        for bible in bibles:
            description = Bible(bible).bibleInfo()
            bibleInfo.append((bible, description))
        return bibleInfo
예제 #3
0
def checkMigration():
    if config.version >= 0.56:
        biblesSqlite = BiblesSqlite()
        biblesWithBothVersions = biblesSqlite.migratePlainFormattedBibles()
        if biblesWithBothVersions:
            biblesSqlite.proceedMigration(biblesWithBothVersions)
        if config.migrateDatabaseBibleNameToDetailsTable:
            biblesSqlite.migrateDatabaseContent()
        del biblesSqlite
예제 #4
0
def presentReferenceOnFullScreen(command, source):
    if ":::" in command:
        screenNo, reference, *_ = command.split(":::")
    else:
        screenNo = config.presentationScreenNo
        reference = command
    verseList = BibleVerseParser(
        config.parserStandarisation).extractAllReferences(reference, False)
    if command.count(":::") == 2:
        style = command.split(":::")[2]
    else:
        style = "font-size:{0}em;margin-left:{1}px;margin-right:{1}px;color:{2}".format(
            config.presentationFontSize, config.presentationMargin,
            config.presentationColorOnDarkTheme if config.theme == "dark" else
            config.presentationColorOnLightTheme)
    content = command if not verseList or not config.presentationParser else BiblesSqlite(
    ).readMultipleVerses(config.mainText, verseList, presentMode=True)
    content = "<div style='display:flex;'><div style='position: absolute;top: {2}%;transform: translateY(-{3}%);{1}'>{0}</div></div>".format(
        re.sub("\n", "<br>",
               content), style, config.presentationVerticalPosition,
        config.presentationHorizontalPosition)
    return ("popover.fullscreen".format(screenNo), content, {})
예제 #5
0
    def setupToolBar(self):
        self.firstToolBar = QToolBar()
        self.firstToolBar.setWindowTitle(config.thisTranslation["bar1_title"])
        self.firstToolBar.setContextMenuPolicy(Qt.PreventContextMenu)
        self.addToolBar(self.firstToolBar)

        self.versionCombo = QComboBox()
        self.bibleVersions = BiblesSqlite().getBibleList()
        self.versionCombo.addItems(self.bibleVersions)
        initialIndex = 0
        if config.mainText in self.bibleVersions:
            initialIndex = self.bibleVersions.index(config.mainText)
        self.versionCombo.setCurrentIndex(initialIndex)
        self.versionCombo.currentIndexChanged.connect(self.changeBibleVersion)
        self.firstToolBar.addWidget(self.versionCombo)

        # books = BibleBooks.getStandardBookAbbreviations()
        # self.bibleBookCombo = QComboBox()
        # self.bibleBookCombo.addItems(books)
        # self.bibleBookCombo.setCurrentIndex(config.mainB-1)
        # self.bibleBookCombo.currentIndexChanged.connect(
        #     lambda: self.runTextCommand("BIBLE:::{0}:::{1}".format(config.mainText, "Matt 1:1")))
        # self.firstToolBar.addWidget(self.bibleBookCombo)

        button = QPushButton("<<")
        button.setFixedWidth(40)
        self.addStandardTextButton("menu_previous_book", self.previousMainBook,
                                   self.firstToolBar, button)
        button = QPushButton("<")
        button.setFixedWidth(40)
        self.addStandardTextButton("menu_previous_chapter",
                                   self.previousMainChapter, self.firstToolBar,
                                   button)
        self.mainRefButton = QPushButton(self.verseReference("main")[-1])
        self.addStandardTextButton(
            "bar1_reference", lambda: self.runTextCommand(
                "_menu:::{0}.{1}".format(config.mainText, config.mainB)),
            self.firstToolBar, self.mainRefButton)
        # The height of the first text button is used to fix icon button width when a qt-material theme is applied.
        if config.qtMaterial and config.qtMaterialTheme:
            config.iconButtonWidth = self.mainRefButton.height()
        button = QPushButton(">")
        button.setFixedWidth(40)
        self.addStandardTextButton("menu_next_chapter", self.nextMainChapter,
                                   self.firstToolBar, button)
        button = QPushButton(">>")
        button.setFixedWidth(40)
        self.addStandardTextButton("menu_next_book", self.nextMainBook,
                                   self.firstToolBar, button)

        self.addStandardIconButton("bar1_searchBible", "search.png",
                                   self.displaySearchBibleCommand,
                                   self.firstToolBar)

        self.firstToolBar.addSeparator()

        self.textCommandLineEdit = QLineEdit()
        self.textCommandLineEdit.setClearButtonEnabled(True)
        self.textCommandLineEdit.setToolTip(
            config.thisTranslation["bar1_command"])
        self.textCommandLineEdit.setMinimumWidth(100)
        self.textCommandLineEdit.returnPressed.connect(self.textCommandEntered)
        self.firstToolBar.addWidget(self.textCommandLineEdit)

        self.studyBibleToolBar = QToolBar()
        self.studyRefButton, self.enableParagraphButton = QPushButton(
        ), QPushButton()
        self.secondToolBar = QToolBar()
        self.leftToolBar = QToolBar()
        self.rightToolBar = QToolBar()
        self.commentaryRefButton = QPushButton(
            self.verseReference("commentary"))
예제 #6
0
class Starter:
    def create_menu(self):

        config.instantMode = 0
        config.parallelMode = 1
        config.syncStudyWindowBibleWithMainWindow = True
        config.syncCommentaryWithMainWindow = False
        config.readFormattedBibles = True
        config.topToolBarOnly = True

        menuBar = self.menuBar()
        menu = addMenu(menuBar, "menu1_app")
        subMenu = addSubMenu(menu, "menu1_selectTheme")
        items = (
            ("menu_light_theme", self.setDefaultTheme),
            ("menu1_dark_theme", self.setDarkTheme),
        )
        for feature, action in items:
            addMenuItem(subMenu, feature, self, action)
        subMenu = addSubMenu(menu, "menu1_selectMenuLayout")
        addMenuLayoutItems(self, subMenu)
        subMenu = addSubMenu(menu, "languageSettings")
        for language in LanguageUtil.getNamesSupportedLanguages():
            addMenuItem(subMenu,
                        language,
                        self,
                        lambda language=language: self.changeInterfaceLanguage(
                            language),
                        translation=False)
        addIconMenuItem("UniqueBibleApp.png", menu, "menu1_exit", self,
                        self.quitApp, sc.quitApp)

        menu = addMenu(menuBar, "menu_bible")
        items = (
            ("menu_next_book", self.nextMainBook),
            ("menu_previous_book", self.previousMainBook),
            ("menu4_next", self.nextMainChapter),
            ("menu4_previous", self.previousMainChapter),
            ("menu5_search", self.displaySearchBibleCommand),
        )
        for feature, action in items:
            addMenuItem(menu, feature, self, action)
        menu.addSeparator()
        addMenuItem(menu, "add", self, self.installMarvelBibles)

        menu = addMenu(menuBar, "menu9_information")
        addMenuItem(menu, "latestChanges", self, self.showInfo)
        menu.addSeparator()
        addMenuItem(menu, "menu1_update", self, self.showUpdateAppWindow)
        menu.addSeparator()
        items = (("menu1_wikiPages", self.openUbaWiki),
                 ("menu_discussions",
                  self.openUbaDiscussions), ("report", self.reportAnIssue),
                 ("menu9_contact", self.contactEliranWong), ("menu9_donate",
                                                             self.donateToUs))
        for feature, action in items:
            addMenuItem(menu, feature, self, action)

    def setupToolBarStandardIconSize(self):
        Starter.setupToolBar(self)

    def setupToolBarFullIconSize(self):
        Starter.setupToolBar(self)

    def setupToolBar(self):
        self.firstToolBar = QToolBar()
        self.firstToolBar.setWindowTitle(config.thisTranslation["bar1_title"])
        self.firstToolBar.setContextMenuPolicy(Qt.PreventContextMenu)
        self.addToolBar(self.firstToolBar)

        self.versionCombo = QComboBox()
        self.bibleVersions = BiblesSqlite().getBibleList()
        self.versionCombo.addItems(self.bibleVersions)
        initialIndex = 0
        if config.mainText in self.bibleVersions:
            initialIndex = self.bibleVersions.index(config.mainText)
        self.versionCombo.setCurrentIndex(initialIndex)
        self.versionCombo.currentIndexChanged.connect(self.changeBibleVersion)
        self.firstToolBar.addWidget(self.versionCombo)

        # books = BibleBooks.getStandardBookAbbreviations()
        # self.bibleBookCombo = QComboBox()
        # self.bibleBookCombo.addItems(books)
        # self.bibleBookCombo.setCurrentIndex(config.mainB-1)
        # self.bibleBookCombo.currentIndexChanged.connect(
        #     lambda: self.runTextCommand("BIBLE:::{0}:::{1}".format(config.mainText, "Matt 1:1")))
        # self.firstToolBar.addWidget(self.bibleBookCombo)

        button = QPushButton("<<")
        button.setFixedWidth(40)
        self.addStandardTextButton("menu_previous_book", self.previousMainBook,
                                   self.firstToolBar, button)
        button = QPushButton("<")
        button.setFixedWidth(40)
        self.addStandardTextButton("menu_previous_chapter",
                                   self.previousMainChapter, self.firstToolBar,
                                   button)
        self.mainRefButton = QPushButton(self.verseReference("main")[-1])
        self.addStandardTextButton(
            "bar1_reference", lambda: self.runTextCommand(
                "_menu:::{0}.{1}".format(config.mainText, config.mainB)),
            self.firstToolBar, self.mainRefButton)
        # The height of the first text button is used to fix icon button width when a qt-material theme is applied.
        if config.qtMaterial and config.qtMaterialTheme:
            config.iconButtonWidth = self.mainRefButton.height()
        button = QPushButton(">")
        button.setFixedWidth(40)
        self.addStandardTextButton("menu_next_chapter", self.nextMainChapter,
                                   self.firstToolBar, button)
        button = QPushButton(">>")
        button.setFixedWidth(40)
        self.addStandardTextButton("menu_next_book", self.nextMainBook,
                                   self.firstToolBar, button)

        self.addStandardIconButton("bar1_searchBible", "search.png",
                                   self.displaySearchBibleCommand,
                                   self.firstToolBar)

        self.firstToolBar.addSeparator()

        self.textCommandLineEdit = QLineEdit()
        self.textCommandLineEdit.setClearButtonEnabled(True)
        self.textCommandLineEdit.setToolTip(
            config.thisTranslation["bar1_command"])
        self.textCommandLineEdit.setMinimumWidth(100)
        self.textCommandLineEdit.returnPressed.connect(self.textCommandEntered)
        self.firstToolBar.addWidget(self.textCommandLineEdit)

        self.studyBibleToolBar = QToolBar()
        self.studyRefButton, self.enableParagraphButton = QPushButton(
        ), QPushButton()
        self.secondToolBar = QToolBar()
        self.leftToolBar = QToolBar()
        self.rightToolBar = QToolBar()
        self.commentaryRefButton = QPushButton(
            self.verseReference("commentary"))
예제 #7
0
 def getTwwyVerses(self, text):
     twwyVerses = (
         (23, 64, 7),
         (26, 22, 30),
         (62, 5, 14),
         (58, 4, 14, 16),
         (4, 14, 17),
         (58, 4, 14, 16),
         (58, 4, 14, 16),
         (19, 25, 11),
         (15, 9, 13),
         (24, 31, 9),
         (62, 5, 14),
         (19, 19, 14),
         (19, 33, 21),
         (1, 31, 2),
         (1, 32, 12),
         (1, 32, 9),
         (47, 1, 20),
         (47, 6, 1),
         (47, 6, 16),
         (3, 26, 12),
         (2, 32, 27),
         (23, 52, 11),
         (47, 7, 1),
         (48, 3, 16),
         (48, 3, 29),
         (40, 4, 5, 7),
         (29, 2, 29, 32),
         (44, 2, 15),
         (66, 6, 12),
         (23, 7, 10, 16),
         (40, 1, 21, 23),
         (19, 50, 14, 15),
         (40, 6, 33),
         (19, 69, 13),
         (58, 6, 15),
         (19, 89, 15, 16),
         (48, 5, 25),
         (60, 2, 23),
         (60, 2, 21),
         (60, 4, 19),
         (19, 31, 5),
         (42, 23, 46),
         (19, 16, 8),
         (19, 25, 15),
         (19, 26, 3),
         (19, 62, 5),
         (19, 141, 8),
         (19, 73, 28),
         (19, 123, 1, 2),
         (51, 3, 23),
         (19, 37, 5),
         (19, 26, 1),
         (19, 119, 55),
         (19, 31, 5),
         (18, 5, 8),
         (23, 26, 8, 9),
         (19, 39, 7),
         (19, 71, 14),
         (45, 6, 13),
         (45, 12, 1),
         (60, 2, 23),
         (60, 4, 19),
         (19, 90, 1),
         (52, 5, 17, 18),
         (46, 7, 17),
         (58, 10, 5, 7),
         (40, 26, 39),
         (40, 26, 42),
         (50, 4, 11, 13),
         (45, 8, 28, 29),
         (19, 57, 1, 2),
         (46, 7, 17),
         (18, 23, 14),
         (50, 4, 11, 13),
         (18, 23, 8, 10),
         (19, 77, 19),
         (24, 10, 23),
         (21, 5, 19),
         (19, 16, 5, 6),
         (52, 5, 17, 18),
         (43, 12, 27, 28),
         (41, 14, 36),
         (45, 8, 28, 29),
         (40, 26, 42),
         (18, 1, 21),
         (43, 21, 22),
         (19, 31, 15),
         (44, 21, 14),
         (19, 115, 3),
         (38, 14, 9),
         (25, 2, 17),
         (23, 66, 18),
         (23, 48, 11),
         (46, 8, 6),
         (51, 1, 16),
         (58, 2, 10),
         (45, 11, 36),
         (6, 7, 9),
         (11, 8, 41, 43),
         (11, 8, 59, 60),
         (11, 18, 36, 37),
         (12, 19, 15, 16),
         (12, 19, 19),
         (19, 71, 8),
         (19, 106, 47),
         (19, 79, 9),
         (19, 74, 18),
         (19, 74, 20),
         (19, 74, 22),
         (19, 83, 16),
         (19, 83, 17, 18),
         (19, 109, 27),
         (24, 14, 20, 21),
         (43, 17, 24),
         (43, 12, 27, 28),
         (19, 86, 9),
         (19, 135, 13),
         (23, 26, 8),
         (41, 12, 24),
         (5, 7, 9),
         (6, 23, 14),
         (16, 9, 8),
         (56, 1, 9),
         (10, 22, 31),
         (19, 19, 7),
         (56, 1, 2),
         (43, 10, 35),
         (66, 22, 6),
         (40, 24, 35),
         (61, 1, 19),
         (20, 30, 5),
         (55, 2, 13),
         (19, 93, 5),
         (58, 6, 17, 19),
         (52, 5, 24),
         (58, 10, 23),
         (10, 7, 28),
         (5, 32, 4),
         (19, 145, 13),
         (19, 111, 7),
         (23, 49, 7),
         (46, 1, 9),
         (53, 3, 3),
         (11, 8, 15),
         (19, 9, 10),
         (24, 17, 7, 8),
         (34, 1, 7),
         (58, 10, 35),
         (40, 8, 13),
         (44, 10, 43),
         (44, 13, 39),
         (45, 10, 4),
         (45, 1, 16),
         (43, 12, 44),
         (43, 11, 26),
         (43, 1, 12),
         (43, 3, 16),
         (44, 16, 31),
         (45, 3, 21, 22),
         (45, 4, 5),
         (19, 34, 22),
         (45, 10, 11),
         (45, 10, 9),
         (46, 1, 21),
         (55, 1, 12),
         (58, 3, 14),
         (62, 5, 1),
         (62, 5, 13),
         (43, 6, 35),
         (43, 7, 38, 39),
         (43, 14, 12),
         (49, 1, 19),
         (58, 4, 16),
         (41, 11, 24),
         (62, 3, 21, 22),
         (62, 5, 14),
         (40, 17, 20),
         (58, 11, 6),
         (41, 9, 23),
         (19, 37, 5, 6),
         (19, 125, 1),
         (23, 30, 15),
         (20, 3, 5, 6),
         (43, 12, 46),
         (43, 16, 27),
         (62, 5, 5),
         (19, 31, 19),
         (49, 6, 16),
         (20, 3, 26),
         (19, 37, 40),
         (19, 18, 30),
         (60, 1, 5),
         (19, 5, 11),
         (42, 17, 5),
         (41, 9, 24),
         (42, 22, 32),
         (44, 15, 11),
         (11, 8, 23, 24),
         (19, 31, 14),
         (23, 25, 1),
         (19, 33, 21),
         (19, 55, 23),
         (19, 26, 1),
         (19, 31, 5),
         (42, 1, 38),
         (19, 89, 1),
         (47, 3, 18),
         (23, 33, 17),
         (58, 1, 3),
         (18, 16, 19),
         (19, 45, 7),
         (19, 89, 27, 29),
         (19, 110, 1, 2),
         (19, 132, 17, 18),
         (23, 9, 6, 7),
         (23, 11, 2, 4),
         (23, 11, 10, 11),
         (23, 22, 22),
         (23, 42, 1, 4),
         (23, 44, 6),
         (23, 42, 6, 7),
         (23, 53, 5),
         (23, 53, 10, 11),
         (23, 55, 5),
         (23, 61, 1, 2),
         (58, 4, 14, 16),
         (24, 23, 6),
         (24, 33, 22),
         (26, 1, 26),
         (26, 1, 28),
         (26, 34, 23),
         (26, 37, 24),
         (28, 3, 5),
         (27, 7, 13, 14),
         (33, 5, 2),
         (33, 5, 4, 5),
         (38, 12, 10),
         (59, 2, 1),
         (51, 3, 4),
         (41, 10, 45),
         (42, 1, 32),
         (42, 19, 10),
         (42, 22, 69),
         (43, 1, 14),
         (43, 5, 19),
         (43, 10, 11),
         (43, 10, 14, 15),
         (44, 2, 23),
         (44, 4, 12),
         (44, 10, 38),
         (48, 1, 3, 4),
         (50, 2, 9, 11),
         (51, 2, 2, 3),
         (56, 2, 13, 14),
         (58, 1, 8),
         (58, 2, 10),
         (58, 2, 16, 18),
         (58, 4, 14, 15),
         (58, 5, 7, 9),
         (58, 7, 16),
         (58, 7, 25),
         (58, 9, 14),
         (58, 10, 12, 13),
         (62, 2, 2),
         (66, 1, 5),
         (66, 1, 16),
         (66, 1, 18),
         (66, 5, 4, 7),
         (66, 5, 9),
         (66, 5, 12, 13),
         (66, 19, 16),
         (66, 21, 22, 23),
         (45, 1, 20),
         (46, 8, 6),
         (27, 7, 9, 10),
         (27, 4, 17),
         (27, 4, 35),
         (45, 11, 32, 36),
         (30, 5, 8),
         (30, 4, 13),
         (35, 3, 3, 4),
         (19, 145, 3),
         (23, 40, 23),
         (24, 10, 10),
         (27, 2, 22),
         (24, 32, 19),
         (24, 10, 6, 7),
         (34, 1, 3),
         (19, 103, 19),
         (44, 17, 25),
         (36, 3, 5),
         (5, 32, 4),
         (9, 2, 2),
         (19, 77, 13),
         (9, 6, 20),
         (35, 2, 20),
         (19, 93, 2),
         (19, 33, 11),
         (18, 11, 7),
         (23, 40, 15),
         (23, 40, 17),
         (44, 17, 24, 25),
         (24, 32, 18, 19),
         (11, 8, 27),
         (24, 23, 23, 24),
         (18, 26, 14),
         (24, 32, 27),
         (42, 1, 37),
         (45, 4, 17),
         (54, 1, 17),
         (58, 4, 13),
         (19, 139, 1, 4),
         (23, 45, 24),
         (10, 24, 14),
         (33, 7, 18, 19),
         (28, 11, 4),
         (42, 6, 35),
         (19, 30, 5),
         (14, 30, 9),
         (23, 44, 22),
         (18, 36, 7),
         (34, 1, 7),
         (25, 3, 22, 23),
         (23, 30, 18),
         (19, 125, 2),
         (20, 18, 10),
         (62, 4, 10),
         (65, 1, 24),
         (19, 28, 8),
         (5, 33, 27),
         (19, 46, 1),
         (19, 147, 3),
         (45, 8, 38, 39),
         (23, 63, 9),
         (19, 23, 1, 3),
         (5, 31, 8),
         (2, 15, 11),
         (5, 3, 24),
         (7, 5, 31),
         (9, 2, 2),
         (10, 22, 2, 4),
         (13, 16, 36),
         (13, 29, 11, 13),
         (14, 14, 11),
         (14, 20, 6),
         (16, 9, 5, 6),
         (19, 18, 1),
         (19, 26, 8),
         (19, 31, 19),
         (19, 35, 27),
         (19, 36, 7),
         (19, 48, 10),
         (19, 59, 17),
         (19, 62, 12),
         (19, 71, 8),
         (19, 71, 23),
         (19, 89, 1),
         (19, 92, 4),
         (19, 93, 2),
         (19, 93, 5),
         (19, 101, 1),
         (19, 102, 12),
         (19, 115, 1),
         (19, 115, 18),
         (19, 119, 68),
         (19, 119, 73),
         (19, 130, 4),
         (19, 145, 1, 2),
         (23, 12, 1),
         (23, 25, 1),
         (23, 26, 12),
         (24, 10, 6),
         (24, 32, 17),
         (25, 5, 21),
         (27, 2, 20, 21),
         (40, 6, 9),
         (44, 4, 24),
         (58, 1, 12),
         (66, 4, 8),
         (66, 4, 11),
         (66, 5, 9, 10),
         (66, 7, 10),
         (66, 11, 17),
         (66, 15, 3, 4),
         (66, 19, 6),
         (13, 16, 35),
         (19, 9, 1),
         (19, 13, 5),
         (19, 28, 7),
         (19, 31, 7),
         (19, 57, 9),
         (19, 69, 30),
         (19, 75, 1),
         (19, 79, 13),
         (19, 86, 12),
         (19, 103, 1),
         (19, 103, 2),
         (19, 103, 22),
         (19, 116, 17),
         (19, 118, 19),
         (19, 118, 21),
         (19, 118, 28),
         (23, 12, 1),
         (23, 61, 10),
         (2, 33, 18),
         (43, 17, 24),
         (19, 106, 47),
         (19, 142, 7),
         (19, 104, 34),
         (19, 22, 25),
         (19, 9, 2),
         (19, 71, 14),
         (19, 104, 33),
         (19, 34, 1),
         (19, 9, 1, 2),
         (19, 44, 8),
         (19, 108, 1),
         (19, 13, 6),
         (19, 63, 3),
         (19, 77, 12),
         (35, 3, 17, 18),
         (45, 5, 11),
         (66, 11, 15),
         (14, 30, 9),
         (18, 14, 17),
         (19, 85, 2, 3),
         (19, 86, 5),
         (19, 103, 10, 12),
         (19, 130, 3, 4),
         (23, 43, 25),
         (23, 44, 22),
         (24, 50, 20),
         (24, 51, 10),
         (36, 3, 15),
         (38, 3, 4),
         (43, 1, 29),
         (58, 9, 22),
         (49, 1, 7),
         (62, 1, 9),
         (7, 10, 10),
         (7, 10, 15),
         (9, 12, 10),
         (15, 9, 6),
         (15, 9, 10),
         (15, 9, 13),
         (15, 9, 15),
         (16, 1, 6, 7),
         (16, 9, 32, 33),
         (19, 79, 8),
         (23, 59, 12, 13),
         (23, 64, 6, 7),
         (24, 3, 25),
         (24, 14, 7),
         (24, 14, 20, 21),
         (24, 16, 19),
         (27, 9, 8, 9),
         (27, 9, 17),
         (27, 9, 18, 19),
         (18, 42, 2, 6),
         (10, 24, 10),
         (10, 24, 17),
         (13, 21, 8),
         (19, 25, 6, 7),
         (19, 25, 11),
         (19, 32, 5),
         (19, 69, 5),
         (25, 1, 20),
         (42, 5, 8),
         (42, 11, 4),
         (42, 18, 13),
         (19, 32, 5),
         (18, 16, 19),
         (19, 130, 4),
         (27, 9, 9),
         (45, 8, 1),
         (47, 5, 19),
         (36, 3, 9),
         (38, 12, 10),
         (45, 8, 26, 27),
         (48, 4, 6),
         (19, 80, 18),
         (19, 116, 17),
         (19, 57, 8),
         (19, 116, 13),
         (9, 12, 23),
         (14, 7, 14),
         (14, 34, 27),
         (18, 33, 26),
         (19, 2, 8),
         (19, 34, 4, 5),
         (19, 37, 4, 5),
         (19, 66, 18, 20),
         (19, 72, 12),
         (19, 86, 7),
         (19, 91, 15, 16),
         (19, 102, 17),
         (19, 118, 5),
         (19, 145, 18, 19),
         (23, 30, 19),
         (23, 58, 8, 9),
         (23, 64, 4),
         (24, 29, 12, 13),
         (27, 10, 12),
         (27, 9, 23),
         (28, 14, 8),
         (40, 6, 8),
         (40, 7, 8),
         (41, 11, 24),
         (42, 11, 13),
         (43, 14, 13, 14),
         (43, 15, 7),
         (43, 15, 16),
         (43, 16, 23, 24),
         (45, 5, 2),
         (49, 2, 18),
         (49, 3, 11, 12),
         (49, 3, 20),
         (50, 4, 6, 7),
         (58, 4, 15, 16),
         (59, 5, 16),
         (62, 5, 14, 15),
         (19, 86, 3),
         (19, 28, 2),
         (19, 70, 5),
         (19, 71, 12),
         (19, 79, 8),
         (19, 102, 1, 2),
         (19, 143, 1),
         (19, 143, 7),
         (19, 69, 13),
         (19, 27, 9),
         (19, 106, 4, 5),
         (19, 66, 20),
         (19, 39, 7),
         (19, 77, 1),
         (19, 118, 21),
         (19, 116, 2),
         (19, 4, 3),
         (10, 22, 4),
         (19, 106, 8),
         (26, 36, 25, 27),
         (19, 107, 20),
         (23, 45, 17),
         (23, 55, 5),
         (23, 65, 1),
         (24, 50, 4, 5),
         (26, 11, 19, 20),
         (26, 18, 23),
         (26, 18, 32),
         (28, 2, 19, 20),
         (29, 2, 32),
         (42, 5, 32),
         (42, 19, 10),
         (43, 5, 24, 25),
         (43, 6, 37),
         (43, 6, 65),
         (43, 10, 9),
         (43, 11, 25, 26),
         (43, 14, 6),
         (43, 20, 31),
         (44, 2, 38, 39),
         (44, 3, 19, 20),
         (44, 11, 18),
         (44, 13, 38),
         (44, 16, 31),
         (44, 26, 18),
         (45, 1, 16),
         (45, 4, 5),
         (45, 5, 1),
         (45, 5, 8),
         (45, 8, 1),
         (45, 9, 16),
         (45, 10, 4),
         (45, 10, 9),
         (45, 10, 12, 13),
         (45, 10, 17),
         (46, 1, 18),
         (46, 15, 22),
         (46, 15, 49),
         (47, 5, 19),
         (47, 5, 21),
         (52, 5, 9),
         (49, 2, 8, 9),
         (54, 2, 3, 4),
         (55, 1, 10),
         (56, 3, 5, 6),
         (58, 7, 25),
         (58, 8, 10, 12),
         (58, 9, 26),
         (58, 10, 14),
         (61, 3, 9),
         (62, 5, 11, 12),
         (62, 5, 20),
         (66, 1, 5),
         (66, 22, 17),
         (13, 16, 35),
         (24, 31, 7),
         (45, 10, 1),
         (41, 10, 47),
         (19, 6, 4),
         (19, 69, 1),
         (19, 109, 21),
         (19, 116, 4),
         (19, 119, 170),
         (19, 27, 13),
         (23, 63, 16),
         (19, 62, 1),
         (1, 22, 18),
         (19, 2, 8),
         (19, 86, 9),
         (23, 49, 6),
         (41, 11, 17),
         (23, 61, 11),
         (24, 4, 1, 2),
         (26, 38, 23),
         (39, 1, 11),
         (39, 1, 14),
         (40, 24, 14),
         (45, 1, 5),
         (45, 16, 25, 26),
         (66, 7, 9, 10),
         (53, 3, 1, 2),
         (42, 10, 2),
         (19, 67, 2),
         (19, 108, 5),
         (44, 4, 30),
         (13, 16, 31),
         (19, 67, 3),
         (19, 67, 4),
         (45, 10, 1),
         (54, 2, 1, 4),
         (40, 9, 38),
         (51, 4, 2, 4),
         (49, 6, 18, 20),
         (19, 77, 14),
         (24, 16, 19),
         (19, 108, 3),
         (19, 145, 6),
         (19, 105, 1),
         (23, 12, 4),
         (23, 62, 1),
         (44, 20, 24),
         (19, 86, 9),
         (35, 2, 14),
         (19, 22, 27),
         (19, 86, 9),
         (5, 33, 3),
         (19, 32, 10),
         (19, 33, 18),
         (19, 62, 12),
         (19, 86, 5),
         (19, 89, 14),
         (19, 103, 4),
         (19, 103, 8),
         (19, 103, 11),
         (20, 16, 6),
         (23, 49, 15),
         (23, 54, 10),
         (25, 3, 22),
         (25, 3, 32),
         (33, 7, 18),
         (19, 139, 16, 18),
         (19, 142, 3),
         (28, 3, 1),
         (36, 3, 17),
         (40, 10, 29, 31),
         (43, 15, 9),
         (45, 1, 7),
         (45, 8, 31, 32),
         (45, 8, 38, 39),
         (49, 1, 4, 5),
         (62, 3, 1),
         (62, 4, 9, 10),
         (10, 22, 20),
         (19, 37, 23, 24),
         (19, 44, 3),
         (23, 40, 11),
         (19, 103, 5),
         (19, 107, 9),
         (10, 2, 6),
         (19, 17, 7),
         (19, 33, 22),
         (19, 44, 26),
         (19, 48, 9),
         (19, 51, 1),
         (19, 69, 16),
         (19, 85, 7),
         (19, 90, 14),
         (19, 109, 21),
         (19, 119, 41),
         (19, 119, 124),
         (19, 143, 8),
         (4, 14, 19),
         (19, 13, 5),
         (19, 25, 6, 7),
         (43, 17, 23),
         (43, 17, 26),
         (45, 15, 30),
         (53, 3, 5),
         (19, 117, 2),
         (19, 26, 3),
         (19, 59, 17),
         (19, 31, 21),
         (19, 5, 7),
         (19, 63, 3),
         (19, 42, 8),
         (19, 144, 2),
         (19, 59, 16),
         (19, 40, 11),
         (18, 10, 12),
         (19, 31, 7),
         (19, 13, 5),
         (62, 4, 16),
         (19, 94, 18, 19),
         (2, 15, 13),
         (19, 143, 12),
         (19, 52, 8),
         (19, 13, 5),
         (19, 86, 13),
         (19, 130, 8),
         (19, 87, 5, 6),
         (19, 133, 1),
         (19, 133, 3),
         (19, 135, 14),
         (23, 49, 15),
         (23, 54, 1),
         (48, 4, 27, 29),
         (23, 56, 7),
         (23, 58, 10, 12),
         (23, 60, 1, 5),
         (23, 60, 15),
         (23, 62, 2, 4),
         (24, 31, 31),
         (24, 31, 33, 34),
         (24, 31, 9),
         (26, 34, 31),
         (26, 37, 26, 28),
         (27, 7, 27),
         (28, 1, 10),
         (45, 9, 24, 26),
         (33, 4, 1, 2),
         (33, 7, 15),
         (36, 3, 11, 12),
         (36, 3, 19, 20),
         (38, 2, 5),
         (37, 2, 5),
         (38, 2, 10, 11),
         (38, 8, 8),
         (38, 9, 16, 17),
         (40, 13, 43),
         (40, 16, 18, 19),
         (40, 21, 13),
         (40, 25, 34),
         (40, 28, 19, 20),
         (43, 10, 4),
         (43, 10, 14, 15),
         (43, 10, 27, 28),
         (43, 17, 6),
         (43, 17, 23),
         (43, 17, 24),
         (43, 17, 26),
         (44, 20, 28),
         (46, 2, 16),
         (46, 3, 21, 23),
         (46, 12, 18),
         (46, 12, 24, 26),
         (47, 2, 14),
         (48, 3, 26, 27),
         (48, 3, 29),
         (49, 2, 6),
         (49, 2, 22),
         (49, 3, 10),
         (49, 3, 20, 21),
         (49, 4, 11, 12),
         (51, 2, 19),
         (51, 3, 3),
         (52, 5, 5),
         (58, 2, 11),
         (58, 11, 16),
         (60, 2, 5),
         (60, 2, 9),
         (62, 1, 7),
         (62, 2, 1),
         (62, 3, 2, 3),
         (65, 1, 1),
         (66, 7, 15),
         (66, 7, 17),
         (66, 21, 3, 4),
         (66, 22, 3, 5),
         (49, 1, 16, 19),
         (49, 3, 16, 17),
         (49, 3, 17),
         (43, 17, 20, 21),
         (43, 17, 23),
         (50, 1, 9, 11),
         (51, 1, 9, 10),
         (51, 1, 11, 12),
         (53, 1, 11, 12),
         (19, 35, 18),
         (19, 52, 9),
         (58, 2, 12),
         (19, 26, 12),
         (19, 111, 1),
         (19, 116, 14),
         (49, 4, 8),
         (49, 4, 11, 13),
         (10, 23, 3, 4),
         (24, 23, 4),
         (24, 3, 15),
         (24, 1, 9),
         (2, 4, 12),
         (23, 51, 16),
         (24, 23, 28, 29),
         (24, 15, 19),
         (54, 2, 1, 4),
         (11, 3, 9),
         (45, 15, 30, 32),
         (49, 6, 19, 20),
         (44, 6, 4),
         (42, 17, 10),
         (54, 1, 15),
         (44, 20, 24),
         (6, 1, 8),
         (19, 1, 2, 3),
         (20, 6, 22, 23),
         (20, 30, 5),
         (23, 55, 11),
         (41, 13, 31),
         (44, 20, 32),
         (45, 15, 4),
         (54, 4, 4, 5),
         (55, 3, 15, 17),
         (58, 4, 12),
         (59, 1, 17, 18),
         (60, 1, 23, 25),
         (61, 1, 20, 21),
         (62, 2, 14),
         (66, 1, 3),
         (19, 119, 18),
         (19, 119, 135),
         (19, 119, 49),
         (19, 119, 58),
         (19, 119, 76),
         (19, 119, 116),
         (19, 119, 77),
         (19, 119, 17),
         (19, 119, 25),
         (19, 119, 27),
         (19, 119, 169),
         (19, 119, 125),
         (19, 119, 10),
         (19, 119, 132, 133),
         (19, 119, 173),
         (19, 119, 36, 37),
         (19, 119, 29),
         (19, 119, 33, 34),
         (19, 119, 66),
         (19, 119, 22),
         (19, 119, 31),
         (19, 119, 107),
         (19, 119, 153, 154),
         (19, 119, 79),
         (19, 119, 89),
         (19, 119, 112),
         (19, 119, 15, 16),
         (19, 119, 57),
         (19, 119, 114),
         (19, 119, 147),
         (19, 119, 45),
         (24, 4, 1, 2),
         (19, 19, 7),
         (19, 110, 3),
         (23, 2, 2, 3),
         (23, 10, 20, 21),
         (23, 27, 6),
         (23, 29, 17, 19),
         (23, 29, 22),
         (23, 32, 15),
         (23, 33, 17),
         (23, 35, 1, 2),
         (23, 35, 6),
         (23, 41, 18),
         (23, 43, 20, 21),
         (23, 44, 3, 5),
         (23, 51, 3),
         (23, 54, 13),
         (24, 3, 12),
         (24, 24, 7),
         (24, 30, 17),
         (24, 30, 19),
         (24, 31, 9),
         (28, 6, 1, 3),
         (29, 2, 25),
         (5, 26, 15),
         (11, 8, 52),
         (26, 37, 9),
         (19, 85, 4, 6),
         (35, 3, 2),
         (23, 64, 1, 2),
         (19, 86, 4),
         (19, 142, 7),
         (19, 126, 4),
         (19, 43, 3),
         (19, 27, 8),
         (19, 106, 4),
         (24, 15, 16),
         (19, 40, 8),
         (19, 126, 3),
         (19, 71, 20),
         (19, 68, 9),
         (28, 6, 3),
         (19, 102, 13),
         (23, 32, 15),
         (26, 37, 14),
         (52, 1, 5),
         (26, 39, 29),
         (29, 2, 28, 29),
         (40, 3, 11),
         (42, 11, 13),
         (42, 24, 49),
         (43, 7, 37, 39),
         (43, 14, 12),
         (43, 14, 16, 17),
         (43, 14, 26, 27),
         (43, 16, 13, 14),
         (43, 20, 22),
         (44, 1, 8),
         (45, 5, 5),
         (45, 7, 6),
         (45, 8, 13),
         (45, 8, 14, 15),
         (48, 4, 6),
         (45, 8, 16),
         (46, 2, 9, 10),
         (46, 2, 12),
         (46, 12, 11),
         (47, 3, 6),
         (47, 3, 17, 18),
         (48, 5, 16),
         (48, 5, 18),
         (48, 5, 22, 23),
         (48, 6, 8),
         (62, 2, 20),
         (62, 2, 27),
         (26, 37, 9),
         (27, 9, 17),
         (19, 60, 1),
         (19, 74, 1, 2),
         (19, 80, 4),
         (19, 80, 7),
         (19, 80, 18),
         (19, 85, 4),
         (24, 14, 8, 9),
         (25, 5, 21),
         (24, 31, 18),
         (19, 68, 28),
         (19, 80, 2),
         (19, 4, 6),
         (19, 67, 1),
         (25, 5, 21),
         (19, 143, 10),
         (35, 3, 2),
         (45, 15, 13),
         (19, 89, 15),
         (23, 26, 12, 13),
         (19, 104, 30),
         (50, 1, 19),
         (3, 20, 26),
         (3, 26, 11, 12),
         (5, 7, 6),
         (9, 12, 22),
         (13, 17, 21, 22),
         (4, 18, 20),
         (56, 2, 13, 14),
         (19, 5, 2),
         (19, 22, 1),
         (19, 71, 12),
         (19, 38, 21),
         (19, 22, 10),
         (19, 25, 2),
         (27, 9, 19),
         (19, 119, 94),
         (10, 22, 3),
         (19, 31, 14),
         (19, 91, 2),
         (19, 106, 47),
         (2, 33, 13),
         (2, 33, 16),
         (5, 9, 29),
         (5, 26, 15),
         (19, 85, 6),
         (35, 1, 12),
         (9, 2, 2),
         (33, 7, 7),
         (19, 90, 1),
         (19, 18, 31),
         (19, 59, 10),
         (44, 27, 23),
         (19, 132, 3, 5),
         (19, 3, 8),
         (19, 118, 28),
         (2, 15, 2),
         (19, 79, 13),
         (1, 39, 2, 3),
         (1, 39, 21),
         (1, 39, 23),
         (6, 1, 5),
         (6, 6, 27),
         (7, 6, 12),
         (9, 3, 19),
         (9, 18, 12),
         (10, 7, 3),
         (12, 18, 7),
         (13, 11, 9),
         (11, 8, 57, 58),
         (13, 22, 11),
         (13, 28, 20),
         (37, 2, 4),
         (44, 7, 9, 10),
         (44, 10, 38),
         (1, 28, 15),
         (2, 4, 12),
         (6, 1, 9),
         (14, 15, 2),
         (19, 14, 5),
         (19, 46, 7),
         (19, 91, 1, 2),
         (19, 139, 8, 10),
         (23, 41, 10),
         (23, 43, 2),
         (23, 43, 4, 7),
         (24, 1, 8),
         (24, 1, 19),
         (24, 42, 11, 12),
         (40, 28, 19, 20),
         (44, 18, 9, 10),
         (50, 4, 9),
         (2, 33, 16),
         (19, 118, 25),
         (2, 33, 15),
         (11, 8, 57),
         (53, 1, 11, 12),
         (19, 61, 4),
         (19, 71, 3),
         (10, 14, 17),
         (13, 4, 10),
         (45, 15, 33),
         (47, 13, 14),
         (63, 1, 3),
         (23, 8, 10),
         (19, 139, 18),
         (14, 13, 12),
         (19, 73, 23, 26),
         (19, 23, 4),
         (19, 14, 5),
         (66, 21, 3),
         (2, 29, 46),
         (2, 33, 14),
         (5, 4, 7),
         (11, 6, 13),
         (19, 91, 1),
         (23, 57, 15),
         (24, 30, 21),
         (59, 4, 8),
         (19, 22, 1, 2),
         (19, 22, 11),
         (19, 38, 21),
         (24, 14, 9),
         (19, 88, 13, 14),
         (19, 73, 28),
         (19, 65, 4),
         (19, 84, 10),
         (19, 119, 151),
         (19, 75, 1),
         (19, 73, 23, 24),
         (2, 20, 24),
         (18, 8, 7),
         (18, 23, 10),
         (18, 36, 7),
         (19, 1, 3),
         (19, 36, 7, 9),
         (19, 37, 34),
         (19, 71, 21),
         (19, 102, 13),
         (20, 4, 18),
         (23, 51, 16),
         (23, 60, 10),
         (23, 65, 16),
         (23, 66, 2),
         (43, 15, 4, 5),
         (51, 1, 27),
         (19, 51, 18),
         (13, 4, 10),
         (19, 125, 4),
         (19, 86, 17),
         (2, 33, 13),
         (19, 90, 17),
         (44, 26, 22),
         (10, 22, 37),
         (10, 23, 5),
         (18, 29, 5, 6),
         (19, 16, 6),
         (19, 5, 12),
         (19, 89, 17),
         (3, 26, 13),
         (14, 30, 9),
         (19, 18, 16, 18),
         (19, 31, 21),
         (19, 69, 33),
         (23, 57, 17, 19),
         (24, 3, 12),
         (24, 3, 22),
         (24, 31, 9),
         (26, 16, 59, 60),
         (26, 37, 23),
         (28, 14, 4),
         (38, 10, 6, 7),
         (26, 22, 15),
         (26, 36, 25, 27),
         (59, 5, 19, 20),
         (19, 86, 11),
         (19, 119, 132, 133),
         (19, 143, 10),
         (19, 51, 10),
         (40, 8, 2),
         (19, 141, 3, 4),
         (19, 69, 6),
         (19, 119, 17),
         (19, 119, 25),
         (19, 119, 33, 34),
         (19, 119, 77),
         (43, 17, 11),
         (43, 17, 13),
         (43, 17, 17),
         (43, 17, 20, 21),
         (43, 17, 23),
         (50, 1, 9, 11),
         (52, 3, 11, 13),
         (51, 1, 9, 12),
         (52, 5, 23),
         (19, 119, 29),
         (19, 139, 23, 24),
         (19, 19, 14),
         (19, 101, 3),
         (19, 101, 4),
         (19, 39, 1),
         (19, 101, 2),
         (19, 119, 11),
         (19, 51, 13),
         (14, 16, 9),
         (19, 55, 22),
         (19, 68, 35),
         (19, 80, 18),
         (19, 118, 14),
         (19, 138, 3),
         (23, 28, 5, 6),
         (24, 31, 25),
         (38, 4, 6),
         (38, 10, 12),
         (45, 8, 37),
         (45, 14, 4),
         (45, 16, 25),
         (47, 4, 7),
         (47, 12, 9),
         (50, 2, 12, 13),
         (51, 1, 29),
         (2, 31, 3),
         (55, 4, 17),
         (65, 1, 24),
         (5, 32, 36),
         (9, 14, 6),
         (10, 22, 18, 19),
         (19, 10, 14),
         (19, 103, 14),
         (23, 40, 28, 31),
         (19, 111, 6),
         (19, 61, 1, 2),
         (19, 86, 16),
         (19, 119, 28),
         (19, 51, 12),
         (19, 51, 15),
         (19, 119, 36, 37),
         (44, 4, 29, 30),
         (19, 119, 112),
         (19, 73, 25, 26),
         (47, 11, 30),
         (47, 12, 10),
         (50, 4, 13),
         (19, 59, 16),
         (19, 59, 17),
         (18, 12, 22),
         (19, 18, 28),
         (19, 107, 14),
         (19, 112, 4),
         (23, 58, 10),
         (42, 1, 78, 79),
         (43, 12, 46),
         (18, 8, 21),
         (18, 35, 10),
         (19, 16, 10, 11),
         (19, 19, 8),
         (19, 30, 5),
         (19, 30, 11),
         (19, 40, 3),
         (19, 65, 8),
         (19, 97, 11),
         (23, 61, 7),
         (24, 31, 12),
         (24, 31, 13, 14),
         (43, 15, 10, 11),
         (19, 13, 3),
         (35, 1, 2),
         (19, 10, 1),
         (19, 13, 1, 2),
         (19, 79, 11),
         (18, 7, 20, 21),
         (18, 10, 2, 3),
         (18, 10, 20),
         (18, 13, 20, 26),
         (18, 23, 3, 4),
         (18, 30, 20, 21),
         (4, 11, 11, 12),
         (4, 11, 14, 15),
         (23, 64, 11, 12),
         (24, 12, 1),
         (24, 15, 18),
         (18, 14, 13),
         (25, 3, 42, 45),
         (25, 5, 21),
         (35, 1, 13),
         (19, 42, 5),
         (19, 43, 4),
         (33, 7, 8, 9),
         (19, 35, 9, 10),
         (18, 23, 8, 10),
         (18, 13, 15),
         (19, 62, 5),
         (18, 36, 15, 16),
         (19, 9, 12),
         (19, 34, 18, 19),
         (23, 14, 32),
         (23, 30, 26),
         (23, 30, 29),
         (25, 3, 31, 33),
         (34, 1, 12),
         (43, 15, 2),
         (47, 4, 16, 17),
         (58, 12, 11),
         (59, 1, 12),
         (60, 5, 10),
         (19, 37, 39),
         (19, 46, 1, 2),
         (19, 66, 12),
         (43, 16, 33),
         (19, 84, 5, 7),
         (47, 1, 10),
         (19, 10, 12),
         (19, 6, 2),
         (19, 22, 11),
         (19, 22, 19),
         (19, 25, 17),
         (19, 31, 9),
         (19, 38, 9),
         (19, 39, 12),
         (19, 69, 29),
         (19, 88, 1, 3),
         (19, 88, 7, 8),
         (19, 88, 13, 14),
         (19, 90, 13, 15),
         (19, 119, 107),
         (19, 119, 153),
         (19, 143, 11),
         (23, 38, 14),
         (23, 38, 16, 17),
         (24, 20, 7, 8),
         (25, 3, 19),
         (25, 3, 55, 57),
         (19, 39, 4),
         (19, 116, 8),
         (19, 10, 17),
         (19, 77, 2),
         (19, 66, 11, 12),
         (18, 1, 21),
         (19, 62, 1, 2),
         (19, 119, 75),
         (19, 31, 7),
         (35, 3, 17, 18),
         (1, 15, 1),
         (12, 6, 16),
         (23, 25, 7, 8),
         (24, 46, 27, 28),
         (25, 3, 57),
         (38, 8, 13),
         (42, 1, 73, 74),
         (62, 4, 18, 19),
         (3, 26, 3),
         (3, 26, 5, 6),
         (19, 119, 165),
         (23, 26, 3),
         (23, 32, 17),
         (23, 60, 17),
         (25, 3, 17),
         (19, 119, 39),
         (23, 12, 2),
         (19, 29, 11),
         (23, 26, 12),
         (42, 2, 29),
         (58, 13, 20, 21),
         (61, 1, 2),
         (23, 53, 5),
         (19, 4, 8),
         (19, 3, 6),
         (19, 27, 1),
         (19, 57, 7),
         (19, 16, 8),
         (19, 118, 6),
         (19, 56, 3),
         (19, 56, 4),
         (19, 131, 2),
         (19, 23, 4),
         (23, 12, 2),
         (58, 13, 6),
         (20, 2, 1, 7),
         (20, 3, 16, 18),
         (20, 4, 8, 9),
         (20, 8, 15, 17),
         (20, 8, 34, 35),
         (20, 9, 10, 11),
         (20, 24, 3, 4),
         (20, 24, 5, 6),
         (21, 7, 12),
         (23, 50, 4),
         (24, 3, 15),
         (40, 10, 19, 20),
         (42, 21, 15),
         (51, 2, 3),
         (59, 1, 5),
         (11, 3, 9),
         (19, 90, 12),
         (19, 119, 66),
         (19, 119, 73),
         (19, 119, 144),
         (19, 119, 169),
         (19, 143, 8),
         (19, 49, 3),
         (18, 28, 28),
         (2, 15, 13),
         (5, 1, 33),
         (19, 32, 8),
         (19, 48, 14),
         (20, 3, 5, 6),
         (20, 16, 3),
         (20, 16, 9),
         (23, 42, 16),
         (23, 48, 17),
         (19, 119, 18),
         (40, 20, 33),
         (2, 33, 13),
         (19, 43, 3),
         (19, 5, 8),
         (24, 10, 24),
         (50, 1, 9, 10),
         (51, 1, 9),
         (19, 25, 4, 5),
         (19, 86, 11),
         (19, 119, 32),
         (19, 77, 19),
         (19, 57, 2),
         (44, 2, 28),
         (5, 2, 7),
         (11, 17, 14),
         (12, 3, 16, 18),
         (19, 23, 1, 3),
         (19, 81, 10),
         (23, 33, 15, 16),
         (19, 104, 27, 28),
         (40, 6, 33),
         (42, 12, 32),
         (50, 4, 19),
         (40, 6, 11),
         (20, 30, 8, 9),
         (54, 6, 8),
         (19, 16, 5, 6),
         (19, 68, 10),
         (50, 4, 19),
         (48, 3, 5),
         (5, 33, 12),
         (18, 11, 18, 19),
         (19, 3, 5),
         (19, 4, 8),
         (19, 9, 9),
         (19, 27, 5),
         (19, 54, 4),
         (19, 75, 3),
         (19, 91, 14),
         (19, 91, 9, 11),
         (19, 121, 7, 8),
         (19, 125, 2),
         (20, 18, 10),
         (23, 46, 3, 4),
         (19, 5, 11),
         (19, 119, 117),
         (43, 17, 15),
         (19, 141, 8),
         (19, 59, 9, 10),
         (19, 94, 22),
         (19, 62, 6),
         (24, 17, 17),
         (19, 73, 28),
         (19, 92, 15),
         (19, 91, 2),
         (2, 14, 14),
         (5, 1, 30, 31),
         (5, 20, 1),
         (5, 20, 4),
         (6, 10, 8),
         (6, 10, 25),
         (12, 17, 39),
         (14, 20, 17),
         (19, 55, 18),
         (19, 81, 13, 16),
         (23, 30, 30),
         (23, 30, 32),
         (23, 41, 11, 12),
         (23, 49, 25),
         (23, 54, 15),
         (23, 54, 17),
         (24, 50, 33, 34),
         (26, 34, 27),
         (33, 2, 13),
         (19, 108, 12),
         (29, 2, 17),
         (10, 15, 31),
         (11, 8, 44, 45),
         (14, 14, 11),
         (14, 20, 12),
         (19, 44, 24),
         (19, 44, 26),
         (19, 74, 4),
         (23, 63, 17, 19),
         (19, 17, 7, 9),
         (19, 25, 1, 2),
         (19, 27, 11, 12),
         (19, 31, 15),
         (19, 35, 1),
         (19, 35, 26),
         (19, 56, 1, 2),
         (19, 59, 1),
         (19, 64, 1),
         (19, 69, 18),
         (19, 70, 2),
         (19, 86, 17),
         (19, 89, 50, 51),
         (19, 94, 2, 3),
         (19, 109, 1),
         (19, 109, 4),
         (19, 140, 8),
         (19, 141, 9, 10),
         (19, 143, 9),
         (24, 18, 19, 20),
         (24, 20, 7, 8),
         (25, 5, 1),
         (19, 119, 84),
         (19, 119, 122),
         (19, 17, 1, 2),
         (19, 35, 24),
         (9, 17, 47),
         (19, 57, 3),
         (19, 25, 15),
         (19, 59, 10),
         (10, 22, 49),
         (55, 4, 18),
         (19, 56, 3, 4),
         (25, 3, 58, 59),
         (25, 3, 61),
         (19, 27, 3),
         (19, 31, 14, 15),
         (23, 12, 2),
         (33, 7, 8),
         (1, 3, 15),
         (23, 27, 1),
         (33, 5, 11, 12),
         (42, 10, 19),
         (43, 12, 31, 32),
         (51, 1, 13),
         (51, 2, 14, 15),
         (58, 2, 14, 15),
         (59, 4, 7),
         (60, 3, 22),
         (62, 3, 8),
         (62, 4, 4),
         (62, 5, 4),
         (62, 5, 18),
         (66, 12, 10, 11),
         (66, 17, 14),
         (16, 4, 4, 5),
         (16, 6, 14),
         (19, 9, 19, 20),
         (19, 59, 12),
         (19, 74, 23),
         (19, 82, 8),
         (19, 123, 3),
         (19, 74, 10, 11),
         (23, 26, 10, 11),
         (23, 37, 17),
         (23, 64, 1, 2),
         (24, 10, 25),
         (24, 15, 15),
         (24, 18, 23),
         (47, 10, 5),
         (19, 44, 5),
         (19, 143, 12),
         (1, 17, 7),
         (5, 4, 37),
         (19, 22, 31),
         (19, 102, 28),
         (23, 44, 3, 5),
         (23, 59, 21),
         (23, 61, 9),
         (23, 65, 23, 24),
         (24, 30, 10),
         (24, 31, 16, 17),
         (5, 4, 40),
         (5, 5, 29),
         (5, 12, 28),
         (5, 5, 16),
         (5, 11, 18, 21),
         (19, 112, 1, 2),
         (20, 20, 7),
         (1, 17, 18),
         (7, 13, 8),
         (7, 13, 12),
         (11, 17, 21),
         (9, 1, 11),
         (19, 90, 16, 17),
         (40, 15, 22),
         (40, 17, 15),
         (19, 72, 4),
         (25, 2, 19),
         (41, 5, 23),
         (27, 9, 9),
         (19, 130, 4),
         (19, 27, 13),
         (19, 31, 7),
         (19, 119, 55),
         (19, 33, 21),
         (19, 101, 2),
         (20, 14, 26),
         (19, 51, 13),
         (19, 89, 17),
         (18, 23, 14),
         (19, 16, 2),
         (19, 39, 7),
         (42, 1, 38),
         (19, 34, 10),
         (15, 8, 22),
         (14, 7, 14),
         (5, 4, 29),
         (20, 28, 5),
         (23, 45, 19),
         (20, 2, 3, 5),
         (28, 10, 12),
         (42, 6, 21),
         (43, 6, 35),
         (14, 15, 4),
         (28, 6, 1, 3),
         (23, 55, 6, 7),
         (19, 24, 3, 6),
         (19, 69, 32),
         (19, 34, 4),
         (19, 22, 26),
         (19, 40, 16),
         (19, 70, 4),
         (19, 105, 3),
         (30, 5, 4),
         (40, 7, 7),
         (40, 6, 33),
         (58, 11, 6),
         (19, 63, 1, 2),
         (19, 27, 8),
         (19, 119, 58),
         (19, 42, 1),
         (19, 119, 82),
         (19, 73, 25),
         (19, 143, 6),
         (19, 143, 7, 8),
         (23, 26, 8, 9),
         (19, 119, 131),
         (19, 84, 1, 2),
         (19, 27, 4),
         (19, 119, 10),
         (19, 25, 12, 14),
         (19, 31, 19, 20),
         (19, 33, 18),
         (19, 34, 7),
         (19, 60, 4),
         (19, 103, 13),
         (19, 103, 17),
         (19, 112, 1, 2),
         (19, 112, 1),
         (19, 112, 7, 8),
         (19, 115, 13),
         (19, 128, 1, 4),
         (19, 147, 11),
         (20, 14, 26, 27),
         (20, 19, 23),
         (23, 33, 6),
         (39, 4, 2),
         (24, 32, 38, 40),
         (16, 1, 11),
         (19, 86, 11),
         (19, 119, 74),
         (19, 5, 7),
         (19, 119, 63),
         (19, 119, 120),
         (18, 6, 14),
         (47, 5, 11),
         (19, 34, 9),
         (19, 25, 8, 9),
         (19, 51, 17),
         (19, 138, 6),
         (23, 57, 15),
         (23, 66, 2),
         (19, 146, 8),
         (40, 23, 12),
         (59, 4, 6),
         (59, 4, 10),
         (60, 5, 5, 7),
         (1, 18, 27),
         (18, 42, 5, 6),
         (19, 69, 5),
         (42, 5, 8),
         (19, 79, 8),
         (19, 142, 6),
         (40, 8, 8),
         (25, 3, 1),
         (19, 116, 6),
         (7, 6, 15),
         (46, 15, 9),
         (49, 3, 8),
         (54, 1, 15),
         (19, 40, 17),
         (9, 2, 7),
         (19, 51, 17),
         (50, 4, 12, 13),
         (5, 15, 10),
         (5, 23, 20),
         (5, 24, 19),
         (19, 37, 26),
         (19, 112, 5),
         (20, 19, 17),
         (20, 28, 27),
         (42, 6, 38),
         (42, 14, 12, 14),
         (47, 9, 6),
         (47, 9, 8),
         (47, 9, 10, 11),
         (5, 26, 10),
         (5, 26, 13),
         (13, 29, 14),
         (13, 29, 16),
         (13, 29, 12),
         (13, 21, 24),
         (9, 2, 7),
         (45, 11, 36),
         (5, 11, 8),
         (14, 16, 9),
         (18, 17, 9),
         (19, 50, 23),
         (19, 84, 11, 12),
         (20, 20, 7),
         (20, 21, 21),
         (21, 2, 25, 26),
         (23, 48, 18),
         (23, 64, 5),
         (24, 7, 23),
         (41, 10, 29, 30),
         (42, 12, 42, 44),
         (42, 19, 17),
         (43, 8, 31, 32),
         (43, 14, 23),
         (43, 14, 21),
         (44, 5, 32),
         (49, 6, 8),
         (50, 4, 9),
         (55, 2, 19, 21),
         (59, 1, 25),
         (60, 3, 12),
         (62, 2, 10),
         (62, 3, 21, 22),
         (66, 1, 3),
         (66, 3, 4, 5),
         (66, 14, 13),
         (66, 22, 7),
         (43, 8, 29),
         (2, 33, 13),
         (19, 119, 173),
         (19, 119, 17),
         (19, 119, 33, 34),
         (19, 119, 58),
         (19, 119, 132, 133),
         (19, 119, 135),
         (16, 1, 11),
         (19, 68, 28),
         (19, 71, 3),
         (19, 19, 14),
         (19, 86, 11),
         (19, 143, 10),
         (19, 119, 28),
         (19, 119, 36, 37),
         (19, 141, 3, 4),
         (19, 51, 10),
         (16, 5, 19),
         (16, 13, 14),
         (12, 20, 3),
         (19, 139, 23, 24),
         (19, 119, 80),
         (19, 119, 66),
         (19, 5, 8),
         (19, 43, 3),
         (19, 25, 4, 5),
         (19, 119, 80),
         (58, 13, 20, 21),
         (19, 119, 112),
         (19, 119, 16),
         (19, 39, 1),
         (19, 101, 5),
         (19, 101, 3),
         (19, 101, 6),
         (19, 56, 12),
         (19, 71, 16),
         (19, 119, 7),
         (19, 66, 16),
         (19, 68, 20),
         (23, 53, 12),
         (58, 2, 9),
         (23, 25, 8),
         (19, 109, 31),
         (42, 1, 78, 79),
         (43, 5, 24),
         (19, 23, 4),
         (58, 2, 14, 15),
         (19, 116, 15),
         (47, 5, 1),
         (45, 8, 38, 39),
         (46, 15, 55, 57),
         (46, 15, 21),
         (66, 20, 6),
         (55, 1, 9, 10),
         (66, 1, 17, 18),
         (66, 21, 4),
         (19, 9, 13),
         (19, 18, 4, 5),
         (19, 116, 3),
         (19, 30, 9),
         (19, 13, 3),
         (19, 55, 4),
         (19, 116, 8),
         (19, 118, 18),
         (44, 7, 59),
         (50, 1, 20),
         (21, 8, 8),
         (19, 89, 48),
         (19, 49, 15),
         (18, 19, 25, 27),
         (19, 17, 15),
         (44, 2, 27),
         (19, 56, 13),
         (47, 5, 1),
         (55, 4, 8),
         (61, 3, 13),
         (19, 73, 23, 24),
         (8, 1, 9),
         (1, 48, 15, 16),
         (19, 115, 14, 15),
         (19, 144, 12),
         (4, 6, 24, 26),
         (5, 33, 11),
         (5, 33, 25),
         (6, 1, 17),
         (8, 2, 12),
         (9, 24, 19),
         (10, 15, 20),
         (11, 8, 57, 58),
         (19, 20, 1),
         (19, 20, 4, 5),
         (19, 29, 11),
         (19, 129, 8),
         (19, 134, 3),
         (45, 15, 13),
         (45, 15, 33),
         (45, 16, 25, 27),
         (46, 16, 24),
         (47, 13, 14),
         (49, 6, 23, 24),
         (53, 2, 16, 17),
         (53, 3, 5),
         (53, 3, 16),
         (54, 1, 2),
         (56, 1, 4),
         (61, 1, 2),
         (63, 1, 3),
         (65, 1, 2),
         (58, 13, 20, 21),
         (43, 1, 2),
         (65, 1, 24, 25),
         (66, 1, 4, 5),
         (41, 9, 22, 24),
         (41, 9, 28, 29),
         (42, 8, 45),
         (42, 8, 46),
         (42, 8, 48),
         (41, 6, 5, 6),
         (42, 7, 12, 15),
         (41, 2, 4, 11),
         (40, 8, 2, 3),
         (40, 15, 22, 28),
         (45, 10, 17),
         (45, 8, 31, 32),
         (58, 11, 6),
         (45, 4, 19, 21),
         (58, 11, 26),
         (19, 9, 10),
         (10, 7, 21),
         (47, 6, 16, 7, 1),
         (61, 1, 3, 4),
         (49, 3, 6),
         (47, 1, 19, 20),
         (45, 4, 16),
         (48, 3, 16),
         (24, 33, 14, 16),
         (26, 12, 28),
         (44, 7, 17),
         (58, 6, 12),
         (58, 6, 15),
         (58, 10, 35, 36),
         (58, 11, 33),
         (1, 31, 3),
         (1, 32, 9),
         (1, 32, 12),
         (2, 32, 11, 13),
         (19, 77, 7, 10),
         (10, 7, 20, 21),
         (10, 7, 25),
         (10, 7, 28, 29),
         (27, 9, 2, 3),
         (16, 1, 8, 9),
         (19, 119, 49),
         (19, 119, 58),
         (19, 119, 38),
         (19, 119, 41),
         (19, 119, 76),
         (19, 119, 116),
         (19, 119, 132, 133),
         (19, 119, 154),
         (4, 14, 17),
         (16, 9, 8),
         (11, 8, 56),
         (24, 32, 24),
         (42, 1, 38),
     )
     verses = ""
     count = 0
     biblesSqlite = BiblesSqlite()
     bible = Bible(text)
     for verse in twwyVerses:
         if len(verse) == 3:
             b, c, v = verse
             verses += "({0})\t{1}\n".format(
                 biblesSqlite.bcvToVerseReference(b, c, v),
                 biblesSqlite.readTextVerse(text, b, c, v)[3].strip())
             count += 1
         elif len(verse) == 4:
             b, c, vs, ve = verse
             verses += "({0}-{1})\t".format(
                 biblesSqlite.bcvToVerseReference(b, c, vs), ve)
             v = vs
             while (v <= ve):
                 verses += biblesSqlite.readTextVerse(text, b, c,
                                                      v)[3].strip()
                 verses += " "
                 count += 1
                 v += 1
             verses += "\n"
         elif len(verse) == 5:
             b, cs, vs, ce, ve = verse
             verses += "({0}-{1}:{2})\t".format(
                 biblesSqlite.bcvToVerseReference(b, cs, vs), ce, ve)
             c = cs
             v = vs
             while (biblesSqlite.readTextVerse(text, b, c, v)[3].strip()):
                 verses += biblesSqlite.readTextVerse(text, b, c,
                                                      v)[3].strip()
                 verses += " "
                 count += 1
                 v += 1
             c = ce
             v = 1
             while (v <= ve):
                 verses += biblesSqlite.readTextVerse(text, b, c,
                                                      v)[3].strip()
                 verses += " "
                 count += 1
                 v += 1
             verses += "\n"
     verses += "\nTotal number of verses: {0}\n".format(count)
     return verses
예제 #8
0
    def setupUI(self):
        textButtonStyle = "QPushButton {background-color: #151B54; color: white;} QPushButton:hover {background-color: #333972;} QPushButton:pressed { background-color: #515790;}"

        mainLayout = QGridLayout()

        commandBox = QVBoxLayout()
        commandBox.setSpacing(3)

        commandBar = QWidget()
        commandLayout1 = QBoxLayout(QBoxLayout.LeftToRight)
        commandLayout1.setSpacing(5)
        self.searchLineEdit = QLineEdit()
        self.searchLineEdit.setClearButtonEnabled(True)
        self.searchLineEdit.setToolTip(
            config.thisTranslation["enter_command_here"])
        self.searchLineEdit.returnPressed.connect(self.searchLineEntered)
        self.searchLineEdit.setFixedWidth(450)
        commandLayout1.addWidget(self.searchLineEdit)

        enterButton = QPushButton(config.thisTranslation["enter"])
        enterButton.setFixedWidth(100)
        enterButton.clicked.connect(self.searchLineEntered)
        commandLayout1.addWidget(enterButton)

        # commandLayout1.addStretch()
        commandBox.addLayout(commandLayout1)

        if config.showMiniKeyboardInMiniControl:
            commandLayout2 = QBoxLayout(QBoxLayout.LeftToRight)
            commandLayout2.setSpacing(5)

            keys = [
                '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', ':', '-',
                ',', '.', ' ', '<', 'X'
            ]
            for key in keys:
                button = QPushButton(key)
                button.setMaximumWidth(30)
                button.clicked.connect(partial(self.keyEntryAction, key))
                commandLayout2.addWidget(button)

            commandLayout2.addStretch()
            commandBox.addLayout(commandLayout2)

        if config.showMiniKeyboardInMiniControl and config.isTtsInstalled:
            ttsLayout = QBoxLayout(QBoxLayout.LeftToRight)
            ttsLayout.setSpacing(5)

            self.languageCombo = QComboBox()
            ttsLayout.addWidget(self.languageCombo)
            if config.espeak:
                languages = TtsLanguages().isoLang2epeakLang
            else:
                languages = TtsLanguages().isoLang2qlocaleLang
            self.languageCodes = list(languages.keys())
            for code in self.languageCodes:
                self.languageCombo.addItem(languages[code][1])
            # Check if selected tts engine has the language user specify.
            if not (config.ttsDefaultLangauge in self.languageCodes):
                config.ttsDefaultLangauge = "en"
            # Set initial item
            initialIndex = self.languageCodes.index(config.ttsDefaultLangauge)
            self.languageCombo.setCurrentIndex(initialIndex)

            # setting tts default language here is confusing; better place in menu
            #setDefaultButton = QPushButton(config.thisTranslation["setDefault"])
            #setDefaultButton.setFixedWidth(130)
            #setDefaultButton.clicked.connect(self.setTtsDefaultLanguage)
            #ttsLayout.addWidget(setDefaultButton)

            speakButton = QPushButton(config.thisTranslation["speak"])
            speakButton.setFixedWidth(100)
            speakButton.clicked.connect(self.speakCommandFieldText)
            ttsLayout.addWidget(speakButton)

            stopButton = QPushButton(config.thisTranslation["stop"])
            stopButton.setFixedWidth(100)
            stopButton.clicked.connect(
                self.parent.textCommandParser.stopTtsAudio)
            ttsLayout.addWidget(stopButton)

            ttsLayout.addStretch()

            commandBox.addLayout(ttsLayout)

        commandBar.setLayout(commandBox)
        mainLayout.addWidget(commandBar, 0, 0, Qt.AlignCenter)

        self.tabs = QTabWidget()
        self.tabs.currentChanged.connect(self.tabChanged)
        mainLayout.addWidget(self.tabs, 1, 0, Qt.AlignCenter)

        parser = BibleVerseParser(config.parserStandarisation)
        self.bookMap = parser.standardAbbreviation
        bookNums = list(self.bookMap.keys())
        self.bookNumGps = [
            bookNums[0:10],
            bookNums[10:20],
            bookNums[20:30],
            bookNums[30:39],
            bookNums[39:49],
            bookNums[49:59],
            bookNums[59:69],
            bookNums[69:79],
            bookNums[79:86],
            bookNums[86:94],
            bookNums[94:99],
            bookNums[99:104],
            bookNums[104:110],
            bookNums[110:119],
            bookNums[119:124],
            bookNums[124:129],
            bookNums[129:139],
            bookNums[139:149],
            bookNums[149:159],
            bookNums[159:169],
            bookNums[169:174],
            bookNums[174:179],
            bookNums[179:189],
            bookNums[189:199],
        ]

        # Bible books tab

        self.bible = QWidget()
        self.populateBooksButtons(config.mainText)
        self.tabs.addTab(self.bible, config.thisTranslation["bible"])

        # Bible translations tab

        self.biblesBox = QWidget()
        self.biblesBoxContainer = QVBoxLayout()
        collectionsLayout = self.newRowLayout()
        if len(config.bibleCollections) > 0:
            button = QPushButton("All")
            button.setStyleSheet(textButtonStyle)
            button.clicked.connect(partial(self.selectCollection, "All"))
            collectionsLayout.addWidget(button)
            count = 0
            for collection in sorted(config.bibleCollections.keys()):
                button = QPushButton(collection)
                button.setStyleSheet(textButtonStyle)
                button.clicked.connect(
                    partial(self.selectCollection, collection))
                collectionsLayout.addWidget(button)
                count += 1
                if count > 5:
                    count = 0
                    self.biblesBoxContainer.addLayout(collectionsLayout)
                    collectionsLayout = self.newRowLayout()

        self.biblesBoxContainer.addLayout(collectionsLayout)
        self.bibleBoxWidget = QWidget()
        self.bibleBoxLayout = QVBoxLayout()
        self.bibleBoxLayout.setContentsMargins(0, 0, 0, 0)
        self.bibleBoxLayout.setSpacing(1)
        row_layout = self.newRowLayout()
        row_layout.setContentsMargins(0, 0, 0, 0)
        row_layout.setSpacing(1)
        biblesSqlite = BiblesSqlite()
        bibles = biblesSqlite.getBibleList()
        count = 0
        for bible in bibles:
            button = QPushButton(bible)
            if bible in config.bibleDescription:
                button.setToolTip("{0}".format(config.bibleDescription[bible]))
            button.clicked.connect(partial(self.bibleAction, bible))
            row_layout.addWidget(button)
            count += 1
            if count > 6:
                count = 0
                self.bibleBoxLayout.addLayout(row_layout)
                row_layout = self.newRowLayout()
            self.bibleButtons[bible] = button
        self.bibleBoxLayout.addLayout(row_layout)
        self.bibleBoxLayout.addStretch()
        self.biblesBoxContainer.addLayout(self.bibleBoxLayout)
        self.biblesBoxContainer.addStretch()
        self.biblesBox.setLayout(self.biblesBoxContainer)
        self.tabs.addTab(self.biblesBox,
                         config.thisTranslation["translations"])

        # Commentaries tab

        commentaries_box = QWidget()
        box_layout = QVBoxLayout()
        box_layout.setContentsMargins(0, 0, 0, 0)
        box_layout.setSpacing(1)
        row_layout = self.newRowLayout()
        button = QPushButton(config.thisTranslation["activeOnly"])
        button.setStyleSheet(textButtonStyle)
        button.clicked.connect(self.activeCommentaries)
        row_layout.addWidget(button)
        box_layout.addLayout(row_layout)
        row_layout = self.newRowLayout()
        commentaries = Commentary().getCommentaryList()
        count = 0
        for commentary in commentaries:
            button = QPushButton(commentary)
            button.setToolTip(Commentary.fileLookup[commentary])
            button.clicked.connect(partial(self.commentaryAction, commentary))
            self.commentaryButtons[commentary] = button
            row_layout.addWidget(button)
            count += 1
            if count > 6:
                count = 0
                box_layout.addLayout(row_layout)
                row_layout = self.newRowLayout()
        box_layout.addLayout(row_layout)
        box_layout.addStretch()
        commentaries_box.setLayout(box_layout)

        self.tabs.addTab(commentaries_box,
                         config.thisTranslation["commentaries"])

        # Lexicons tab

        lexicons_box = QWidget()
        box_layout = QVBoxLayout()
        box_layout.setContentsMargins(0, 0, 0, 0)
        box_layout.setSpacing(1)
        row_layout = self.newRowLayout()
        lexicons = LexiconData().lexiconList
        count = 0
        for lexicon in lexicons:
            button = QPushButton(lexicon)
            if lexicon in config.lexiconDescription:
                button.setToolTip("{0}".format(
                    config.lexiconDescription[lexicon]))
            button.clicked.connect(partial(self.lexiconAction, lexicon))
            row_layout.addWidget(button)
            count += 1
            if count > 6:
                count = 0
                box_layout.addLayout(row_layout)
                row_layout = self.newRowLayout()
        box_layout.addLayout(row_layout)
        box_layout.addStretch()
        lexicons_box.setLayout(box_layout)

        self.tabs.addTab(lexicons_box, config.thisTranslation["lexicons"])

        # Dictionaries tab

        dictionaries_box = QWidget()
        box_layout = QVBoxLayout()
        box_layout.setContentsMargins(0, 0, 0, 0)
        box_layout.setSpacing(1)
        row_layout = self.newRowLayout()
        dictionaries = IndexesSqlite().dictionaryList
        count = 0
        for dictionary in dictionaries:
            button = QPushButton(dictionary[0])
            button.setToolTip(dictionary[1])
            button.clicked.connect(
                partial(self.dictionaryAction, dictionary[0]))
            row_layout.addWidget(button)
            count += 1
            if count > 6:
                count = 0
                box_layout.addLayout(row_layout)
                row_layout = self.newRowLayout()
        box_layout.addLayout(row_layout)
        box_layout.addStretch()
        dictionaries_box.setLayout(box_layout)

        self.tabs.addTab(dictionaries_box,
                         config.thisTranslation["dictionaries"])

        # Book intros tab

        bookIntros_box = QWidget()
        box_layout = QVBoxLayout()
        box_layout.setContentsMargins(0, 0, 0, 0)
        box_layout.setSpacing(1)
        row_layout = self.newRowLayout()
        button = QPushButton(config.thisTranslation["activeOnly"])
        button.setStyleSheet(textButtonStyle)
        button.clicked.connect(self.activeBookIntros)
        row_layout.addWidget(button)
        box_layout.addLayout(row_layout)
        row_layout = self.newRowLayout()
        commentaries = Commentary().getCommentaryList()
        count = 0
        for commentary in commentaries:
            button = QPushButton(commentary)
            button.setToolTip(Commentary.fileLookup[commentary])
            button.clicked.connect(partial(self.bookIntroAction, commentary))
            self.bookIntroButtons[commentary] = button
            row_layout.addWidget(button)
            count += 1
            if count > 6:
                count = 0
                box_layout.addLayout(row_layout)
                row_layout = self.newRowLayout()
        box_layout.addLayout(row_layout)
        box_layout.addStretch()
        bookIntros_box.setLayout(box_layout)

        self.tabs.addTab(bookIntros_box, config.thisTranslation["bookIntro"])

        # Devotionals tab

        if len(self.devotionals) > 0:
            devotionals_box = QWidget()
            box_layout = QVBoxLayout()
            box_layout.setContentsMargins(0, 0, 0, 0)
            box_layout.setSpacing(1)
            row_layout = self.newRowLayout()
            count = 0
            for file in self.devotionals:
                name = Path(file).stem
                button = QPushButton(name)
                # button.setToolTip(dictionary[1])
                button.clicked.connect(partial(self.devotionalAction, name))
                row_layout.addWidget(button)
                count += 1
                if count > 2:
                    count = 0
                    box_layout.addLayout(row_layout)
                    row_layout.addStretch()
                    row_layout = self.newRowLayout()
            for i in range(count, 3):
                button = QPushButton("")
                row_layout.addWidget(button)
            box_layout.addLayout(row_layout)
            box_layout.addStretch()
            devotionals_box.setLayout(box_layout)

            self.tabs.addTab(devotionals_box,
                             config.thisTranslation["devotionals"])

        self.tabs.setCurrentIndex(config.miniControlInitialTab)
        self.setLayout(mainLayout)
예제 #9
0
 def setupResourceLists(self):
     # bible versions
     self.textList = BiblesSqlite().getBibleList()
     if not config.enableHttpServer and self.textList and not config.mainText in self.textList:
         config.mainText = "KJV" if "KJV" in self.textList else self.textList[
             0]
     self.textFullNameList = [
         Bible(text).bibleInfo() for text in self.textList
     ]
     bibleOHGBiPath = os.path.join(config.marvelData, "bibles",
                                   "OHGBi.bible")
     morphologyDatabase = os.path.join(config.marvelData,
                                       "morphology.sqlite")
     self.strongBibles = ["OHGBi"] if os.path.isfile(
         bibleOHGBiPath) and os.path.isfile(morphologyDatabase) else []
     self.strongBibles += [
         text for text in self.textList if Bible(text).bibleStrong()
     ]
     #if self.versionCombo is not None and config.menuLayout in ("focus", "Starter"):
     #    for index, fullName in enumerate(self.textFullNameList):
     #        self.versionCombo.setItemData(index, fullName, Qt.ToolTipRole)
     # commentaries
     self.commentaryList = Commentary().getCommentaryList()
     if self.commentaryList and not config.commentaryText in self.commentaryList:
         config.commentaryText = "CBSC" if "CBSC" in self.commentaryList else self.commentaryList[
             0]
     #self.commentaryFullNameList = [Commentary(module).commentaryInfo() for module in self.commentaryList]
     self.commentaryFullNameList = []
     for module in self.commentaryList:
         info = Commentary(module).commentaryInfo()
         if info == "https://Marvel.Bible Commentary" and module in Commentary.marvelCommentaries:
             info = Commentary.marvelCommentaries[module]
         self.commentaryFullNameList.append(info)
     # reference book
     # menu10_dialog
     bookData = BookData()
     self.referenceBookList = [book for book, *_ in bookData.getBookList()]
     # open database
     indexes = IndexesSqlite()
     # topic
     # menu5_topics
     topicDictAbb2Name = {abb: name for abb, name in indexes.topicList}
     self.topicListAbb = list(topicDictAbb2Name.keys())
     topicDict = {name: abb for abb, name in indexes.topicList}
     self.topicList = list(topicDict.keys())
     # lexicon
     # context1_originalLexicon
     self.lexiconList = LexiconData().lexiconList
     # dictionary
     # context1_dict
     dictionaryDictAbb2Name = {
         abb: name
         for abb, name in indexes.dictionaryList
     }
     self.dictionaryListAbb = list(dictionaryDictAbb2Name.keys())
     dictionaryDict = {name: abb for abb, name in indexes.dictionaryList}
     self.dictionaryList = list(dictionaryDict.keys())
     # encyclopedia
     # context1_encyclopedia
     encyclopediaDictAbb2Name = {
         abb: name
         for abb, name in indexes.encyclopediaList
     }
     self.encyclopediaListAbb = list(encyclopediaDictAbb2Name.keys())
     encyclopediaDict = {
         name: abb
         for abb, name in indexes.encyclopediaList
     }
     self.encyclopediaList = list(encyclopediaDict.keys())
     # 3rd-party dictionary
     # menu5_3rdDict
     self.thirdPartyDictionaryList = ThirdPartyDictionary(
         self.isThridPartyDictionary(config.thirdDictionary)).moduleList
     # pdf list
     # self.pdfList = sorted([os.path.basename(file) for file in glob.glob(r"{0}/pdf/*.pdf".format(config.marvelData))])
     self.pdfList = CatalogUtil.getPDFs()
     # epub list
     self.epubList = sorted([
         os.path.basename(file)
         for file in glob.glob(r"{0}/epub/*.epub".format(config.marvelData))
     ])
     # docx list
     self.docxList = sorted([
         os.path.basename(file)
         for file in glob.glob(r"{0}/docx/*.docx".format(config.marvelData))
     ])
예제 #10
0
    def getMenu(command, source="main"):
        biblesSqlite = BiblesSqlite()
        parser = BibleVerseParser(config.parserStandarisation)
        items = command.split(".", 3)
        text = items[0]
        versions = biblesSqlite.getBibleList()
        # provide a link to go back the last opened bible verse
        if source == "study":
            mainVerseReference = parser.bcvToVerseReference(
                config.studyB, config.studyC, config.studyV)
            menu = "<ref onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>&lt;&lt;&lt; {0} - {1}</ref>".format(
                config.studyText, mainVerseReference)
        else:
            mainVerseReference = parser.bcvToVerseReference(
                config.mainB, config.mainC, config.mainV)
            menu = "<ref onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>&lt;&lt;&lt; {0} - {1}</ref>".format(
                config.mainText, mainVerseReference)
        # select bible versions
        menu += "<hr><b>{1}</b> {0}".format(
            biblesSqlite.getTexts(), config.thisTranslation["html_bibles"])
        if text:
            # i.e. text specified; add book menu
            if config.openBibleInMainViewOnly or config.enableHttpServer:
                menu += "<br><br><b>{2}</b> <span style='color: brown;' onmouseover='textName(\"{0}\")'>{0}</span> <button class='feature' onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>{3}</button>".format(
                    text, mainVerseReference,
                    config.thisTranslation["html_current"],
                    config.thisTranslation["html_open"])
            else:
                if source == "study":
                    anotherView = "<button class='feature' onclick='document.title=\"MAIN:::{0}:::{1}\"'>{2}</button>".format(
                        text, mainVerseReference,
                        config.thisTranslation["html_openMain"])
                else:
                    anotherView = "<button class='feature' onclick='document.title=\"STUDY:::{0}:::{1}\"'>{2}</button>".format(
                        text, mainVerseReference,
                        config.thisTranslation["html_openStudy"])
                menu += "<br><br><b>{2}</b> <span style='color: brown;' onmouseover='textName(\"{0}\")'>{0}</span> <button class='feature' onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>{3}</button> {4}".format(
                    text, mainVerseReference,
                    config.thisTranslation["html_current"],
                    config.thisTranslation["html_openHere"], anotherView)
            menu += "<hr><b>{1}</b> {0}".format(
                biblesSqlite.getBooks(text),
                config.thisTranslation["html_book"])
            # create a list of inters b, c, v
            bcList = [int(i) for i in items[1:]]
            if bcList:
                check = len(bcList)
                bookNo = bcList[0]
                engFullBookName = BibleBooks().eng[str(bookNo)][-1]
                engFullBookNameWithoutNumber = engFullBookName
                matches = re.match("^[0-9]+? (.*?)$", engFullBookName)
                if matches:
                    engFullBookNameWithoutNumber = matches.group(1)
                # Book specific buttons
                if check >= 1:
                    # i.e. book specified; add chapter menu
                    bookReference = parser.bcvToVerseReference(bookNo, 1, 1)
                    bookAbb = bookReference[:-4]
                    # build open book button
                    if config.openBibleInMainViewOnly or config.enableHttpServer:
                        openOption = "<button class='feature' onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>{2}</button>".format(
                            text, bookReference,
                            config.thisTranslation["html_open"])
                    else:
                        if source == "study":
                            anotherView = "<button class='feature' onclick='document.title=\"MAIN:::{0}:::{1}\"'>{2}</button>".format(
                                text, bookReference,
                                config.thisTranslation["html_openMain"])
                        else:
                            anotherView = "<button class='feature' onclick='document.title=\"STUDY:::{0}:::{1}\"'>{2}</button>".format(
                                text, bookReference,
                                config.thisTranslation["html_openStudy"])
                        openOption = "<button class='feature' onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>{3}</button> {2}".format(
                            text, bookReference, anotherView,
                            config.thisTranslation["html_openHere"])
                    # build search book by book introduction button
                    introductionButton = "<button class='feature' onclick='document.title=\"SEARCHBOOKCHAPTER:::Tidwell_The_Bible_Book_by_Book:::{0}\"'>{1}</button>".format(
                        engFullBookName,
                        config.thisTranslation["html_introduction"])
                    # build search timelines button
                    timelinesButton = "<button class='feature' onclick='document.title=\"SEARCHBOOKCHAPTER:::Timelines:::{0}\"'>{1}</button>".format(
                        engFullBookName,
                        config.thisTranslation["html_timelines"])
                    # build search encyclopedia button
                    encyclopediaButton = "<button class='feature' onclick='document.title=\"SEARCHTOOL:::{0}:::{1}\"'>{2}</button>".format(
                        config.encyclopedia, engFullBookNameWithoutNumber,
                        config.thisTranslation["context1_encyclopedia"])
                    # build search dictionary button
                    dictionaryButton = "<button class='feature' onclick='document.title=\"SEARCHTOOL:::{0}:::{1}\"'>{2}</button>".format(
                        config.dictionary, engFullBookNameWithoutNumber,
                        config.thisTranslation["context1_dict"])
                    # display selected book
                    menu += "<br><br><b>{2}</b> <span style='color: brown;' onmouseover='bookName(\"{0}\")'>{0}</span> {1}<br>{3} {4} {5} {6}".format(
                        bookAbb, openOption,
                        config.thisTranslation["html_current"],
                        introductionButton, timelinesButton, dictionaryButton,
                        encyclopediaButton)
                    # display book commentaries
                    menu += "<br><br><b>{1}:</b> <span style='color: brown;' onmouseover='bookName(\"{0}\")'>{0}</span>".format(
                        bookAbb, config.thisTranslation["commentaries"])
                    list = Commentary().getCommentaryListThatHasBookAndChapter(
                        bookNo, 0)
                    for commentary in list:
                        button = " <button class='feature' onmouseover='instantInfo(\"{2}\")' onclick='document.title=\"COMMENTARY:::{0}:::{1}\"'>{0}</button>".format(
                            commentary[0], engFullBookName, commentary[1])
                        menu += button
                    # Chapter specific buttons
                    # add chapter menu
                    menu += "<hr><b>{1}</b> {0}".format(
                        biblesSqlite.getChapters(bookNo, text),
                        config.thisTranslation["html_chapter"])
                if check >= 2:
                    chapterNo = bcList[1]
                    # i.e. both book and chapter specified; add verse menu
                    chapterReference = parser.bcvToVerseReference(
                        bookNo, chapterNo, 1)
                    # build open chapter button
                    if config.openBibleInMainViewOnly or config.enableHttpServer:
                        openOption = "<button class='feature' onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>{2}</button>".format(
                            text, chapterReference,
                            config.thisTranslation["html_open"])
                    else:
                        if source == "study":
                            anotherView = "<button class='feature' onclick='document.title=\"MAIN:::{0}:::{1}\"'>{2}</button>".format(
                                text, chapterReference,
                                config.thisTranslation["html_openMain"])
                        else:
                            anotherView = "<button class='feature' onclick='document.title=\"STUDY:::{0}:::{1}\"'>{2}</button>".format(
                                text, chapterReference,
                                config.thisTranslation["html_openStudy"])
                        openOption = "<button class='feature' onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>{3}</button> {2}".format(
                            text, chapterReference, anotherView,
                            config.thisTranslation["html_openHere"])
                    # overview button
                    overviewButton = "<button class='feature' onclick='document.title=\"OVERVIEW:::{0} {1}\"'>{2}</button>".format(
                        bookAbb, chapterNo,
                        config.thisTranslation["html_overview"])
                    # chapter index button
                    chapterIndexButton = "<button class='feature' onclick='document.title=\"CHAPTERINDEX:::{0} {1}\"'>{2}</button>".format(
                        bookAbb, chapterNo,
                        config.thisTranslation["html_chapterIndex"])
                    # summary button
                    summaryButton = "<button class='feature' onclick='document.title=\"SUMMARY:::{0} {1}\"'>{2}</button>".format(
                        bookAbb, chapterNo,
                        config.thisTranslation["html_summary"])
                    # chapter commentary button
                    # chapterCommentaryButton = "<button class='feature' onclick='document.title=\"COMMENTARY:::{0} {1}\"'>{2}</button>".format(bookAbb, chapterNo, config.thisTranslation["menu4_commentary"])
                    # chapter note button
                    chapterNoteButton = " <button class='feature' onclick='document.title=\"_openchapternote:::{0}.{1}\"'>{2}</button>".format(
                        bookNo, chapterNo,
                        config.thisTranslation["menu6_notes"])
                    # selected chapter
                    menu += "<br><br><b>{3}</b> <span style='color: brown;' onmouseover='document.title=\"_info:::Chapter {1}\"'>{1}</span> {2}{4}<br>{5} {6} {7}".format(
                        bookNo, chapterNo, openOption,
                        config.thisTranslation["html_current"],
                        "" if config.enableHttpServer else chapterNoteButton,
                        overviewButton, chapterIndexButton, summaryButton)

                    # display chapter commentaries
                    menu += "<br><br><b>{1}:</b> <span style='color: brown;' onmouseover='instantInfo(\"Chapter {0}\")'>{0}</span>".format(
                        chapterNo, config.thisTranslation["commentaries"])
                    list = Commentary().getCommentaryListThatHasBookAndChapter(
                        bookNo, config.mainC)
                    for commentary in list:
                        button = " <button class='feature' onmouseover='instantInfo(\"{2}\")' onclick='document.title=\"COMMENTARY:::{0}:::{1} {3}\"'>{0}</button>".format(
                            commentary[0], engFullBookName, commentary[1],
                            config.mainC)
                        menu += button

                    # building verse list of slected chapter
                    menu += "<hr><b>{1}</b> {0}".format(
                        biblesSqlite.getVersesMenu(bookNo, chapterNo, text),
                        config.thisTranslation["html_verse"])
                # Verse specific buttons
                if check == 3:
                    verseNo = bcList[2]
                    if config.openBibleInMainViewOnly or config.enableHttpServer:
                        openOption = "<button class='feature' onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>{2}</button>".format(
                            text, mainVerseReference,
                            config.thisTranslation["html_open"])
                    else:
                        if source == "study":
                            anotherView = "<button class='feature' onclick='document.title=\"MAIN:::{0}:::{1}\"'>{2}</button>".format(
                                text, mainVerseReference,
                                config.thisTranslation["html_openMain"])
                        else:
                            anotherView = "<button class='feature' onclick='document.title=\"STUDY:::{0}:::{1}\"'>{2}</button>".format(
                                text, mainVerseReference,
                                config.thisTranslation["html_openStudy"])
                        openOption = "<button class='feature' onclick='document.title=\"_stayOnSameTab:::\"; document.title=\"BIBLE:::{0}:::{1}\"'>{3}</button> {2}".format(
                            text, mainVerseReference, anotherView,
                            config.thisTranslation["html_openHere"])
                    verseNoteButton = " <button class='feature' onclick='document.title=\"_openversenote:::{0}.{1}.{2}\"'>{3}</button>".format(
                        bookNo, chapterNo, verseNo,
                        config.thisTranslation["menu6_notes"])
                    menu += "<br><br><b>{5}</b> <span style='color: brown;' onmouseover='document.title=\"_instantVerse:::{0}:::{1}.{2}.{3}\"'>{3}</span> {4}{6}".format(
                        text, bookNo, chapterNo, verseNo, openOption,
                        config.thisTranslation["html_current"],
                        "" if config.enableHttpServer else verseNoteButton)
                    #menu += "<hr><b>{0}</b> ".format(config.thisTranslation["html_features"])
                    menu += "<br>"
                    features = (
                        ("COMPARE",
                         config.thisTranslation["menu4_compareAll"]),
                        ("CROSSREFERENCE",
                         config.thisTranslation["menu4_crossRef"]),
                        ("TSKE", config.thisTranslation["menu4_tske"]),
                        ("TRANSLATION",
                         config.thisTranslation["menu4_traslations"]),
                        ("DISCOURSE",
                         config.thisTranslation["menu4_discourse"]),
                        ("WORDS", config.thisTranslation["menu4_words"]),
                        ("COMBO", config.thisTranslation["menu4_tdw"]),
                        ("COMMENTARY",
                         config.thisTranslation["menu4_commentary"]),
                        ("INDEX", config.thisTranslation["menu4_indexes"]),
                    )
                    for keyword, description in features:
                        menu += "<button class='feature' onclick='document.title=\"{0}:::{1}\"'>{2}</button> ".format(
                            keyword, mainVerseReference, description)
                    #versions = biblesSqlite.getBibleList()
                    # Compare menu
                    menu += "<hr><b><span style='color: brown;' onmouseover='textName(\"{0}\")'>{0}</span> {1}</b><br>".format(
                        text, config.thisTranslation["html_and"])
                    for version in versions:
                        if not version == text:
                            menu += "<div style='display: inline-block' onmouseover='textName(\"{0}\")'>{0} <input type='checkbox' id='compare{0}'></div> ".format(
                                version)
                            menu += "<script>versionList.push('{0}');</script>".format(
                                version)
                    menu += "<br><button type='button' onclick='checkCompare();' class='feature'>{0}</button>".format(
                        config.thisTranslation["html_showCompare"])
                    # Parallel menu
                    menu += "<hr><b><span style='color: brown;' onmouseover='textName(\"{0}\")'>{0}</span> {1}</b><br>".format(
                        text, config.thisTranslation["html_and"])
                    for version in versions:
                        if not version == text:
                            menu += "<div style='display: inline-block' onmouseover='textName(\"{0}\")'>{0} <input type='checkbox' id='parallel{0}'></div> ".format(
                                version)
                    menu += "<br><button type='button' onclick='checkParallel();' class='feature'>{0}</button>".format(
                        config.thisTranslation["html_showParallel"])
                    # Diff menu
                    menu += "<hr><b><span style='color: brown;' onmouseover='textName(\"{0}\")'>{0}</span> {1}</b><br>".format(
                        text, config.thisTranslation["html_and"])
                    for version in versions:
                        if not version == text:
                            menu += "<div style='display: inline-block' onmouseover='textName(\"{0}\")'>{0} <input type='checkbox' id='diff{0}'></div> ".format(
                                version)
                    menu += "<br><button type='button' onclick='checkDiff();' class='feature'>{0}</button>".format(
                        config.thisTranslation["html_showDifference"])
        else:
            # menu - Search a bible
            if source == "study":
                defaultSearchText = config.studyText
            else:
                defaultSearchText = config.mainText
            menu += "<hr><b>{1}</b> <span style='color: brown;' onmouseover='textName(\"{0}\")'>{0}</span>".format(
                defaultSearchText, config.thisTranslation["html_searchBible2"])
            menu += "<br><br><input type='text' id='bibleSearch' style='width:95%' autofocus><br><br>"
            searchOptions = ("SEARCH", "SEARCHREFERENCE", "SEARCHOT",
                             "SEARCHNT", "SEARCHALL", "ANDSEARCH", "ORSEARCH",
                             "ADVANCEDSEARCH", "REGEXSEARCH")
            for searchMode in searchOptions:
                menu += "<button  id='{0}' type='button' onclick='checkSearch(\"{0}\", \"{1}\");' class='feature'>{0}</button> ".format(
                    searchMode, defaultSearchText)
            # menu - Search multiple bibles
            menu += "<hr><b>{0}</b> ".format(
                config.thisTranslation["html_searchBibles2"])
            for version in versions:
                if version == defaultSearchText or version == config.favouriteBible:
                    menu += "<div style='display: inline-block' onmouseover='textName(\"{0}\")'>{0} <input type='checkbox' id='search{0}' checked></div> ".format(
                        version)
                else:
                    menu += "<div style='display: inline-block' onmouseover='textName(\"{0}\")'>{0} <input type='checkbox' id='search{0}'></div> ".format(
                        version)
                menu += "<script>versionList.push('{0}');</script>".format(
                    version)
            menu += "<br><br><input type='text' id='multiBibleSearch' style='width:95%'><br><br>"
            for searchMode in searchOptions:
                menu += "<button id='multi{0}' type='button' onclick='checkMultiSearch(\"{0}\");' class='feature'>{0}</button> ".format(
                    searchMode)
            # Perform search when "ENTER" key is pressed
            menu += biblesSqlite.inputEntered("bibleSearch", "SEARCH")
            menu += biblesSqlite.inputEntered("multiBibleSearch",
                                              "multiSEARCH")
        return menu
예제 #11
0
class BibleExplorer(QWidget):
    def __init__(self, parent, bcvTextTuple):
        super().__init__()

        self.parent = parent
        self.b, self.c, self.v, self.text = bcvTextTuple
        self.bcvChain = False
        self.biblesSqlite = BiblesSqlite()
        bibleVerseParser = BibleVerseParser(config.parserStandarisation)
        self.bookNo2Abb = bibleVerseParser.standardAbbreviation
        self.bookNo2Name = bibleVerseParser.standardFullBookName
        self.bookLabel = QLabel("")
        self.chapterLabel = QLabel("")
        self.verseLabel = QLabel("")

        # set title
        self.setWindowTitle(config.thisTranslation["menu_bible"])
        # setup interface
        self.setupUI()

    # setup ui
    def setupUI(self):
        mainLayout = QHBoxLayout()
        mainLayout.addWidget(self.navigationWidget())
        mainLayout.addWidget(self.featuresWidget())
        self.setLayout(mainLayout)

    def navigationWidget(self):
        navigation = QWidget()

        navigationLayouts = QVBoxLayout()
        navigationLayouts.setSpacing(10)

        navigationLayoutsSub1 = QVBoxLayout()
        navigationLayoutsSub1.setSpacing(3)
        navigationLayout1 = self.navigationLayout1()
        navigationLayoutsSub1.addLayout(navigationLayout1)
        navigationLayout2 = self.navigationLayout2()
        navigationLayoutsSub1.addLayout(navigationLayout2)
        navigationLayouts.addLayout(navigationLayoutsSub1)

        navigationLayout3 = self.navigationLayout3()
        navigationLayouts.addLayout(navigationLayout3)

        navigationLayout3b = self.navigationLayout3b()
        navigationLayouts.addLayout(navigationLayout3b)

        navigationLayout4 = self.navigationLayout4()
        navigationLayouts.addLayout(navigationLayout4)

        navigationLayout5 = self.navigationLayout5()
        navigationLayouts.addLayout(navigationLayout5)

        if len(config.bibleCollections) > 0:
            navigationLayout6 = self.navigationLayout6()
            navigationLayouts.addWidget(navigationLayout6)

        navigationLayout7 = self.navigationLayout7()
        navigationLayouts.addWidget(navigationLayout7)

        navigationLayouts.addStretch()

        navigation.setLayout(navigationLayouts)
        return navigation

    def navigationLayout1(self):
        navigationLayout1 = QBoxLayout(QBoxLayout.LeftToRight)
        navigationLayout1.setSpacing(5)
        # Version selection
        self.versionCombo = QComboBox()
        #self.textList = self.biblesSqlite.getBibleList()
        self.textList = self.parent.textList
        self.versionCombo.addItems(self.textList)
        for index, fullName in enumerate(self.parent.textFullNameList):
            self.versionCombo.setItemData(index, fullName, Qt.ToolTipRole)
        initialIndex = 0
        if self.text in self.textList:
            initialIndex = self.textList.index(self.text)
        self.versionCombo.setCurrentIndex(initialIndex)
        navigationLayout1.addWidget(self.versionCombo)
        # Book / Chapter / Verse selection
        self.bookCombo = QComboBox()
        navigationLayout1.addWidget(self.bookCombo)
        self.chapterCombo = QComboBox()
        navigationLayout1.addWidget(self.chapterCombo)
        self.verseCombo = QComboBox()
        navigationLayout1.addWidget(self.verseCombo)
        # Initial setup
        self.updateBookCombo()
        # Interactive update in response to users selection
        self.versionCombo.currentIndexChanged.connect(self.updateBookCombo)
        self.bookCombo.currentIndexChanged.connect(
            lambda index: self.updateChapterCombo(self.bookList[index], True))
        self.chapterCombo.currentIndexChanged.connect(
            lambda index: self.updateVerseCombo(self.chapterList[index], True))
        self.verseCombo.currentIndexChanged.connect(self.updateV)
        return navigationLayout1

    def navigationLayout2(self):
        buttonElementTuple = (
            ("bar1_menu", lambda: self.openInWindow("BIBLE")),
            ("bar2_menu", lambda: self.openInWindow("STUDY")),
            ("addToCommand", self.addToCommand),
            ("presentation", self.present),
        )
        return self.parent.buttonsLayout(buttonElementTuple)

    def navigationLayout3(self):
        feature = "html_showParallel"
        action = lambda: self.versionsAction("PARALLEL")
        items = self.textList
        initialItems = list(
            {config.mainText, config.studyText, config.favouriteBible})
        self.parallelCombo = CheckableComboBox(
            items, initialItems, toolTips=self.parent.textFullNameList)
        return self.parent.comboFeatureLayout(feature, self.parallelCombo,
                                              action)

    def navigationLayout3b(self):
        feature = "parallelVerses"
        action = lambda: self.versionsAction("PARALLELVERSES")
        items = self.textList
        initialItems = list(
            {config.mainText, config.studyText, config.favouriteBible})
        self.parallelVersesCombo = CheckableComboBox(
            items, initialItems, toolTips=self.parent.textFullNameList)
        return self.parent.comboFeatureLayout(feature,
                                              self.parallelVersesCombo, action)

    def navigationLayout4(self):
        feature = "html_showCompare"
        action = lambda: self.versionsAction("COMPARE")
        items = self.textList
        initialItems = list(
            {config.mainText, config.studyText, config.favouriteBible})
        self.compareCombo = CheckableComboBox(
            items, initialItems, toolTips=self.parent.textFullNameList)
        return self.parent.comboFeatureLayout(feature, self.compareCombo,
                                              action)

    def navigationLayout5(self):
        feature = "html_showDifference"
        action = lambda: self.versionsAction("DIFFERENCE")
        items = self.textList
        initialItems = list(
            {config.mainText, config.studyText, config.favouriteBible})
        self.differenceCombo = CheckableComboBox(
            items, initialItems, toolTips=self.parent.textFullNameList)
        return self.parent.comboFeatureLayout(feature, self.differenceCombo,
                                              action)

    def navigationLayout6(self):
        rows = []
        row = [
            ("All", lambda: self.selectCollection("All")),
            ("None", lambda: self.selectCollection("None")),
        ]
        count = len(row)
        for collection in sorted(config.bibleCollections.keys()):
            row.append((collection, partial(self.selectCollection,
                                            collection)))
            count += 1
            if count % 6 == 0:
                rows.append(row)
                row = []
        if len(row) > 0:
            rows.append(row)
        return self.parent.buttonsWidget(rows, False, False)

    def navigationLayout7(self):
        buttonRow1 = (
            ("MOB", lambda: self.openInWindow("BIBLE", "MOB")),
            ("MIB", lambda: self.openInWindow("BIBLE", "MIB")),
            ("MTB", lambda: self.openInWindow("BIBLE", "MTB")),
            ("MPB", lambda: self.openInWindow("BIBLE", "MPB")),
            ("MAB", lambda: self.openInWindow("BIBLE", "MAB")),
            ("SBLGNTl", lambda: self.openInWindow("BIBLE", "SBLGNTl")),
        )
        buttonRow2 = (
            ("LXX1", lambda: self.openInWindow("BIBLE", "LXX1")),
            ("LXX1i", lambda: self.openInWindow("BIBLE", "LXX1i")),
            ("LXX2", lambda: self.openInWindow("BIBLE", "LXX2")),
            ("LXX2i", lambda: self.openInWindow("BIBLE", "LXX2i")),
            ("OHGB", lambda: self.openInWindow("BIBLE", "OHGB")),
            ("OHGBi", lambda: self.openInWindow("BIBLE", "OHGBi")),
        )
        buttonElementTupleTuple = (buttonRow1, buttonRow2)
        return self.parent.buttonsWidget(buttonElementTupleTuple, False, False)

    def updateBCVText(self, b, c, v, text):
        if text in self.textList:
            self.versionCombo.setCurrentIndex(self.textList.index(text))
            self.text = text
        if b in self.bookList:
            self.bookCombo.setCurrentIndex(self.bookList.index(b))
            self.b = b
        if c in self.chapterList:
            self.chapterCombo.setCurrentIndex(self.chapterList.index(c))
            self.c = c
        if v in self.verseList:
            self.verseCombo.setCurrentIndex(self.verseList.index(v))
            self.v = v
        self.updateBcvLabels()

    def updateBookCombo(self, textIndex=None, reset=False):
        if textIndex is None or ((textIndex is not None) and textIndex >= 0):
            self.bcvChain = True

            if textIndex is not None:
                self.text = self.textList[textIndex]
            self.bookCombo.clear()
            self.bookList = self.biblesSqlite.getBookList(self.text)
            if self.bookList:
                # Add only those are recognised by UBA parser
                for index, b in enumerate(self.bookList):
                    strB = str(b)
                    if strB in self.bookNo2Abb:
                        self.bookCombo.addItem(self.bookNo2Abb[str(b)])
                        self.bookCombo.setItemData(index,
                                                   self.bookNo2Name[str(b)],
                                                   Qt.ToolTipRole)
                index = 0
                if not reset and self.b in self.bookList:
                    index = self.bookList.index(self.b)
                else:
                    self.b = self.bookList[index]
                    reset = True
                self.bookCombo.setCurrentIndex(index)
                # check / update
                self.updateChapterCombo(self.b, reset, False)

    def updateChapterCombo(self, b=None, reset=False, head=True):
        if b is None or ((b is not None) and b >= 0):
            if (head and not self.bcvChain) or (self.bcvChain and not head):
                self.bcvChain = True

                if b is not None:
                    self.b = b
                self.chapterCombo.clear()
                self.chapterList = self.biblesSqlite.getChapterList(
                    self.b, self.text)
                self.chapterCombo.addItems([str(c) for c in self.chapterList])
                index = 0
                if not reset and self.c in self.chapterList:
                    index = self.chapterList.index(self.c)
                else:
                    self.c = self.chapterList[index]
                    reset = True
                self.chapterCombo.setCurrentIndex(index)
                # check / update
                self.updateVerseCombo(self.c, reset, False)

    def updateVerseCombo(self, c=None, reset=False, head=True):
        if c is None or ((c is not None) and c >= 0):
            if (head and not self.bcvChain) or (self.bcvChain and not head):
                self.bcvChain = True

                if c is not None:
                    self.c = c
                self.verseCombo.clear()
                self.verseList = self.biblesSqlite.getVerseList(
                    self.b, self.c, self.text)
                self.verseCombo.addItems([str(v) for v in self.verseList])
                index = 0
                if not reset and self.v in self.verseList:
                    index = self.verseList.index(self.v)
                else:
                    self.v = self.verseList[index]
                self.verseCombo.setCurrentIndex(index)
                # Complete update
                self.updateBcvLabels()
                self.bcvChain = False

    def updateV(self, index):
        if not self.bcvChain and (index >= 0):
            self.v = self.verseList[index]
            self.verseLabel.setText(self.getSelectedReference())
            self.parent.updateBibleTabText("{0}:::{1}".format(
                self.text, self.getSelectedReference()))

    def featuresWidget(self):
        features = QWidget()
        featuresLayout = QFormLayout()
        featuresLayout.setSpacing(5)
        featuresLayout.addRow(self.bookLabel, self.bookFeatures())
        featuresLayout.addRow(self.chapterLabel, self.chapterFeatures())
        featuresLayout.addRow(self.verseLabel, self.verseFeatures())
        features.setLayout(featuresLayout)
        return features

    def updateBcvLabels(self):
        self.bookLabel.setText(self.getSelectedReferenceBook())
        self.chapterLabel.setText(self.getSelectedReferenceChapter())
        self.verseLabel.setText(self.getSelectedReference())
        self.parent.updateBibleTabText("{0}:::{1}".format(
            self.text, self.getSelectedReference()))

    def bookFeatures(self):
        buttonRow1 = (
            ("readNotes", lambda: self.openBibleNotes("book")),
            ("editNotes", lambda: self.editBibleNotes("book")),
        )
        buttonRow2 = (
            ("html_introduction",
             lambda: self.searchBookChapter("Tidwell_The_Bible_Book_by_Book")),
            ("html_timelines", lambda: self.searchBookChapter("Timelines")),
            ("context1_dict", lambda: self.searchBookName(True)),
            ("context1_encyclopedia", lambda: self.searchBookName(False)),
        )
        buttonElementTupleTuple = (buttonRow1, buttonRow2)
        return self.parent.buttonsWidget(buttonElementTupleTuple)

    def chapterFeatures(self):
        buttonRow1 = (
            ("readNotes", lambda: self.openBibleNotes("chapter")),
            ("editNotes", lambda: self.editBibleNotes("chapter")),
        )
        buttonRow2 = (
            ("html_overview", lambda: self.chapterAction("OVERVIEW")),
            ("html_chapterIndex", lambda: self.chapterAction("CHAPTERINDEX")),
            ("html_summary", lambda: self.chapterAction("SUMMARY")),
            ("menu4_commentary", lambda: self.chapterAction("COMMENTARY")),
        )
        buttonElementTupleTuple = (buttonRow1, buttonRow2)
        return self.parent.buttonsWidget(buttonElementTupleTuple)

    def verseFeatures(self):
        buttonRow1 = (
            ("readNotes", lambda: self.openBibleNotes("verse")),
            ("editNotes", lambda: self.editBibleNotes("verse")),
        )
        buttonRow2 = (
            ("menu4_compareAll", lambda: self.verseAction("COMPARE")),
            ("menu4_crossRef", lambda: self.verseAction("CROSSREFERENCE")),
            ("menu4_tske", lambda: self.verseAction("TSKE")),
        )
        buttonRow3 = (
            ("menu4_traslations", lambda: self.verseAction("TRANSLATION")),
            ("menu4_discourse", lambda: self.verseAction("DISCOURSE")),
            ("menu4_words", lambda: self.verseAction("WORDS")),
            ("menu4_tdw", lambda: self.verseAction("COMBO")),
        )
        buttonRow4 = (
            ("menu4_indexes", lambda: self.verseAction("INDEX")),
            ("menu4_commentary", lambda: self.verseAction("COMMENTARY")),
        )
        buttonElementTupleTuple = (buttonRow1, buttonRow2, buttonRow3,
                                   buttonRow4)
        return self.parent.buttonsWidget(buttonElementTupleTuple)

    # Selected Reference

    def getSelectedReference(self):
        return "{0} {1}:{2}".format(self.bookNo2Abb[str(self.b)], self.c,
                                    self.v)

    def getSelectedReferenceBook(self):
        return self.getSelectedReference().split(" ")[0]

    def getSelectedReferenceChapter(self):
        return self.getSelectedReference().split(":")[0]

    # Button actions

    def addToCommand(self):
        self.parent.commandField.setText("{0} {1}".format(
            self.parent.commandField.text(), self.getSelectedReference()))

    def openInWindow(self, window, text=""):
        if window == "STUDY" and config.openBibleInMainViewOnly:
            self.parent.parent.enableStudyBibleButtonClicked()
        command = "{0}:::{1}:::{2}".format(window, text if text else self.text,
                                           self.getSelectedReference())
        self.parent.runTextCommand(command)

    def present(self):
        config.mainText = self.text
        command = "SCREEN:::{0}".format(self.getSelectedReference())
        self.parent.runTextCommand(command)

    def openBibleNotes(self, noteType):
        keywords = {
            "book": "_openbooknote",
            "chapter": "_openchapternote",
            "verse": "_openversenote",
        }
        command = "{0}:::{1}.{2}.{3}".format(keywords[noteType], self.b,
                                             self.c, self.v)
        self.parent.runTextCommand(command)

    def versionsAction(self, keyword):
        selectedVersionsMap = {
            "PARALLEL": self.parallelCombo.checkItems,
            "PARALLELVERSES": self.parallelVersesCombo.checkItems,
            "COMPARE": self.compareCombo.checkItems,
            "DIFFERENCE": self.differenceCombo.checkItems,
        }
        selectedVersions = "_".join(selectedVersionsMap[keyword])
        command = "{0}:::{1}:::{2}".format(keyword, selectedVersions,
                                           self.getSelectedReference())
        self.parent.runTextCommand(command)

    def editBibleNotes(self, noteType):
        keywords = {
            "book": "_editbooknote",
            "chapter": "_editchapternote",
            "verse": "_editversenote",
        }
        command = "{0}:::{1}.{2}.{3}".format(keywords[noteType], self.b,
                                             self.c, self.v)
        self.parent.runTextCommand(command)

    def searchBookName(self, dictionary):
        engFullBookName = BibleBooks().eng[str(self.b)][1]
        matches = re.match("^[0-9]+? (.*?)$", engFullBookName)
        if matches:
            engFullBookName = matches.group(1)
        command = "SEARCHTOOL:::{0}:::{1}".format(
            config.dictionary if dictionary else config.encyclopedia,
            engFullBookName)
        self.parent.runTextCommand(command)

    def searchBookChapter(self, resource):
        engFullBookName = BibleBooks().eng[str(self.b)][1]
        command = "SEARCHBOOKCHAPTER:::{0}:::{1}".format(
            resource, engFullBookName)
        self.parent.runTextCommand(command)

    def chapterAction(self, keyword):
        command = "{0}:::{1}".format(keyword,
                                     self.getSelectedReferenceChapter())
        self.parent.runTextCommand(command)

    def verseAction(self, keyword):
        command = "{0}:::{1}".format(keyword, self.getSelectedReference())
        self.parent.runTextCommand(command)

    def selectCollection(self, collection):
        if collection == "All":
            self.versionCombo.clear()
            self.versionCombo.addItems(self.textList)
            for index, fullName in enumerate(self.parent.textFullNameList):
                self.versionCombo.setItemData(index, fullName, Qt.ToolTipRole)
            self.parallelCombo.checkAll()
            self.parallelVersesCombo.checkAll()
            self.compareCombo.checkAll()
            self.differenceCombo.checkAll()
        elif collection == "None":
            self.parallelCombo.clearAll()
            self.parallelVersesCombo.clearAll()
            self.compareCombo.clearAll()
            self.differenceCombo.clearAll()
        else:
            self.versionCombo.clear()
            self.versionCombo.addItems(config.bibleCollections[collection])
            for i in range(self.versionCombo.model().rowCount()):
                text = self.versionCombo.model().item(i).text()
                fullName = Bible(text).bibleInfo()
                self.versionCombo.setItemData(i, fullName, Qt.ToolTipRole)
            self.parallelCombo.checkFromList(
                config.bibleCollections[collection])
            self.parallelVersesCombo.checkFromList(
                config.bibleCollections[collection])
            self.compareCombo.checkFromList(
                config.bibleCollections[collection])
            self.differenceCombo.checkFromList(
                config.bibleCollections[collection])