summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/console/trex_console.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-03-23 16:11:53 +0200
committerimarom <imarom@cisco.com>2016-03-23 16:11:53 +0200
commit709eda3b4ea0385da009932df3eba457e955e887 (patch)
tree6dc28821bdd3089be9cf837400fc12ff10f66992 /scripts/automation/trex_control_plane/stl/console/trex_console.py
parente9ab260a5fa47604406e1e9432d0036dc8fd9928 (diff)
moving us to python 3 by default (console)
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/console/trex_console.py')
-rwxr-xr-xscripts/automation/trex_control_plane/stl/console/trex_console.py14
1 files changed, 10 insertions, 4 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