Skip to content
Snippets Groups Projects
Commit 80d67cb2 authored by jkerdreu's avatar jkerdreu
Browse files

tty resizing can help

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@2285 b32b6428-25c9-4566-ad07-03861ab6144f
parent 66da88e2
Branches
No related tags found
No related merge requests found
......@@ -22,18 +22,19 @@ from xaal.lib import tools
from .ansi2 import term
import sys
import shutil
level = 0
#FORMAT = '%-8.08s=> %-10.10s %-36.36s (%-20.20s) %-18.18s %-45.45s'
FORMAT = '%-8.08s=> %-15.15s %-36.36s (%-20.20s) %-18.18s %-50.50s'
def display(msg):
term('yellow')
targets = [tools.reduce_addr(addr) for addr in msg.targets]
tmp = shutil.get_terminal_size()[0] - (8 + 15 + 36 + 20 + 16 + 9)
if tmp < 50:
tmp = 50
BODY_FORMAT = '%-50.'+str(tmp)+'s'
FORMAT = '%-8.08s=> %-15.15s %-36.36s (%-20.20s) %-16.16s '+BODY_FORMAT
res = FORMAT % (msg.msgtype,msg.action,msg.source,msg.devtype,targets,msg.body)
if msg.is_request():
......@@ -53,9 +54,6 @@ def display(msg):
print(res)
def usage():
print("%s : monitor xAAL network w/ tail format" % sys.argv[0])
print(" usage : %s log-level" % sys.argv[0])
......@@ -64,8 +62,6 @@ def usage():
print(" level=2 => hide reply messages")
print(" level=3 => only notifications (attributesChange)")
def main():
global level
if len(sys.argv) == 2:
......@@ -76,6 +72,7 @@ def main():
eng.start()
term('@@')
FORMAT = '%-8.08s=> %-15.15s %-36.36s (%-20.20s) %-16.16s %-50.50s'
print(FORMAT % ('msgType','action','source','devType','targets','body'))
try:
eng.run()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment