The branch, master has been updated via 77b2ebabe63fbf410cae2138ce6f1f39924e83ea (commit) via 01200ab66a4cd89f3c03f2441c5a913d07e747a0 (commit) from 5476397b96ccec74885fd91b50b2bf4c05db1016 (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 77b2ebabe63fbf410cae2138ce6f1f39924e83ea Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Mar 20 16:03:42 2012 +0100 fix single session profile support commit 01200ab66a4cd89f3c03f2441c5a913d07e747a0 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Mar 20 15:38:02 2012 +0100 Auto-resuming and auto-starting of sessions, as well as auto-connecting to session profiles has been moved into Python X2Go. ----------------------------------------------------------------------- Summary of changes: debian/changelog | 2 + pyhoca/wxgui/frontend.py | 86 +++++++++++------------------------------ pyhoca/wxgui/menus_taskbar.py | 5 ++- 3 files changed, 29 insertions(+), 64 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index a2da9ad..67b0701 100644 --- a/debian/changelog +++ b/debian/changelog @@ -76,6 +76,8 @@ pyhoca-gui (0.1.2.0-0~x2go1) UNRELEASED; urgency=low - Fix for CUPS printer recognition if no default printer was defined. - Add widget to configure autologin and autostart session profile parameters. + - Auto-resuming and auto-starting of sessions, as well as auto-connecting + to session profiles has been moved into Python X2Go. * Depend on Python X2Go 0.1.2.0. * Install GNOME icons via dh_links. * Install X2Go icons with explicit install paths. diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py index e08c85f..df7a5cb 100644 --- a/pyhoca/wxgui/frontend.py +++ b/pyhoca/wxgui/frontend.py @@ -252,13 +252,8 @@ class PyHocaGUI(wx.App, x2go.X2goClient): self._pyhoca_logger('the current release of %s does not support client configuration' % self.appname, loglevel=x2go.log.loglevel_WARN) self.options_disabled = True - if self.args.auto_connect or self.args.single_session_profile: - gevent.spawn(self._auto_connect) - if self.args.session_profile: for profile_name in self.args.session_profile.split(','): - if not self._X2goClient__client_registered_sessions_of_profile_name(profile_name): - continue _dummy_id = wx.NewId() self._eventid_profilenames_map[_dummy_id] = profile_name evt = wx.CommandEvent() @@ -268,6 +263,10 @@ class PyHocaGUI(wx.App, x2go.X2goClient): self._pyhoca_logger('opening default session profile %s' % profile_name, loglevel=x2go.log.loglevel_NOTICE) self.OnSessionAuthenticate(evt) + if self.args.auto_connect or self.args.single_session_profile: + gevent.spawn(self._auto_connect) + + def _auto_connect(self): # wait for splash to appear @@ -275,18 +274,21 @@ class PyHocaGUI(wx.App, x2go.X2goClient): gevent.sleep(1) if not self.args.single_session_profile: self._X2goClient__register_all_session_profiles() - else: - self._X2goClient__register_session(profile_name=self.args.session_profile) - for session_uuid in self._X2goClient__client_registered_sessions(return_objects=False): - if self._X2goClient__session_can_auto_connect(session_uuid) or self.args.single_session_profile: - self._pyhoca_logger('auto-connecting to %s session profile' % self.get_session_profile_name(session_uuid), loglevel=x2go.log.loglevel_NOTICE) - # create a dummy event and call OnAuthenticate - _dummy_id = wx.NewId() - self._eventid_profilenames_map[_dummy_id] = self.get_session_profile_name(session_uuid) - evt = wx.CommandEvent() - evt.SetId(_dummy_id) - self.OnSessionAuthenticate(evt) + def session_auto_connect(self, session_uuid): + + # override X2goClient method + if self.args.auto_connect and self._X2goClient__session_can_auto_connect(session_uuid): + self._X2goClient__session_auto_connect(session_uuid) + + def session_auto_start_or_resume(self, session_uuid, newest=True, oldest=False, all_suspended=False): + + if self.resume_newest_on_connect: + self._X2goClient__session_auto_start_or_resume(session_uuid, newest=True, start=self.start_on_connect) + elif self.resume_oldest_on_connect: + self._X2goClient__session_auto_start_or_resume(session_uuid, oldest=True, start=self.start_on_connect) + elif self.resume_all_on_connect: + self._X2goClient__session_auto_start_or_resume(session_uuid, all_suspended=True, start=self.start_on_connect) # wx.App's OnExit method def OnExit(self): @@ -329,40 +331,6 @@ class PyHocaGUI(wx.App, x2go.X2goClient): self.WakeUpIdle() self.ExitMainLoop() - def _start_on_connect(self, evt, session_uuid): - if not self._X2goClient__list_sessions(session_uuid): - self._eventid_profilenames_map[evt.GetId()] = self._X2goClient__get_session_profile_name(session_uuid) - self.OnSessionStart(evt) - - def _resume_newest_on_connect(self, evt, session_uuid): - session_infos = self._X2goClient__list_sessions(session_uuid) - if session_infos: - newest_session_name = x2go.utils.session_names_by_timestamp(session_infos)[-1] - self._resume_on_connect(evt, session_uuid, newest_session_name) - return True - return False - - def _resume_oldest_on_connect(self, evt, session_uuid): - session_infos = self._X2goClient__list_sessions(session_uuid) - if session_infos: - newest_session_name = x2go.utils.session_names_by_timestamp(session_infos)[0] - self._resume_on_connect(evt, session_uuid, newest_session_name) - return True - return False - - def _resume_all_on_connect(self, evt, session_uuid): - session_infos = self._X2goClient__list_sessions(session_uuid) - if session_infos: - for session_name in session_infos.keys(): - self._resume_on_connect(evt, session_uuid, session_name) - return True - return False - - def _resume_on_connect(self, evt, session_uuid, session_name): - self._eventid_sessionnames_map[evt.GetId()] = session_name - self._eventid_profilenames_map[evt.GetId()] = self._X2goClient__get_session_profile_name(session_uuid) - self.OnSessionResume(evt) - def _init_pubapp_session(self, session_uuid=None, profile_name=None): session_list = self._X2goClient__list_sessions(session_uuid=session_uuid, profile_name=profile_name, refresh_cache=True, update_sessionregistry=True) @@ -434,17 +402,6 @@ class PyHocaGUI(wx.App, x2go.X2goClient): else: gevent.spawn(self._init_pubapp_session, session_uuid=session_uuid) - _resumed = False - - if self.resume_newest_on_connect: - _resumed = self._resume_newest_on_connect(evt, session_uuid) - elif self.resume_oldest_on_connect: - _resumed = self._resume_oldest_on_connect(evt, session_uuid) - elif self.resume_all_on_connect: - _resumed = self._resume_all_on_connect(evt, session_uuid) - if not _resumed and self.start_on_connect: - self._start_on_connect(evt, session_uuid) - except x2go.X2goSessionRegistryException: # there might have been a disconnect event inbetween... pass @@ -573,8 +530,11 @@ class PyHocaGUI(wx.App, x2go.X2goClient): self.current_profile_name = self._eventid_profilenames_map[evt.GetId()] self.taskbar.SetIconConnecting(self.current_profile_name) session_uuid = self._X2goClient__register_session(profile_name=self.current_profile_name) - self._temp_disabled_profile_names.append(self.current_profile_name) - gevent.spawn(self._do_authenticate, evt, session_uuid) + if session_uuid: + self._temp_disabled_profile_names.append(self.current_profile_name) + gevent.spawn(self._do_authenticate, evt, session_uuid) + elif self.args.session_profile: + self.notifier.send(_('Unknown Session Profile'), _(u'Unknown session profile %s') % self.current_profile_name, icon='profile_warning', timeout=10000) def OnSessionStart(self, evt): """\ diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py index 728d02a..d372be5 100644 --- a/pyhoca/wxgui/menus_taskbar.py +++ b/pyhoca/wxgui/menus_taskbar.py @@ -622,7 +622,10 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu): self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnServerDisconnect, id=ID_DISCONNECT) else: ID_EXIT = wx.NewId() - self.Append(id=ID_EXIT, text=_(u"Disconnect and E&xit")) + if self._PyHocaGUI.client_running_sessions_of_profile_name(profile_name=self._PyHocaGUI.args.session_profile): + self.Append(id=ID_EXIT, text=_(u"Suspend Sessions and E&xit")) + else: + self.Append(id=ID_EXIT, text=_(u"Disconnect and E&xit")) self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnTaskbarExit, id=ID_EXIT) self._PyHocaGUI.current_profile_name = profile_name hooks/post-receive -- pyhoca-gui.git (Python X2Go Client (wxPython GUI)) 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 "pyhoca-gui.git" (Python X2Go Client (wxPython GUI)).