aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenadha <benawiadha@gmail.com>2022-01-17 06:00:49 +0700
committerbenadha <benawiadha@gmail.com>2022-01-17 06:00:49 +0700
commit2e16bbf49c71324d4f0afbc2f3d7b82454d843cb (patch)
treeb1bc68a21cffd6b3463dc51569cb1c11528a1f37
parent68c3dd120a50ef38f4fca563bdc96674b0c8435a (diff)
downloadepy-2e16bbf49c71324d4f0afbc2f3d7b82454d843cb.tar.gz
Verbose loader
-rwxr-xr-xepy.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/epy.py b/epy.py
index 84d79ea..fe34f2f 100755
--- a/epy.py
+++ b/epy.py
@@ -2364,7 +2364,7 @@ class Reader:
self.is_color_supported = False
# show loader and start heavy resources processes
- self.show_loader()
+ self.show_loader(subtext="initalizing ebook")
# main ebook object
self.ebook = ebook
@@ -2499,10 +2499,13 @@ class Reader:
os.remove(path)
return k
- def show_loader(self):
+ def show_loader(self, *, loader_str: str = "\u231B", subtext: Optional[str] = None):
self.screen.clear()
rows, cols = self.screen.getmaxyx()
- self.screen.addstr((rows - 1) // 2, (cols - 1) // 2, "\u231B")
+ middle_row = (rows - 1) // 2
+ self.screen.addstr(middle_row, 0, loader_str.center(cols))
+ if subtext:
+ self.screen.addstr(middle_row + 1, 0, subtext.center(cols))
# self.screen.addstr(((rows-2)//2)+1, (cols-len(msg))//2, msg)
self.screen.refresh()
@@ -3073,6 +3076,7 @@ class Reader:
if self.spread == 2:
x = DoubleSpreadPadding.LEFT.value
+ self.show_loader(subtext="displaying contents")
# get text structure, toc entries and contents of the book
if self.seamless:
text_structure, toc_entries, contents = self.get_all_book_contents(reading_state)