The branch, master has been updated via 1ea418ba168848ba287621c5ee27459ae2b4da63 (commit) from 39e5ef4fd88ebd1b076aa85ccf23ba3e7c0a9dd9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1ea418ba168848ba287621c5ee27459ae2b4da63 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Dec 14 12:05:52 2011 +0100 add __doc__ strings to new session_window functions in utils.py, make sure the Xlib.display is only initialized once on every call. ----------------------------------------------------------------------- Summary of changes: x2go/utils.py | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 6 deletions(-) The diff of changes is: diff --git a/x2go/utils.py b/x2go/utils.py index 3c042c7..dc74c57 100644 --- a/x2go/utils.py +++ b/x2go/utils.py @@ -470,7 +470,31 @@ def is_color_depth_ok(depth_session, depth_local): return False def set_session_window_title(session_name, title, timeout=0): + """\ + Modify a session window title. The current window title has to contain + the X2Go session ID to be identifiable. + + @param session_name: session name/ID of an X2Go session window + @type session_name: C{str} + @param title: the new session window title to be set + @type title: C{str} + @param timeout: try the title renaming for <timeout> sec at maximum + @type timeout: C{int} + + """ + # establish connection to the win API in use... + if _X2GOCLIENT_OS != 'Windows': + + display = Xlib.display.Display() + root = display.screen().root + else: + + # no MS Windows support yet + pass + + # search for the window of our focus, do this in a loop till the window as been found + # or timeout forces us to give up... timeout += 1 while timeout: @@ -479,9 +503,6 @@ def set_session_window_title(session_name, title, timeout=0): if _X2GOCLIENT_OS != 'Windows': - display = Xlib.display.Display() - root = display.screen().root - windowIDs = root.get_full_property(display.intern_atom('_NET_CLIENT_LIST'), Xlib.X.AnyPropertyType).value for windowID in windowIDs: window = display.create_resource_object('window', windowID) @@ -492,13 +513,38 @@ def set_session_window_title(session_name, title, timeout=0): display.sync() break + else: + # no MS Windows support yet + pass + if success: break gevent.sleep(1) def raise_session_window(session_name, timeout=0): + """\ + Bring a session window to foreground. + + @param session_name: session name/ID of an X2Go session window + @type session_name: C{str} + @param timeout: try the title renaming for <timeout> sec at maximum + @type timeout: C{int} + + """ + # establish connection to the win API in use... + if _X2GOCLIENT_OS != 'Windows': + + display = Xlib.display.Display() + root = display.screen().root + else: + + # no MS Windows support yet + pass + + # search for the window of our focus, do this in a loop till the window as been found + # or timeout forces us to give up... timeout += 1 while timeout: @@ -507,9 +553,6 @@ def raise_session_window(session_name, timeout=0): if _X2GOCLIENT_OS != 'Windows': - display = Xlib.display.Display() - root = display.screen().root - windowIDs = root.get_full_property(display.intern_atom('_NET_CLIENT_LIST'), Xlib.X.AnyPropertyType).value for windowID in windowIDs: window = display.create_resource_object('window', windowID) @@ -521,6 +564,10 @@ def raise_session_window(session_name, timeout=0): display.sync() break + else: + # no MS Windows support yet + pass + if success: break hooks/post-receive -- python-x2go.git (Python X2Go Client API) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "python-x2go.git" (Python X2Go Client API).