[X2Go-Commits] python-x2go.git - brokerclient (branch) updated: 0.1.0.3-52-ga27899e

X2Go dev team git-admin at x2go.org
Tue Jan 7 16:20:45 CET 2014


The branch, brokerclient has been updated
       via  a27899e1b0669f46a6d9522ab52ebdf7a05a17c7 (commit)
      from  f684138dba366d5906d10dbdeb049607af66b296 (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 -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                  |    1 +
 x2go/backends/terminal/_stdout.py |   12 ++++++++++++
 x2go/session.py                   |   14 ++++++++++++++
 x2go/utils.py                     |   22 ++++++++++++++++++++++
 4 files changed, 49 insertions(+)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 5665d64..110827c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,7 @@ python-x2go (0.1.1.0-0~x2go1) UNRELEASED; urgency=low
     - Faulty sessions (without a NX proxy fw tunnel) will get terminated whenever
       the X2go server (SSHd) denies the tunnel setup.
     - Detect local color depth and use it as default for new sessions.
+    - Add compatibility check methods for color depth.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Thu, 23 Jun 2011 08:34:14 +0200
 
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index 018de14..4c439fd 100644
--- a/x2go/backends/terminal/_stdout.py
+++ b/x2go/backends/terminal/_stdout.py
@@ -675,6 +675,16 @@ class X2goTerminalSessionSTDOUT(object):
         (stdin, stdout, stderr) = self.control_session._x2go_exec_command(cmd_line)
         self.logger('x2gomountdirs output is : %s' % stdout.read().split('\n'), log.loglevel_NOTICE)
 
+    def color_depth(self):
+        """\
+        Retrieve the session's color depth.
+
+        @return: the session's color depth
+        @rtype: C{int}
+
+        """
+        return self.params.depth
+
     def has_command(self, cmd):
         """\
         Verify if the command <cmd> exists on the X2go server.
@@ -910,6 +920,7 @@ class X2goTerminalSessionSTDOUT(object):
         self.session_info.remote_container = '%s/.x2go/C-%s' % (self.control_session._x2go_remote_home, 
                                                                 self.session_info.name,
                                                                )
+        self.params.depth = self.session_info.name.split('_')[2][2:]
         # on a session resume the user name comes in as a user ID. We have to translate this...
         self.session_info.username = self.control_session.remote_username()
         return self.ok()
@@ -952,3 +963,4 @@ class X2goTerminalSessionSTDOUT(object):
 
         """
         self.proxy.__del__()
+
diff --git a/x2go/session.py b/x2go/session.py
index 37283b1..0a53ad7 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -1204,6 +1204,20 @@ class X2goSession(object):
         return False
     __session_ok = session_ok
 
+    def is_color_depth_ok(self):
+        """\
+        Check if this session will display properly with the local screen's color depth.
+
+        @return: C{True} if the session will display on this client screen, False otherwise.
+            If no terminal session is yet registered with this session, C{None} is returned.
+        @rtype C{bool}
+
+        """
+        if self.has_terminal_session():
+            return utils.is_color_depth_ok(depth_session=self.terminal_session.color_depth(), depth_local=utils.local_color_depth())
+        else:
+            return None
+
     def is_connected(self):
         """\
         Test if the L{X2goSession}'s control session is connected to the 
diff --git a/x2go/utils.py b/x2go/utils.py
index 3dde3db..089706a 100644
--- a/x2go/utils.py
+++ b/x2go/utils.py
@@ -411,3 +411,25 @@ def local_color_depth():
         return int(_depth)
     else:
         return win32api.GetSystemMetrics(2)
+
+def is_color_depth_ok(depth_session, depth_local):
+    """\
+    Test if color depth of this session is compatible with the
+    local screen's color depth.
+
+    @param depth_session: color depth of the session
+    @type depth_session: C{int}
+    @param depth_local: color depth of local screen
+    @type depth_local: C{int}
+
+    @return: Does the session color depth work with the local display?
+    @rtype: C{bool}
+
+    """
+    if depth_session == 0:
+        return True
+    if depth_session == depth_local:
+        return True
+    if ( ( depth_session == 24 or depth_session == 32 ) and ( depth_local == 24 or depth_local == 32 ) ):
+        return true;
+    return False


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).




More information about the x2go-commits mailing list