From bead7fe3c5610cb7b83d232e6b349d31f03bbfa1 Mon Sep 17 00:00:00 2001 From: Oliver Tseng Date: Fri, 1 Nov 2024 07:20:55 -0400 Subject: [PATCH] Fix startup --- .gitignore | 53 ++++++++++++++++---------------- uniquebible/gui/MainWindow.py | 11 ++++--- uniquebible/util/LanguageUtil.py | 2 +- uniquebible/util/TextUtil.py | 6 ++++ 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 429003954c..5ce26eef03 100644 --- a/.gitignore +++ b/.gitignore @@ -39,15 +39,15 @@ myTranslation.py UniqueBible.code-workspace **.log **.log.** -htmlResources/bible_map.html -htmlResources/main.html -htmlResources/study.html -htmlResources/css/custom.css -htmlResources/js/custom.js -htmlResources/*.pdf -UniqueBible.app.pdf +uniquebible/htmlResources/bible_map.html +uniquebible/htmlResources/main.html +uniquebible/htmlResources/study.html +uniquebible/htmlResources/css/custom.css +uniquebible/htmlResources/js/custom.js +uniquebible/htmlResources/*.pdf UniqueBibleApp.docx WordDocument_NEW.docx +UniqueBible.app.pdf thirdParty/dictionaries/* shortcut*.py shortcut_* @@ -55,22 +55,22 @@ BibleVerseParser.py.old UniqueBibleApp.desktop UniqueBibleApp.sh morphology.sqlite -htmlResources/fonts/* -htmlResources/images/[A-Z]*/* -htmlResources/images/qrcode.png +uniquebible/htmlResources/fonts/* +uniquebible/htmlResources/images/[A-Z]*/* +uniquebible/htmlResources/images/qrcode.png **/.DS_Store nohup.out /Perimeter\ Worship\ Songs /Personal -htmlResources/main-*.html -htmlResources/lib/pdfjs-2.7.570-dist/web/*.pdf -htmlResources/lib/bibi-v1.2.0/bibi-bookshelf/*.epub -htmlResources/popover.html +uniquebible/htmlResources/main-*.html +uniquebible/htmlResources/lib/pdfjs-2.7.570-dist/web/*.pdf +uniquebible/htmlResources/lib/bibi-v1.2.0/bibi-bookshelf/*.epub +uniquebible/htmlResources/popover.html /snippets/** credentials_* uba_*.py -htmlResources/material/.DS_Store -htmlResources/material/** +uniquebible/htmlResources/material/.DS_Store +uniquebible/htmlResources/material/** *.color *.colour *.filter @@ -82,20 +82,18 @@ temp/* webstorage/* workspace/** uba.sh -util/GitHubCustomRepoCache.py -/ip_blacklist.txt -/ip_whitelist.txt -secrets/github/*.txt +uniquebible/util/GitHubCustomRepoCache.py +uniquebible/secrets/github/*.txt config.ini disabled_modules.txt .swp nano.* config.py.save -terminal_history/* -terminal_mode/developers/*.py -terminal_mode/Unique_Bible_App.html -htmlResources/bar_chart.png -htmlResources/pie_chart.png +uniquebible/terminal_history/* +uniquebible/terminal_mode/developers/*.py +uniquebible/terminal_mode/Unique_Bible_App.html +uniquebible/htmlResources/bar_chart.png +uniquebible/htmlResources/pie_chart.png portable_python uba_gui_*.sh uba_terminal_*.sh @@ -128,4 +126,7 @@ uniquebible/htmlResources/images/exlbl_largeHD/ uniquebible/venv*/ uniquebible/marvelData/ uniquebible/marvelData_*/ -uniquebible/macros/ \ No newline at end of file +uniquebible/macros/ +uniquebible/plugins/menu +uniquebible/ip_blacklist.txt +uniquebible/ip_whitelist.txt \ No newline at end of file diff --git a/uniquebible/gui/MainWindow.py b/uniquebible/gui/MainWindow.py index 2aa3c5df03..46434e01b1 100755 --- a/uniquebible/gui/MainWindow.py +++ b/uniquebible/gui/MainWindow.py @@ -1,4 +1,4 @@ -import os, signal, sys, re, base64, webbrowser, platform, subprocess, requests, update, logging, zipfile, glob +import os, signal, sys, re, base64, webbrowser, platform, subprocess, requests, logging, zipfile, glob from uniquebible import config import markdown, time #from distutils import util @@ -24,6 +24,7 @@ from qtpy.QtGui import QClipboard from qtpy.QtMultimedia import QMediaPlayer, QMediaContent from qtpy.QtMultimediaWidgets import QVideoWidget +from uniquebible import update from uniquebible.gui.PlaylistUI import PlaylistUI from uniquebible.gui.WorkSpace import Workspace from uniquebible.db.DevotionalSqlite import DevotionalSqlite @@ -4783,10 +4784,10 @@ def switchLandscapeMode(self): self.centralWidget.switchLandscapeMode() self.resizeCentral() - """def setLandscapeMode(self, mode): - config.landscapeMode = bool(util.strtobool(mode)) + def setLandscapeMode(self, mode): + config.landscapeMode = TextUtil.strtobool(mode) self.centralWidget.switchLandscapeMode() - self.resizeCentral()""" + self.resizeCentral() def resizeCentral(self): self.centralWidget.resizeMe() @@ -5361,7 +5362,7 @@ def loadRunMacrosMenu(self, run_macro_menu): run_macro_menu.addAction(action) count += 1 - def runMacro(self, file=""): + def runMacro(self, file="", extra=""): if config.enableMacros and len(file) > 0: if not ".ubam" in file: file += ".ubam" diff --git a/uniquebible/util/LanguageUtil.py b/uniquebible/util/LanguageUtil.py index 5b57e44746..6e27d8c761 100644 --- a/uniquebible/util/LanguageUtil.py +++ b/uniquebible/util/LanguageUtil.py @@ -38,7 +38,7 @@ def determineDefaultLanguage(): @staticmethod def loadTranslation(lang): - file = "lang.language_{0}".format(lang) + file = "uniquebible.lang.language_{0}".format(lang) module = importlib.import_module(file) trans = importlib.reload(module) return trans.translation diff --git a/uniquebible/util/TextUtil.py b/uniquebible/util/TextUtil.py index a5669b1aa8..e5adc3ac0e 100644 --- a/uniquebible/util/TextUtil.py +++ b/uniquebible/util/TextUtil.py @@ -493,6 +493,12 @@ def removeSpecialCharacters(text): text = re.sub(search, replace, text) return text + @staticmethod + def strtobool(value: str) -> bool: + value = value.lower() + if value in ("y", "yes", "on", "1", "true", "t"): + return True + return False if __name__ == '__main__':