From 25aa665b7e5a5e8747735aaaa5a00dba11b21067 Mon Sep 17 00:00:00 2001 From: imarom Date: Mon, 15 Aug 2016 15:33:51 +0300 Subject: TUI screen buffer --- .../trex_control_plane/stl/trex_stl_lib/utils/text_tables.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_tables.py') diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_tables.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_tables.py index 4b7e9b3e..393ba111 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_tables.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/text_tables.py @@ -1,7 +1,10 @@ +from __future__ import print_function + import sys from texttable import Texttable from .text_opts import format_text + class TRexTextTable(Texttable): def __init__(self): @@ -21,11 +24,11 @@ class TRexTextInfo(Texttable): def generate_trex_stats_table(): pass -def print_table_with_header(texttable_obj, header="", untouched_header=""): +def print_table_with_header(texttable_obj, header="", untouched_header="", buffer=sys.stdout): header = header.replace("_", " ").title() + untouched_header - print(format_text(header, 'cyan', 'underline') + "\n") + print(format_text(header, 'cyan', 'underline') + "\n", file=buffer) - print((texttable_obj.draw() + "\n")) + print((texttable_obj.draw() + "\n"), file=buffer) if __name__ == "__main__": pass -- cgit 1.2.3-korg