[X2Go-Commits] [python-x2go] 06/09: X2GoTerminalSession: Fully delegate the session type handling and remembering to the session's X2GoSessionInfo object.
git-admin at x2go.org
git-admin at x2go.org
Fri Jul 19 19:42:45 CEST 2019
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository python-x2go.
commit 208a084e47ac1a9ed48fb0b9fcb930de8703eaf8
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Fri Jul 19 17:31:28 2019 +0200
X2GoTerminalSession: Fully delegate the session type handling and remembering to the session's X2GoSessionInfo object.
---
debian/changelog | 2 ++
x2go/backends/terminal/plain.py | 42 ++++++++++++++++++++++++-----------------
2 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 33adf8f..88e7159 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ python-x2go (0.6.0.3-0x2go1) UNRELEASED; urgency=medium
- X2GoSessionInfo: Cache virtually immutable session type.
- X2GoSessionInfo: Add is_initialized() method.
- X2GoTerminalSession: Fix __doc__ string of constructor.
+ - X2GoTerminalSession: Fully delegate the session type handling
+ and remembering to the session's X2GoSessionInfo object.
-- X2Go Release Manager <git-admin at x2go.org> Sat, 01 Dec 2018 02:16:45 +0100
diff --git a/x2go/backends/terminal/plain.py b/x2go/backends/terminal/plain.py
index fc9fbe6..697864b 100644
--- a/x2go/backends/terminal/plain.py
+++ b/x2go/backends/terminal/plain.py
@@ -261,7 +261,8 @@ class X2GoTerminalSession(object):
:type clipboard: ``str``
:param xinerama: enable/disable Xinerama support in remote X2Go session
:type xinerama: ``bool``
- :param session_type: either ``desktop``, ``application`` (rootless session) or ``shared``
+ :param session_type: either ``desktop``, ``application`` (rootless session) or ``shared`` (only set for new sessions,
+ ignored for to-be-resumed sessions)
:type session_type: ``str``
:param snd_system: sound system to be used on server (``none``, ``pulse`` (default),
``arts`` (obsolete) or ``esd``)
@@ -532,7 +533,9 @@ class X2GoTerminalSession(object):
def get_session_type(self):
"""\
- Retrieve the X2Go session's session type as stored in the session parameter object.
+ Retrieve the X2Go session's session type as stored either in the parameter
+ object (for sessions not yet launched) or in the ``session_info`` object (for
+ already launched / to-be-resumed sessions).
:returns: the session type
@@ -540,7 +543,10 @@ class X2GoTerminalSession(object):
:rtype: ``str``
"""
- return self.params.session_type
+ if self.session_info.is_initialized():
+ return self.session_info.get_session_type()
+ else:
+ return self.params.session_type
def start_sound(self):
"""\
@@ -1080,7 +1086,7 @@ class X2GoTerminalSession(object):
# no blanks at beginning or end, no blanks-only...
self.session_title = self.session_title.strip()
- if self.params.session_type == 'D':
+ if self.get_session_type() == 'D':
if self.set_session_title:
if not self.session_title:
@@ -1090,7 +1096,7 @@ class X2GoTerminalSession(object):
# session title fallback... (like X2Go server does it...)
self.session_title = _generic_title
- elif self.params.session_type == 'S':
+ elif self.get_session_type() == 'S':
if self.set_session_title:
shared_user = _generic_title.split('XSHAD')[1]
@@ -1345,7 +1351,7 @@ class X2GoTerminalSession(object):
str(self.session_info.snd_port),
_rewrite_blanks(_rewrite_cmd(cmd, params=self.params)),
str(self.params.snd_system),
- str(self.params.session_type),
+ str(self.get_session_type()),
"1>/dev/null 2>/dev/null & exit",
]
@@ -1564,10 +1570,10 @@ class X2GoTerminalSession(object):
str(self.params.kblayout),
str(self.params.kbtype),
str(setkbd),
- str(self.params.session_type),
+ str(self.get_session_type()),
str(self.params.cmd),
]
- if self.params.session_type != 'S':
+ if self.get_session_type() != 'S':
cmd_line.append(
str(self.params.clipboard),
)
@@ -1626,7 +1632,7 @@ class X2GoTerminalSession(object):
if proxy_ok:
self.active_threads.append(self.proxy)
- if self.params.session_type in ('D', 'S'):
+ if self.get_session_type() in ('D', 'S'):
self.find_session_window()
self.auto_session_window_title()
self.raise_session_window()
@@ -1731,7 +1737,7 @@ class X2GoTerminalSession(object):
if self.params.kbtype not in ('null/null', 'auto') and (self.params.kblayout not in ('null', '') or self.params.kbvariant not in ('null', '')):
self.set_keyboard(layout=self.params.kblayout, variant=self.params.kbvariant)
- if self.params.session_type in ('D', 'S'):
+ if self.get_session_type() in ('D', 'S'):
self.find_session_window()
self.auto_session_window_title()
self.raise_session_window()
@@ -1836,8 +1842,9 @@ class X2GoTerminalSession(object):
:rtype: ``bool``
"""
- self.params.rewrite_session_type()
- return self.params.session_type == 'R'
+ if not self.session_info.is_initialized():
+ self.params.rewrite_session_type()
+ return self.get_session_type() == 'R'
def is_shadow_session(self):
"""\
@@ -1849,8 +1856,9 @@ class X2GoTerminalSession(object):
:rtype: ``bool``
"""
- self.params.rewrite_session_type()
- return self.params.session_type == 'S'
+ if not self.session_info.is_initialized():
+ self.params.rewrite_session_type()
+ return self.get_session_type() == 'S'
def is_pubapp_session(self):
"""\
@@ -1862,6 +1870,6 @@ class X2GoTerminalSession(object):
:rtype: ``bool``
"""
- self.params.rewrite_session_type()
- return self.params.session_type == 'P'
-
+ if not self.session_info.is_initialized():
+ self.params.rewrite_session_type()
+ return self.get_session_type() == 'P'
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/python-x2go.git
More information about the x2go-commits
mailing list