summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/console
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/console')
-rwxr-xr-xscripts/automation/trex_control_plane/stl/console/trex_console.py14
-rw-r--r--scripts/automation/trex_control_plane/stl/console/trex_tui.py2
2 files changed, 11 insertions, 5 deletions
diff --git a/scripts/automation/trex_control_plane/stl/console/trex_console.py b/scripts/automation/trex_control_plane/stl/console/trex_console.py
index 2f6744cc..8c71065c 100755
--- a/scripts/automation/trex_control_plane/stl/console/trex_console.py
+++ b/scripts/automation/trex_control_plane/stl/console/trex_console.py
@@ -17,6 +17,7 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import print_function
+
import subprocess
import cmd
import json
@@ -67,20 +68,25 @@ class ConsoleLogger(LoggerApi):
def set_window_always_on_top (title):
# we need the GDK module, if not available - ignroe this command
try:
- import gtk.gdk
+ if sys.version_info < (3,0):
+ from gtk import gdk
+ else:
+ #from gi.repository import Gdk as gdk
+ return
+
except ImportError:
return
# search the window and set it as above
- root = gtk.gdk.get_default_root_window()
+ root = gdk.get_default_root_window()
for id in root.property_get('_NET_CLIENT_LIST')[2]:
- w = gtk.gdk.window_foreign_new(id)
+ w = gdk.window_foreign_new(id)
if w:
name = w.property_get('WM_NAME')[2]
if name == title:
w.set_keep_above(True)
- gtk.gdk.window_process_all_updates()
+ gdk.window_process_all_updates()
break
diff --git a/scripts/automation/trex_control_plane/stl/console/trex_tui.py b/scripts/automation/trex_control_plane/stl/console/trex_tui.py
index bd1eca74..88c53d10 100644
--- a/scripts/automation/trex_control_plane/stl/console/trex_tui.py
+++ b/scripts/automation/trex_control_plane/stl/console/trex_tui.py
@@ -409,7 +409,7 @@ class TrexTUI():
def handle_key_input (self):
# try to read a single key
- ch = os.read(sys.stdin.fileno(), 1)
+ ch = os.read(sys.stdin.fileno(), 1).decode()
if ch != None and len(ch) > 0:
return (self.pm.handle_key(ch), True)