Skip to content

Commit

Permalink
improved startup
Browse files Browse the repository at this point in the history
  • Loading branch information
eliranwong committed Nov 1, 2024
1 parent 902d063 commit 1f31b9a
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/
setup(
name=package,
version="0.1.45",
version="0.1.51",
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,
Expand Down
2 changes: 1 addition & 1 deletion uniquebible/lang/language_en_GB.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"menu4_tdw": "TDW Combo",
"menu4_crossRef": "Cross References",
"menu4_tske": "TSK (Enhanced edition)",
"menu4_compareAll": "Compare All Versions",
"menu4_compareAll": "Compare Favourite Versions",
"menu4_moreComparison": "Comparison / Parallel Reading / Difference",
"menu5_search": "Search",
"menu5_lookup": "Lookup",
Expand Down
2 changes: 1 addition & 1 deletion uniquebible/lang/language_en_US.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"menu4_tdw": "TDW Combo",
"menu4_crossRef": "Cross References",
"menu4_tske": "TSK (Enhanced edition)",
"menu4_compareAll": "Compare All Versions",
"menu4_compareAll": "Compare Favorite Versions",
"menu4_moreComparison": "Comparison / Parallel Reading / Difference",
"menu5_search": "Search",
"menu5_lookup": "Lookup",
Expand Down
2 changes: 1 addition & 1 deletion uniquebible/lang/language_zh_HANS.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"menu4_tdw": "原文分析组合",
"menu4_crossRef": "串珠",
"menu4_tske": "TSK(串珠加强版)",
"menu4_compareAll": "比较全部译本",
"menu4_compareAll": "比较爱好译本",
"menu4_moreComparison": "比较/并行读/差异",
"menu5_search": "搜索",
"menu5_lookup": "查阅",
Expand Down
2 changes: 1 addition & 1 deletion uniquebible/lang/language_zh_HANT.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"menu4_tdw": "原文分析組合",
"menu4_crossRef": "串珠",
"menu4_tske": "TSK(串珠加強版)",
"menu4_compareAll": "比較全部譯本",
"menu4_compareAll": "比較愛好譯本",
"menu4_moreComparison": "比較/並行讀/差異",
"menu5_search": "搜索",
"menu5_lookup": "查閱",
Expand Down
10 changes: 10 additions & 0 deletions uniquebible/latest_changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
PIP package:

0.1.43-0.1.51

* fixed and improved startup

* improved web api

* added command `chapter:::` and `comparechapter:::`

* command `compare:::ALL:::` now compares all favourite bibles instead of all installed bibles

0.1.42

* added command `.resources` to web API to retrieve available resources
Expand Down
12 changes: 7 additions & 5 deletions uniquebible/uba.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,11 @@ def desktopFileContent():
# Run main.py
mainPy = "main.py {0}".format(initialCommand) if initialCommand else "main.py"
if enableCli:
if os.path.exists(activator):
os.system("{0} & {1} {2}".format(activator, python, mainPy))
else:
os.system("{0} {1}".format(python, mainPy))
#if os.path.exists(activator):
# os.system("{0} & {1} {2}".format(activator, python, mainPy))
#else:
# os.system("{0} {1}".format(python, mainPy))
exec("from uniquebible.main import *", globals())
else:
if os.path.exists(activator):
subprocess.Popen("{0} & {1} {2}".format(activator, python, mainPy), shell=True)
Expand All @@ -191,7 +192,8 @@ def desktopFileContent():
exec(code, dict(__file__=activator))"""
# Run main.py
if enableCli:
os.system("{0} {1}{2}".format(python, mainFile, f" {initialCommand}" if initialCommand else ""))
#os.system("{0} {1}{2}".format(python, mainFile, f" {initialCommand}" if initialCommand else ""))
exec("from uniquebible.main import *", globals())
else:
subprocess.Popen([python, mainFile, initialCommand] if initialCommand else [python, mainFile])

Expand Down
4 changes: 2 additions & 2 deletions uniquebible/util/LocalCliHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,11 +1058,11 @@ def getCommandCompleterSuggestions(self, textCommandSuggestion=None):
suggestions[i] = self.getDummyDict(self.crossPlatform.textList)
elif i in ("_vnsc:::", "_vndc:::", "readchapter:::", "readverse:::", "readword:::", "readlexeme:::",):
suggestions[i] = self.getDummyDict(self.crossPlatform.textList, ".")
elif i in ("compare:::",):
elif i in ("compare:::", "comparechapter:::"):
suggestions[i] = self.getDummyDict(self.crossPlatform.textList, "_")
elif i in ("count:::", "search:::", "andsearch:::", "orsearch:::", "advancedsearch:::", "regexsearch:::",):
suggestions[i] = self.getDummyDict(self.crossPlatform.textList, ":::")
elif i in ("bible:::", "main:::", "study:::", "read:::", "readsync:::", "_verses:::"):
elif i in ("bible:::", "chapter:::", "main:::", "study:::", "read:::", "readsync:::", "_verses:::"):
suggestions[i] = self.getDummyDict(self.crossPlatform.textList, ":::", None if config.terminalUseLighterCompleter else self.allKJVreferences)
elif i in ("_biblenote:::",):
suggestions[i] = self.getDummyDict(self.crossPlatform.textList, ":::", None if config.terminalUseLighterCompleter else self.allKJVreferencesBcv1)
Expand Down
14 changes: 9 additions & 5 deletions uniquebible/util/TextCommandParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,8 @@ def textPlainBible(self, verseList, text):
verses = biblesSqlite.readMultipleVerses(text, verseList)
return verses

def textFormattedBible(self, verse, text, source=""):
if config.rawOutput:
def textFormattedBible(self, verse, text, source="", rawOutputChapter=False):
if config.rawOutput and not rawOutputChapter:
return self.textPlainBible([verse], text)
formattedBiblesFolder = os.path.join(config.marvelData, "bibles")
formattedBibles = [f[:-6] for f in os.listdir(formattedBiblesFolder) if os.path.isfile(os.path.join(formattedBiblesFolder, f)) and f.endswith(".bible") and not re.search(r"^[\._]", f)]
Expand Down Expand Up @@ -1464,6 +1464,7 @@ def textFormattedChapter(self, command, source):
verseList = self.extractAllVerses(references)
if not verseList:
return self.invalidCommand()
firstVerse = verseList[0]
texts = self.getConfirmedTexts(texts)
marvelBibles = self.getMarvelBibles()
if not texts:
Expand All @@ -1474,15 +1475,17 @@ def textFormattedChapter(self, command, source):
if text in marvelBibles:
fileItems = marvelBibles[text][0]
if os.path.isfile(os.path.join(*fileItems)):
content = self.textFormattedBible(verseList[0], text, source)
content = self.textFormattedBible(firstVerse, text, source, rawOutputChapter=True)
self.setMainVerse(text, firstVerse)
return ("main", content, {})
else:
databaseInfo = marvelBibles[text]
if self.parent is not None:
self.parent.downloadHelper(databaseInfo)
return ("", "", {})
else:
content = self.textFormattedBible(verseList[0], text, source)
content = self.textFormattedBible(firstVerse, text, source, rawOutputChapter=True)
self.setMainVerse(text, firstVerse)
return ("main", content, {})

# cmd:::
Expand Down Expand Up @@ -2581,7 +2584,8 @@ def distinctTranslation(self, command, source):
return ("study", display, {})

def getAllFavouriteBibles(self):
return sorted(set([config.mainText, config.favouriteBible, config.favouriteBible2, config.favouriteBible3, config.favouriteBiblePrivate, config.favouriteBiblePrivate2, config.favouriteBiblePrivate3]))
favouriteVersions = set([config.mainText, config.studyText, config.favouriteBible, config.favouriteBible2, config.favouriteBible3, config.favouriteBiblePrivate, config.favouriteBiblePrivate2, config.favouriteBiblePrivate3])
return self.getConfirmedTexts("_".join(favouriteVersions))

# COMPARE:::
def textCompare(self, command, source):
Expand Down

0 comments on commit 1f31b9a

Please sign in to comment.