diff options
author | wustho <benawiadha@gmail.com> | 2020-09-25 07:15:13 +0700 |
---|---|---|
committer | wustho <benawiadha@gmail.com> | 2020-09-25 07:15:13 +0700 |
commit | 858bd4e6cce2bd7b3efa9ee4cc5241f7475b4086 (patch) | |
tree | f1f17ef6c2db824ec9db79538b6ce52a369cbfa0 /epy.py | |
parent | cfdeec30a9684efaae3849f39f5a8ee7c3a1b47e (diff) | |
download | epy-858bd4e6cce2bd7b3efa9ee4cc5241f7475b4086.tar.gz |
Add loader.
Diffstat (limited to 'epy.py')
-rwxr-xr-x | epy.py | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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() |