mirror of
https://github.com/frozenpandaman/s3s.git
synced 2026-07-31 07:06:14 -05:00
add shutil instad of os libary for get_terminal_size()& code merges
This commit is contained in:
parent
709a067445
commit
f663ff01e7
26
s3s.py
26
s3s.py
|
|
@ -1004,17 +1004,23 @@ def monitor_battles(which, secs, isblackout, istestrun):
|
|||
print("Bye!")
|
||||
|
||||
class SquidProgress:
|
||||
def __init__(self):
|
||||
self.count = 0
|
||||
'''Display animation while waiting.'''
|
||||
|
||||
def __call__(self):
|
||||
lineend = shutil.get_terminal_size()[0] - 4
|
||||
ika = '>=> ' if self.count % 2 == 0 else '===>'
|
||||
sys.stdout.write(f"\r{' '*self.count}{ika}{' '*(lineend - self.count)}")
|
||||
sys.stdout.flush()
|
||||
self.count += 1
|
||||
if self.count > lineend:
|
||||
self.count = 0
|
||||
def __init__(self):
|
||||
self.count = 0
|
||||
|
||||
def __call__(self):
|
||||
lineend = shutil.get_terminal_size()[0] - 5 # 5 = ('>=> ' or '===>') + blank 1
|
||||
ika = '>=> ' if self.count % 2 == 0 else '===>'
|
||||
sys.stdout.write(f"\r{' '*self.count}{ika}{' '*(lineend - self.count)}")
|
||||
sys.stdout.flush()
|
||||
self.count += 1
|
||||
if self.count > lineend:
|
||||
self.count = 0
|
||||
|
||||
def __del__(self):
|
||||
sys.stdout.write(f"\r{' '*(os.get_terminal_size()[0] - 1)}\r")
|
||||
sys.stdout.flush()
|
||||
|
||||
def main():
|
||||
'''Main process, including I/O and setup.'''
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user