aboutsummaryrefslogtreecommitdiffstats
path: root/epy.py
diff options
context:
space:
mode:
authorwustho <benawiadha@gmail.com>2020-09-25 07:15:13 +0700
committerwustho <benawiadha@gmail.com>2020-09-25 07:15:13 +0700
commit858bd4e6cce2bd7b3efa9ee4cc5241f7475b4086 (patch)
treef1f17ef6c2db824ec9db79538b6ce52a369cbfa0 /epy.py
parentcfdeec30a9684efaae3849f39f5a8ee7c3a1b47e (diff)
downloadepy-858bd4e6cce2bd7b3efa9ee4cc5241f7475b4086.tar.gz
Add loader.
Diffstat (limited to 'epy.py')
-rwxr-xr-xepy.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/epy.py b/epy.py
index 4937029..ee27eb2 100755
--- a/epy.py
+++ b/epy.py
@@ -14,7 +14,7 @@ Options:
"""
-__version__ = "2020.9.24"
+__version__ = "2020.9.25"
__license__ = "GPL-3.0"
__author__ = "Benawi Adha"
__url__ = "https://github.com/wustho/epy"
@@ -791,6 +791,14 @@ def choice_win(allowdel=False):
return inner_f
+def show_loader(scr, msg="Loading"):
+ scr.clear()
+ rows, cols = scr.getmaxyx()
+ scr.addstr((rows-2)//2, (cols-1)//2, "\u231B")
+ scr.addstr(((rows-2)//2)+1, (cols-len(msg))//2, msg)
+ scr.refresh()
+
+
def loadstate():
global CFG, STATE, CFGFILE, STATEFILE
prefix = ""
@@ -1724,8 +1732,7 @@ def preread(stdscr, file):
curses.curs_set(0)
SCREEN.clear()
rows, cols = SCREEN.getmaxyx()
- SCREEN.addstr(rows-1, 0, "Loading...")
- SCREEN.refresh()
+ show_loader(SCREEN)
ebook = det_ebook_cls(file)
@@ -1762,6 +1769,7 @@ def preread(stdscr, file):
ebook, idx, width, y, pctg, sec
)
idx += incr
+ show_loader(SCREEN)
finally:
ebook.cleanup()