From 21290da27748906167957eb9b823e66c87d2953a Mon Sep 17 00:00:00 2001 From: eliranwong Date: Sat, 19 Oct 2024 23:42:35 +0000 Subject: [PATCH] fixed launching terminal mode on Android --- setup.py | 2 +- test.py | 116 --------------------------- uniquebible/db/BiblesSqlite_nogui.py | 44 +++++++++- uniquebible/startup/nonGui.py | 2 + uniquebible/util/CatalogUtil.py | 3 +- 5 files changed, 48 insertions(+), 119 deletions(-) delete mode 100644 test.py diff --git a/setup.py b/setup.py index d97d9f1582..12d6e6384f 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ # https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/ setup( name=package, - version="0.1.05", + version="0.1.06", python_requires=">=3.8, <3.13", description=f"UniqueBible App is a cross-platform & offline bible application, integrated with high-quality resources and unique features. Developers: Eliran Wong and Oliver Tseng", long_description=long_description, diff --git a/test.py b/test.py deleted file mode 100644 index 73a08841fb..0000000000 --- a/test.py +++ /dev/null @@ -1,116 +0,0 @@ -a = [ - '\[', - '\[', - '\[', - '\{', - '\[', - '\s', - '\s', - '\.', - '\.', - '\.', - '\.', - '\[', - '\.', - '\.', - '\.', - '\[', - '\[', - '\[', - '\-', - '\(', - '\(', - '\(', - '\(', - '\.', - '\[', - '\{', - '\.', - '\.', - '\.', - '\[', - '\[', - '\(', - '\[', - '\(', - '\.', - '\.', - '\.', - '\(', - '\/', - '\]', - '\]', - '\(', - '\]', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\.', - '\(', - '\(', - '\*', - '\*', - '\(', - '\[', - '\-', - '\.', - '\-', - '\[', - '\[', - '\.', - '\[', - '\[', - '\.', - '\(', - '\*', - '\*', - '\(', - '\.', - '\[', - '\[', - '\[', - '\[', - '\.', - '\.', - '\.', - '\(', - '\.', - '\.', - '\(', - '\[', - '\[', - '\(', - '\[', - '\(', - '\[', - '\[', - '\[', - '\.', - '\.', - '\.', - '\.', - '\(', - '\(', - '\(', - '\(', - '\(', - '\(', - '\(', - '\(', - '\(', -] -a = list(set(a)) -print(a) \ No newline at end of file diff --git a/uniquebible/db/BiblesSqlite_nogui.py b/uniquebible/db/BiblesSqlite_nogui.py index bc133ab46a..b157f56503 100644 --- a/uniquebible/db/BiblesSqlite_nogui.py +++ b/uniquebible/db/BiblesSqlite_nogui.py @@ -810,8 +810,10 @@ class Bible: CREATE_COMMENTARY_TABLE = "CREATE TABLE Commentary (Book INT, Chapter INT, Scripture TEXT)" - def __init__(self, text): + def __init__(self, text=None): # connect [text].bible + if text is None: + text = config.mainText self.text = text self.connection = None self.cursor = None @@ -825,6 +827,46 @@ def __del__(self): # #self.cursor.execute("COMMIT") self.connection.close() + # Check if a verse is empty + def isNonEmptyVerse(self, b, c, v): + query = "SELECT Scripture FROM Verses WHERE Book=? AND Chapter=? AND Verse=?" + self.cursor.execute(query, (b, c, v)) + scripture = self.cursor.fetchone() + if not scripture: + return False + return True if scripture[-1].strip() else False + + # Expand a list of verse range to include individual verses + def getEverySingleVerseList(self, verseList) -> list: + allVerses = [] + for verse in verseList: + if len(verse) == 3: + allVerses.append(verse) + elif len(verse) == 4: + b, c, vs, ve = verse + for v in self.getVerseList(b, c, vs, ve): + allVerses.append((b, c, v)) + elif len(verse) == 5: + b, cs, vs, ce, ve = verse + if (cs > ce): + pass + elif (cs == ce): + for v in self.getVerseList(b, cs, vs, ve): + allVerses.append((b, cs, v)) + else: + c = cs + for v in self.getVerseList(b, c, vs): + allVerses.append((b, c, v)) + c += 1 + while (c < ce): + for v in self.getVerseList(b, c): + allVerses.append((b, c, v)) + c += 1 + if (c == ce): + for v in self.getVerseList(b, c, 1, ve): + allVerses.append((b, c, v)) + return allVerses + def bcvToVerseReference(self, b, c, v): return BibleVerseParser(config.parserStandarisation).bcvToVerseReference(b, c, v) diff --git a/uniquebible/startup/nonGui.py b/uniquebible/startup/nonGui.py index 503fa23399..12cc5ed88b 100755 --- a/uniquebible/startup/nonGui.py +++ b/uniquebible/startup/nonGui.py @@ -9,6 +9,8 @@ # manage latest update def checkApplicationUpdateCli(): + # TODO disable for now; update later + return False try: print("Checking the latest version ...") checkFile = "{0}UniqueBibleAppVersion.txt".format(UpdateUtil.repository) diff --git a/uniquebible/util/CatalogUtil.py b/uniquebible/util/CatalogUtil.py index 605c3533a1..755637532b 100644 --- a/uniquebible/util/CatalogUtil.py +++ b/uniquebible/util/CatalogUtil.py @@ -2,7 +2,8 @@ from uniquebible import config from uniquebible.util.FileUtil import FileUtil from uniquebible.util.GitHubRepoInfo import GitHubRepoInfo -from uniquebible.util.GithubUtil import GithubUtil +if not config.noQt: + from uniquebible.util.GithubUtil import GithubUtil class CatalogUtil: