The branch, twofactorauth has been updated via 0294d5b5fdd1174f63271dab28f7149df8d8c891 (commit) from b4a9e5f4921f5713fb71acf692f1ae73ec843666 (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 | 2 ++ x2go/backends/terminal/_stdout.py | 60 ++++++++++++++++++++++++++++++------- x2go/defaults.py | 2 +- x2go/session.py | 2 +- x2go/utils.py | 6 ++++ 5 files changed, 59 insertions(+), 13 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 1ce0966..fc3d676 100644 --- a/debian/changelog +++ b/debian/changelog @@ -136,6 +136,8 @@ python-x2go (0.1.2.0-0~x2go1) UNRELEASED; urgency=low - Properly set setkbd value for x2gostartagent and x2goresume-session. - Fix local folder sharing when the master session changes during runtime. - Add support for re-registering sessions after session profile changes. + - Add new session profile parameter: ,,variant''. Add support to set the + keyboard layout _and_ the keyboard variant from the client-side. * Depend on python-xlib. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Sat, 28 Sep 2012 01:44:21 +0100 diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py index 1f256a7..91a7c8c 100644 --- a/x2go/backends/terminal/_stdout.py +++ b/x2go/backends/terminal/_stdout.py @@ -183,7 +183,7 @@ class X2goTerminalSessionSTDOUT(object): def __init__(self, control_session, session_info=None, geometry="800x600", depth=_local_color_depth, link="adsl", pack="16m-jpeg-9", cache_type="unix-kde", - keyboard='', kblayout='null', kbtype='null/null', + kbtype='null/null', kblayout='null', kbvariant='null', session_type="application", snd_system='pulse', snd_port=4713, cmd=None, published_applications=False, set_session_title=False, session_title="", applications=[], @@ -219,10 +219,12 @@ class X2goTerminalSessionSTDOUT(object): (class C{X2goProxyNX3}) this originally is the session name. With X2Go it defines the name of the NX cache directory. Best is to leave it untouched. @type cache_type: str - @param kblayout: keyboard layout, e.g. C{us} (default), C{de}, C{fr}, ... - @type kblayout: str @param kbtype: keyboard type, e.g. C{pc105/us} (default), C{pc105/de}, ... @type kbtype: str + @param kblayout: keyboard layout, e.g. C{us} (default), C{de}, C{fr}, ... + @type kblayout: str + @param kbvariant: keyboard variant, e.g. C{nodeadkeys} (for C{de} layout), C{intl} (for C{us} layout), etc. + @type kbvariant: str @param session_type: either C{desktop}, C{application} (rootless session) or C{shared} @type session_type: str @param snd_system: sound system to be used on server (C{none}, C{pulse} (default), @@ -285,9 +287,9 @@ class X2goTerminalSessionSTDOUT(object): self.params.pack = str(pack) self.params.cache_type = str(cache_type) self.params.session_type = str(session_type) - self.params.keyboard = str(keyboard) - self.params.kblayout = str(kblayout) self.params.kbtype = str(kbtype) + self.params.kblayout = str(kblayout) + self.params.kbvariant = str(kbvariant) self.params.snd_system = str(snd_system) self.params.cmd = str(cmd) self.params.depth = str(depth) @@ -1025,6 +1027,9 @@ class X2goTerminalSessionSTDOUT(object): (stdin, stdout, stderr) = self.control_session._x2go_exec_command(cmd_line) + 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) + return stdout.read(), stderr.read() def is_desktop_session(self): @@ -1051,6 +1056,39 @@ class X2goTerminalSessionSTDOUT(object): return self.session_info.is_published_applications_provider() return False + def set_keyboard(self, layout='null', variant='null'): + """\ + Set the keyboard layout and variant for this (running) session. + + @param layout: keyboard layout to be set + @type layout: C{str} + @param variant: keyboard variant to be set + @type variant: C{str} + + @return: returns C{True} if the {setxkbmap} command could be executed successfully. + @rtype: C{bool} + + """ + cmd_line = [ 'export DISPLAY=:%s && ' % str(self.session_info.display), + 'setxkbmap ' + ] + + if layout != 'null': + self.logger('setting keyboad layout ,,%s\'\' for session %s' % (layout, self.session_info), log.loglevel_INFO) + cmd_line.append('-layout %s' % layout) + if variant != 'null': + self.logger('setting keyboad variant ,,%s\'\' for session %s' % (variant, self.session_info), log.loglevel_INFO) + cmd_line.append('-variant %s' % variant) + + (stdin, stdout, stderr) = self.control_session._x2go_exec_command(cmd_line) + _stderr = stderr.read() + if not _stderr: + self.logger('setting keyboard layout ,,%s\'\' and variant ,,%s\'\' for session %s has been successful' % (layout, variant, self.session_info), log.loglevel_NOTICE) + return True + else: + self.logger('setting keyboard layout ,,%s\'\' and variant ,,%s\'\' for session %s failed: %s' % (layout, variant, self.session_info, _stderr.replace('\n', ' ')), log.loglevel_ERROR) + return False + def exec_published_application(self, exec_name, timeout=20, env={}): """\ Executed a published application. @@ -1146,7 +1184,7 @@ class X2goTerminalSessionSTDOUT(object): return False setkbd = "0" - if (self.params.kblayout != "null") or (self.params.kbtype != "null/null"): + if self.params.kbtype != "null/null": setkbd = "1" if '/' in self.params.cmd: @@ -1196,10 +1234,6 @@ class X2goTerminalSessionSTDOUT(object): self.session_info.name, ) - # let the proxy backend know that we want to define a very special keymap - if (self.params.kbtype.endswith('defkeymap') and self.params.kblayout == 'defkeymap'): - self.proxy_options.update({'defkeymap': True, }) - # set up SSH tunnel for X11 graphical elements self.proxy = self.proxy_backend(session_info=self.session_info, ssh_transport=self.control_session.get_transport(), @@ -1234,7 +1268,7 @@ class X2goTerminalSessionSTDOUT(object): """ setkbd = "0" - if (self.params.kblayout != "null") or (self.params.kbtype != "null/null"): + if self.params.kbtype != "null/null": setkbd = "1" cmd_line = [ "x2goresume-session", self.session_info.name, @@ -1290,9 +1324,13 @@ class X2goTerminalSessionSTDOUT(object): 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() + 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'): self.find_session_window() self.auto_session_window_title() diff --git a/x2go/defaults.py b/x2go/defaults.py index 8a12e23..a1da523 100644 --- a/x2go/defaults.py +++ b/x2go/defaults.py @@ -298,7 +298,7 @@ X2GO_SESSIONPROFILE_DEFAULTS = { 'usemimebox': False, 'mimeboxextensions': '', 'mimeboxaction': 'OPEN', 'fullscreen': False, 'width': 800,'height': 600,'dpi': 96,'setdpi': False, 'xinerama': False, 'multidisp': False, - 'usekbd': True, 'layout': 'us', 'type': 'pc105/us', + 'usekbd': True, 'layout': 'us', 'type': 'pc105/us', 'variant': '', 'sound': False, 'soundsystem': 'pulse', 'startsoundsystem': False, 'soundtunnel':True, 'defsndport':True, 'sndport':4713, 'name': 'NEW_PROFILE', 'icon': ':icons/128x128/x2gosession.png', 'host': '', 'user': CURRENT_LOCAL_USER, 'key': '', 'sshport': 22, 'krblogin': False, diff --git a/x2go/session.py b/x2go/session.py index 96c057f..26baeda 100644 --- a/x2go/session.py +++ b/x2go/session.py @@ -74,7 +74,7 @@ _X2GO_SESSION_PARAMS = ('use_sshproxy', 'profile_id', 'session_name', """A list of allowed X2Go pure session parameters (i.e. parameters that are passed on neither to an X2goControlSession, X2goSSHProxy nor an X2goControlSession object.""" # options of the paramiko.SSHClient().connect() method, any option that is allowed for a terminal session instance _X2GO_TERMINAL_PARAMS = ('geometry', 'depth', 'link', 'pack', - 'cache_type', 'kblayout', 'kbtype', + 'cache_type', 'kbtype', 'kblayout', 'kbvariant', 'session_type', 'snd_system', 'snd_port', 'cmd', 'set_session_title', 'session_title', 'rdp_server', 'rdp_options', 'applications', diff --git a/x2go/utils.py b/x2go/utils.py index 0333afe..99b4c13 100644 --- a/x2go/utils.py +++ b/x2go/utils.py @@ -144,6 +144,7 @@ def _convert_SessionProfileOptions_2_SessionParams(_options): 'sndport': 'snd_port', 'type': 'kbtype', 'layout': 'kblayout', + 'variant': 'kbvariant', 'speed': 'link', 'sshport': 'port', 'useexports': 'allow_share_local_folders', @@ -257,8 +258,13 @@ def _convert_SessionProfileOptions_2_SessionParams(_options): if not _options['usekbd']: _params['kbtype'] = 'null/null' _params['kblayout'] = 'null' + _params['kbvariant'] = 'null' del _params['usekbd'] + if not _params['kbtype'].strip(): _params['kbtype'] = 'null/null' + if not _params['kblayout'].strip(): _params['kblayout'] = 'null' + if not _params['kbvariant'].strip(): _params['kbvariant'] = 'null' + # currently known but ignored in Python X2go _ignored_options = [ 'dpi', 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).