Improved message transfer feedback

This commit is contained in:
Mark Qvist 2024-03-19 13:45:26 +01:00
parent bfcff07025
commit 17a6653068
1 changed files with 11 additions and 1 deletions

View File

@ -141,12 +141,22 @@ class Messages():
txstr = time.strftime(ts_format, time.localtime(msg["sent"])) txstr = time.strftime(ts_format, time.localtime(msg["sent"]))
titlestr = "" titlestr = ""
prgstr = "" prgstr = ""
sphrase = "Sending"
prg = self.app.sideband.get_lxm_progress(msg["hash"]) prg = self.app.sideband.get_lxm_progress(msg["hash"])
if prg != None: if prg != None:
prgstr = ", "+str(round(prg*100, 1))+"% done" prgstr = ", "+str(round(prg*100, 1))+"% done"
if prg <= 0.00:
sphrase = "Waiting for path"
elif prg <= 0.03:
sphrase = "Establishing link"
elif prg <= 0.05:
sphrase = "Link established"
elif prg >= 0.05:
sphrase = "Sending"
if msg["title"]: if msg["title"]:
titlestr = "[b]Title[/b] "+msg["title"].decode("utf-8")+"\n" titlestr = "[b]Title[/b] "+msg["title"].decode("utf-8")+"\n"
w.heading = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Sending"+prgstr+" " w.heading = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] "+sphrase+prgstr+" "
m["state"] = msg["state"] m["state"] = msg["state"]
if msg["state"] == LXMF.LXMessage.DELIVERED: if msg["state"] == LXMF.LXMessage.DELIVERED: