Improved rncp progress status display

This commit is contained in:
Mark Qvist 2024-08-28 21:21:38 +02:00
parent 035a44e34d
commit 96527380c3

View File

@ -493,7 +493,8 @@ def fetch(configdir, verbosity = 0, quietness = 0, destination = None, file = No
if silent:
print(str(file_path)+" copied to "+RNS.prettyhexrep(destination_hash))
else:
print("\r \r"+str(file)+" fetched from "+RNS.prettyhexrep(destination_hash))
#print("\r \r"+str(file)+" fetched from "+RNS.prettyhexrep(destination_hash))
print("\n"+str(file)+" fetched from "+RNS.prettyhexrep(destination_hash))
link.teardown()
time.sleep(0.15)
exit(0)
@ -648,8 +649,7 @@ def send(configdir, verbosity = 0, quietness = 0, destination = None, file = Non
else:
print("\r \rTransferring file ", end=" ")
while not resource_done:
if not silent:
def progress_update(i):
time.sleep(0.1)
prg = current_resource.get_progress()
percent = round(prg * 100.0, 1)
@ -657,6 +657,11 @@ def send(configdir, verbosity = 0, quietness = 0, destination = None, file = Non
print("\r \rTransferring file "+syms[i]+" "+stat_str, end=" ")
sys.stdout.flush()
i = (i+1)%len(syms)
return i
while not resource_done:
if not silent:
i = progress_update(i)
if current_resource.status != RNS.Resource.COMPLETE:
if silent:
@ -668,7 +673,8 @@ def send(configdir, verbosity = 0, quietness = 0, destination = None, file = Non
if silent:
print(str(file_path)+" copied to "+RNS.prettyhexrep(destination_hash))
else:
print("\r \r"+str(file_path)+" copied to "+RNS.prettyhexrep(destination_hash))
# print("\r \r"+str(file_path)+" copied to "+RNS.prettyhexrep(destination_hash))
print("\n"+str(file_path)+" copied to "+RNS.prettyhexrep(destination_hash))
link.teardown()
time.sleep(0.25)
real_file.close()