示例#1
0
    def __init__(self, parent, language):
        super(EditGuiLanguageFileDialog, self).__init__()

        self.parent = parent
        self.language = language
        self.reference = LanguageUtil.loadTranslation(
            config.referenceTranslation)
        targetLanguage = LanguageUtil.loadTranslation(language)
        self.languages = []
        self.toolTips = []
        # Cannot use the following two lines directly because target language file and reference file are most likely in different order
        #self.languages = [(key, value.replace("\n", "\\n")) for key, value in targetLanguage.items()]
        #self.toolTips = [(value.replace("\n", "\\n"), value.replace("\n", "\\n")) for value in self.reference.values()]
        for key in self.reference:
            if key in targetLanguage:
                self.languages.append(
                    [key, targetLanguage[key].replace("\n", "\\n")])
                self.toolTips.append([
                    self.reference[key].replace("\n", "\\n"),
                    self.reference[key].replace("\n", "\\n")
                ])

        self.setWindowTitle("Edit GUI Language File")
        self.setMinimumWidth(1000)
        self.setMinimumHeight(600)
        self.layout = QVBoxLayout()

        row = QHBoxLayout()
        self.filterEntry1 = QLineEdit()
        self.filterEntry1.textChanged.connect(self.filterChanged1)
        row.addWidget(self.filterEntry1)
        self.filterEntry2 = QLineEdit()
        self.filterEntry2.textChanged.connect(self.filterChanged2)
        row.addWidget(self.filterEntry2)
        self.layout.addLayout(row)

        self.table = QTableView()
        self.model = DisplayLanguagesModel(self, self.languages, self.toolTips)
        self.table.setModel(self.model)
        self.table.resizeColumnsToContents()
        self.table.setSortingEnabled(True)
        self.table.doubleClicked.connect(self.clickedRow)
        self.layout.addWidget(self.table)

        buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        self.buttonBox = QDialogButtonBox(buttons)
        self.buttonBox.accepted.connect(self.save)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.layout.addWidget(self.buttonBox)
        self.setLayout(self.layout)
def main():
    import sys
    from qtpy.QtWidgets import QApplication
    from qtpy.QtCore import QCoreApplication
    from util.ConfigUtil import ConfigUtil
    from util.LanguageUtil import LanguageUtil

    ConfigUtil.setup()
    config.noQt = False
    config.thisTranslation = LanguageUtil.loadTranslation("en_US")
    QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
    app = QApplication(sys.argv)
    dialog = DownloadBibleMp3Dialog(DummyParent())
    dialog.exec_()
示例#3
0
def main():
    from util.LanguageUtil import LanguageUtil

    filename1 = "/Users/otseng/dev/UniqueBible/music/Draw Me Close To You - The AsidorS - Hillsong Cover.mp3"
    filename2 = "/Users/otseng/dev/UniqueBible/music/Through It All Hillsong Cover The AsidorS.mp3"
    filename3 = "/Users/otseng/dev/UniqueBible/music/04 Made Me Glad (Live).mp3"
    filename4 = "/Users/otseng/dev/UniqueBible/video/Luke 15_11 - The Prodigal Son.mp4"
    # filename = "doesnotexist.mp4"
    # filename = ""
    config.thisTranslation = LanguageUtil.loadTranslation("en_US")
    app = QtWidgets.QApplication(sys.argv)
    player = VlcPlayer(DummyParent(), filename1)
    player.addToPlaylist(filename2)
    player.addToPlaylist(filename3)
    player.show()
    sys.exit(app.exec_())
示例#4
0
    def __init__(self):
        import update
        import config

        self.bibleInfo = update.bibleInfo
        config.thisTranslation = LanguageUtil.loadTranslation(config.displayLanguage)
示例#5
0
        import config

        self.bibleInfo = update.bibleInfo
        config.thisTranslation = LanguageUtil.loadTranslation(config.displayLanguage)

    def updateMainRefButton(self):
        pass

    def enableParagraphButtonAction(self, v):
        pass

    def downloadHelper(self, v):
        pass

    def updateStudyRefButton(self):
        pass

    def updateCommentaryRefButton(self):
        pass

if __name__ == "__main__":
    import config

    config.thisTranslation = LanguageUtil.loadTranslation("en_US")
    config.parserStandarisation = 'NO'
    config.standardAbbreviation = 'ENG'
    config.marvelData = "/Users/otseng/dev/UniqueBible/marvelData/"

    command = "12"
    command = re.sub("\[[ABCD]", "", command)
    print(command)
示例#6
0
    def getRow(self, row):
        return self.list[row]

    def setRow(self, row, data):
        self.list[row] = data

    def headerData(self, col, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            return self.header[col]
        return None

    def sort(self, col, order):
        self.layoutAboutToBeChanged.emit()
        self.col = col
        self.order = order
        self.list = sorted(self.list, key=operator.itemgetter(col))
        if order == Qt.DescendingOrder:
            self.list.reverse()
        self.layoutChanged.emit()


if __name__ == '__main__':
    from util.LanguageUtil import LanguageUtil

    LanguageUtil.loadTranslation("en_US")
    QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_ShareOpenGLContexts)
    app = QApplication(sys.argv)
    shortcuts = ShortcutUtil.getAllShortcuts()
    window = DisplayShortcutsWindow("test1", shortcuts)
    window.exec_()
    window.close()
示例#7
0
 def test_allLanguageFilesAreSameSize(self):
     languages = LanguageUtil.getCodesSupportedLanguages()
     englishSize = len(LanguageUtil.loadTranslation("en_US"))
     for lang in languages:
         trans = LanguageUtil.loadTranslation(lang)
         self.assertEqual(englishSize, len(trans))
示例#8
0
 def __init__(self):
     self.bibleInfo = DatafileLocation.marvelBibles
     if not config.enableHttpServer:
         self.setupResourceLists()
         config.thisTranslation = LanguageUtil.loadTranslation(
             config.displayLanguage)