mirror of
https://github.com/markqvist/Sideband.git
synced 2025-07-22 22:40:53 -04:00
Added transfer speed to outgoing message status
This commit is contained in:
parent
55bf57d0ab
commit
09f6d4bd98
1 changed files with 18 additions and 1 deletions
|
@ -319,6 +319,19 @@ class Messages():
|
||||||
prgstr = ""
|
prgstr = ""
|
||||||
sphrase = "Sending"
|
sphrase = "Sending"
|
||||||
prg = self.app.sideband.get_lxm_progress(msg["hash"])
|
prg = self.app.sideband.get_lxm_progress(msg["hash"])
|
||||||
|
if not hasattr(w, "last_prg_update"):
|
||||||
|
w.last_prg_update = time.time()
|
||||||
|
w.last_prg = prg
|
||||||
|
speed = None
|
||||||
|
else:
|
||||||
|
now = time.time()
|
||||||
|
size = msg["lxm"].packed_size
|
||||||
|
td = now - w.last_prg_update
|
||||||
|
if td == 0: speed = None
|
||||||
|
else:
|
||||||
|
bd = prg*size - w.last_prg*size
|
||||||
|
speed = (bd/td)*8
|
||||||
|
|
||||||
if prg != None:
|
if prg != None:
|
||||||
prgstr = ", "+str(round(prg*100, 1))+"% done"
|
prgstr = ", "+str(round(prg*100, 1))+"% done"
|
||||||
if prg <= 0.00:
|
if prg <= 0.00:
|
||||||
|
@ -336,6 +349,7 @@ class Messages():
|
||||||
sphrase = "Link established"
|
sphrase = "Link established"
|
||||||
elif prg >= 0.05:
|
elif prg >= 0.05:
|
||||||
sphrase = "Sending"
|
sphrase = "Sending"
|
||||||
|
if speed != None: prgstr += f", {RNS.prettyspeed(speed)}"
|
||||||
|
|
||||||
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"
|
||||||
|
@ -1450,7 +1464,10 @@ Builder.load_string("""
|
||||||
id: heading_text
|
id: heading_text
|
||||||
markup: True
|
markup: True
|
||||||
text: root.heading
|
text: root.heading
|
||||||
adaptive_size: True
|
size_hint_y: None
|
||||||
|
height: self.texture_size[1]
|
||||||
|
# adaptive_size: True
|
||||||
|
|
||||||
# theme_text_color: 'Custom'
|
# theme_text_color: 'Custom'
|
||||||
# text_color: rgba(255,255,255,100)
|
# text_color: rgba(255,255,255,100)
|
||||||
pos: 0, root.height - (self.height + root.padding[0] + dp(8))
|
pos: 0, root.height - (self.height + root.padding[0] + dp(8))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue