NeteaseMusicLyricDownloader/modules/utils/bar.py

19 lines
544 B
Python
Raw Normal View History

2023-04-18 00:44:01 +08:00
"""修改了进度条"""
2023-04-17 02:41:06 +08:00
from os import get_terminal_size
from progress.bar import Bar
2023-04-18 00:44:01 +08:00
from modules.utils.length import get_more_length
2023-04-17 02:41:06 +08:00
2023-04-18 00:44:01 +08:00
class CompactBar(Bar):
def print_onto_bar(self, message: str):
print()
self.update()
print(f"\x1b[1A\x1b[{get_terminal_size().columns}D{(get_terminal_size().columns-1) * ' '}"
f"\x1b[{get_terminal_size().columns}D"+message[:(get_terminal_size().columns - get_more_length(message))])
self.update()
def next_without_newline(self):
self.next()