From be11529ff79011f370ce2969dfa145dac81fbee3 Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 19 Jan 2022 00:02:08 +0000 Subject: added horizontal wavey bars --- src/util.py | 7 +++++-- src/xi.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/util.py b/src/util.py index 5ce93a9..928cb03 100644 --- a/src/util.py +++ b/src/util.py @@ -28,10 +28,13 @@ def is_root(): return os.environ.get("SUDO_UID") or os.geteuid() == 0 +def get_area(): + columns, rows = shutil.get_terminal_size((80, 20)) + def loading_bar(completed, total, text, unit="", color=DEFAULT_BAR_COLOR, reset=DEFAULT_BAR_COLOR_RESET): - columns, rows = shutil.get_terminal_size((80, 20)) + columns, rows = get_area() count = f"[{completed}{unit}/{total}{unit}]" @@ -44,7 +47,7 @@ def loading_bar(completed, total, text, print(color + info, end="\r") def fill_line(text, color, end="\n"): - columns, rows = shutil.get_terminal_size((80, 20)) + columns, rows = get_area() spaces = columns - (len(text)) print(color + text + "".join([" " for i in range(spaces)]), end=end) diff --git a/src/xi.py b/src/xi.py index 27d43c3..f0c473c 100644 --- a/src/xi.py +++ b/src/xi.py @@ -44,6 +44,7 @@ def print_stats(conf, opts): distro = util.get_distro()["NAME"] + print(colors.LIGHT_CYAN + ("~"*w) + colors.RESET) print(colors.LIGHT_CYAN + "xipkg", end="") print(colors.CYAN + " on ", end="") print(colors.LIGHT_CYAN + distro) @@ -53,7 +54,9 @@ def print_stats(conf, opts): for repo,count in pkg_count.items(): print(f"\t{colors.BLUE}{repo}: {colors.LIGHT_BLUE}{count}") - print(colors.RESET) + + w, h = util.get_area() + print(colors.LIGHT_CYAN + ("~"*w) + colors.RESET) def main(): -- cgit v1.2.1