pygui: changes to display both link and asym link options on edges in canvas

This commit is contained in:
Blake Harnden 2020-08-02 10:03:21 -07:00
parent 06563d5953
commit 2aeb119b04
2 changed files with 42 additions and 16 deletions

View file

@ -1,3 +1,6 @@
from typing import Optional
def bandwidth_text(bandwidth: int) -> str:
size = {0: "bps", 1: "Kbps", 2: "Mbps", 3: "Gbps"}
unit = 1000
@ -8,3 +11,12 @@ def bandwidth_text(bandwidth: int) -> str:
if i == 3:
break
return f"{bandwidth} {size[i]}"
def delay_jitter_text(delay: int, jitter: int) -> Optional[str]:
line = None
if delay > 0 and jitter > 0:
line = f"{delay} us (\u00B1{jitter} us)"
elif jitter > 0:
line = f"0 us (\u00B1{jitter} us)"
return line