def save(self): LanguageUtil.saveLanguageFile(self.language, self.model.fullList) if self.language == config.displayLanguage: if self.parent is not None: for item in self.model.fullList: key = item[0] newValue = item[1] config.thisTranslation[key] = newValue self.parent.setupMenuLayout(config.menuLayout) self.parent.reloadControlPanel(False)
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 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 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_()
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_())
def __init__(self): import update import config self.bibleInfo = update.bibleInfo config.thisTranslation = LanguageUtil.loadTranslation(config.displayLanguage)
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 = "1[A[B[C[D2" command = re.sub("\[[ABCD]", "", command) print(command)
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()
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))
def __init__(self): self.bibleInfo = DatafileLocation.marvelBibles if not config.enableHttpServer: self.setupResourceLists() config.thisTranslation = LanguageUtil.loadTranslation( config.displayLanguage)