diff --git a/.gitignore b/.gitignore index 94ddfc4ad5..95ead47fe0 100644 --- a/.gitignore +++ b/.gitignore @@ -116,3 +116,4 @@ tmpicns.rsrc .stop_chatgpt log.txt .python-version +google-cloud-key.json diff --git a/UniqueBibleAppVersion.txt b/UniqueBibleAppVersion.txt index 03a79bd489..463cee4241 100755 --- a/UniqueBibleAppVersion.txt +++ b/UniqueBibleAppVersion.txt @@ -1 +1 @@ -35.27 +35.28 diff --git a/docker_requirements.txt b/docker_requirements.txt index f9a3a28ba0..61b5bb692a 100644 --- a/docker_requirements.txt +++ b/docker_requirements.txt @@ -11,7 +11,7 @@ click==8.0.3 cobble==0.1.3 colorama==0.4.4 contextlib2==0.6.0.post1 -cryptography==42.0.0 +cryptography==42.0.2 Deprecated==1.2.13 diff-match-patch==20200713 distlib==0.3.4 diff --git a/gui/MainWindow.py b/gui/MainWindow.py index 4ed7b05c97..22c94ba751 100755 --- a/gui/MainWindow.py +++ b/gui/MainWindow.py @@ -1167,60 +1167,74 @@ def setStudyBibleToolBar(self): # install marvel data def installMarvelBibles(self): - items = [self.bibleInfo[bible][-1] for bible in self.bibleInfo.keys() if - not os.path.isfile(os.path.join(*self.bibleInfo[bible][0])) or self.isNewerAvailable( + installAll = "Install ALL Bibles" + bibles = DatafileLocation.marvelBibles + items = [bible for bible in bibles.keys() if + not os.path.isfile(os.path.join(os.getcwd(), *bibles[bible][0])) or self.isNewerAvailable( self.bibleInfo[bible][0][-1])] - if not items: + if items: + items.append(installAll) + else: items = ["[All Installed]"] item, ok = QInputDialog.getItem(self, "UniqueBible", config.thisTranslation["menu8_bibles"], items, 0, False) - if ok and item and not item == "[All Installed]": - for key, value in self.bibleInfo.items(): - if item == value[-1]: - self.downloadHelper(self.bibleInfo[key]) - break + if ok and item and not item in ("[All Installed]", installAll): + self.downloadHelper(bibles[item]) + elif item == installAll: + self.installAllMarvelFiles(bibles, installAll) self.reloadResources() def installMarvelCommentaries(self): + installAll = "Install ALL Commentaries" commentaries = DatafileLocation.marvelCommentaries items = [commentary for commentary in commentaries.keys() if - not os.path.isfile(os.path.join(*commentaries[commentary][0]))] + not os.path.isfile(os.path.join(os.getcwd(), *commentaries[commentary][0]))] if items: - commentaries["Install ALL Commentaries Listed Above"] = "" - items.append("Install ALL Commentaries Listed Above") + items.append(installAll) else: items = ["[All Installed]"] item, ok = QInputDialog.getItem(self, "UniqueBible", config.thisTranslation["menu8_commentaries"], items, 0, False) - if ok and item and not item in ("[All Installed]", "Install ALL Commentaries Listed Above"): + if ok and item and not item in ("[All Installed]", installAll): self.downloadHelper(commentaries[item]) - elif item == "Install ALL Commentaries Listed Above": - self.installAllMarvelCommentaries(commentaries) + self.reloadResources() + elif item == installAll: + self.installAllMarvelFiles(commentaries, installAll) - def installAllMarvelCommentaries(self, commentaries): + def installAllMarvelFiles(self, files, installAll): if config.isDownloading: self.displayMessage(config.thisTranslation["previousDownloadIncomplete"]) else: - toBeInstalled = [commentary for commentary in commentaries.keys() if - not commentary == "Install ALL Commentaries Listed Above" and not os.path.isfile( - os.path.join(*commentaries[commentary][0]))] + toBeInstalled = [file for file in files.keys() if + not file == installAll and not os.path.isfile( + os.path.join(os.getcwd(), *files[file][0]))] self.displayMessage("{0} {1}".format(config.thisTranslation["message_downloadAllFiles"], config.thisTranslation["message_willBeNoticed"])) - for commentary in toBeInstalled: - databaseInfo = commentaries[commentary] + print("Downloading {0} files".format(len(toBeInstalled))) + for file in toBeInstalled: + databaseInfo = files[file] downloader = Downloader(self, databaseInfo) + print("Downloading " + file) downloader.downloadFile(False) - # self.displayMessage(config.thisTranslation["message_done"]) + self.reloadResources() + print("Downloading complete") + self.displayMessage(config.thisTranslation["message_installed"]) def installMarvelDatasets(self): + installAll = "Install ALL Datasets" datasets = DatafileLocation.marvelData - items = [dataset for dataset in datasets.keys() if not os.path.isfile(os.path.join(*datasets[dataset][0]))] - if not items: + items = [dataset for dataset in datasets.keys() if not os.path.isfile(os.path.join(os.getcwd(), *datasets[dataset][0]))] + if items: + items.append(installAll) + else: items = ["[All Installed]"] item, ok = QInputDialog.getItem(self, "UniqueBible", config.thisTranslation["menu8_datasets"], items, 0, False) - if ok and item and not item == "[All Installed]": + if ok and item and not item in ("[All Installed]", installAll): self.downloadHelper(datasets[item]) + elif item == installAll: + self.installAllMarvelFiles(datasets, installAll) + self.reloadResources() def installGithubBibles(self): self.installFromGitHub(GitHubRepoInfo.bibles) @@ -1285,24 +1299,41 @@ def installFromGitHub(self, gitHubRepoInfo): try: from util.GithubUtil import GithubUtil + installAll = "Install ALL" github = GithubUtil(repo) repoData = github.getRepoData() folder = os.path.join(config.marvelData, directory) items = [item for item in repoData.keys() if not FileUtil.regexFileExists("^{0}.*".format(GithubUtil.getShortname(item).replace(".", "\\.")), folder)] - if not items: + if items: + items.append(installAll) + else: items = ["[All Installed]"] - item, ok = QInputDialog.getItem(self, "UniqueBible", + selectedItem, ok = QInputDialog.getItem(self, "UniqueBible", config.thisTranslation[title], items, 0, False) - if ok and item and not item in ("[All Installed]"): - file = os.path.join(folder, item+".zip") - github.downloadFile(file, repoData[item]) - with zipfile.ZipFile(file, 'r') as zipped: - zipped.extractall(folder) - os.remove(file) - self.displayMessage(item + " " + config.thisTranslation["message_installed"]) + if ok and selectedItem: + if selectedItem == installAll: + self.displayMessage("{0} {1}".format(config.thisTranslation["message_downloadAllFiles"], + config.thisTranslation["message_willBeNoticed"])) + items.remove(installAll) + print("Downloading {0} files".format(len(items))) + else: + self.displayMessage(selectedItem + " " + config.thisTranslation["message_installing"]) + items = [selectedItem] + for index, item in enumerate(items): + file = os.path.join(folder, item+".zip") + print("Downloading {0}".format(file)) + github.downloadFile(file, repoData[item]) + with zipfile.ZipFile(file, 'r') as zipped: + zipped.extractall(folder) + os.remove(file) + print("Downloading complete") self.reloadResources() - self.installFromGitHub(gitHubRepoInfo) - return True + if selectedItem == installAll: + self.displayMessage(config.thisTranslation["message_installed"]) + else: + self.installFromGitHub(gitHubRepoInfo) + return True + except Exception as ex: self.displayMessage(config.thisTranslation["couldNotAccess"] + " " + repo) print(ex) diff --git a/latest_changes.txt b/latest_changes.txt index c2b0baaddb..273aedc426 100755 --- a/latest_changes.txt +++ b/latest_changes.txt @@ -1,3 +1,6 @@ +Changes in 35.28: +* Add "Install ALL" to module downloads + Changes in 35.27: * Populate verse list if missing chapter in api server diff --git a/patches.txt b/patches.txt index ddb4732216..e10de85c38 100755 --- a/patches.txt +++ b/patches.txt @@ -645,7 +645,6 @@ (26.30, "file", "music/Readme.md") (26.30, "file", "video/Readme.md") (26.49, "file", "util/CatalogUtil.py") -(28.06, "file", "util/DatafileLocation.py") (28.07, "file", "htmlResources/expand.png") (28.27, "file", "util/Languages.py") (28.30, "file", "util/ScrapeSite.py") @@ -1215,7 +1214,6 @@ (33.16, "file", "plugins/startup/customise_terminal_mode_commands.py") (33.20, "file", "util/PromptValidator.py") (33.25, "file", "util/LexicalData.py") -(33.28, "file", ".gitignore") (33.48, "file", "gui/CentralWidget.py") (33.50, "file", "gui/MiniControl.py") (33.50, "file", "gui/NoteEditor.py") @@ -1365,7 +1363,6 @@ (35.24, "file", "util/ShortcutUtil.py") (35.25, "file", "db/StatisticsWordsSqlite.py") (35.25, "file", "db/ToolsSqlite.py") -(35.25, "file", "gui/MainWindow.py") (35.25, "file", "gui/MenuItems.py") (35.25, "file", "lang/language_de.py") (35.25, "file", "lang/language_el.py") @@ -1394,6 +1391,9 @@ (35.26, "file", "util/terminal_system_command_prompt.py") (35.26, "file", "util/TextEditorUtility.py") (35.27, "file", "db/BiblesSqlite.py") -(35.27, "file", "latest_changes.txt") -(35.27, "file", "patches.txt") -(35.27, "file", "UniqueBibleAppVersion.txt") +(35.28, "file", ".gitignore") +(35.28, "file", "gui/MainWindow.py") +(35.28, "file", "util/DatafileLocation.py") +(35.28, "file", "patches.txt") +(35.28, "file", "latest_changes.txt") +(35.28, "file", "UniqueBibleAppVersion.txt") diff --git a/util/DatafileLocation.py b/util/DatafileLocation.py index 521ac7aefb..7d588e0725 100644 --- a/util/DatafileLocation.py +++ b/util/DatafileLocation.py @@ -114,7 +114,6 @@ class DatafileLocation: "Search Engine": ((config.marvelData, "search.sqlite"), "1A4s8ewpxayrVXamiva2l1y1AinAcIKAh"), "Smart Indexes": ((config.marvelData, "indexes2.sqlite"), "1hY-QkBWQ8UpkeqM8lkB6q_FbaneU_Tg5"), "Chapter & Verse Notes": ((config.marvelData, "note.sqlite"), "1OcHrAXLS-OLDG5Q7br6mt2WYCedk8lnW"), - "Bible Background Data": ((config.marvelData, "data", "exlb3.data"), "1gp2Unsab85Se-IB_tmvVZQ3JKGvXLyMP"), "Bible Topics Data": ((config.marvelData, "data", "exlb3.data"), "1gp2Unsab85Se-IB_tmvVZQ3JKGvXLyMP"), "Cross-reference Data": ( (config.marvelData, "cross-reference.sqlite"), "1fTf0L7l1k_o1Edt4KUDOzg5LGHtBS3w_"),