[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: 0.1.0.10-108-g50c3cfc

X2Go dev team git-admin at x2go.org
Sat Sep 14 15:55:44 CEST 2013


The branch, twofactorauth has been updated
       via  50c3cfccf4684baf9c57fff4b9d8fa3cd7285571 (commit)
      from  924ed9a645086b099c9d5e7a64bd60cd0e4d28f7 (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:
 pyhoca/wxgui/frontend.py      |   30 ++++++++++++++++++++----------
 pyhoca/wxgui/menus_taskbar.py |    6 ++++--
 2 files changed, 24 insertions(+), 12 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index ead1c1d..a86255e 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -361,7 +361,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
 
     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)
+        session_list = self._X2goClient__list_sessions(session_uuid=session_uuid, profile_name=profile_name, refresh_cache=True, update_sessionregistry=True)
 
         if profile_name is None and session_uuid:
             profile_name = self._X2goClient__get_session_profile_name(session_uuid)
@@ -375,19 +375,23 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
             if profile_name not in self._temp_launching_pubapp_profiles:
                 self._temp_launching_pubapp_profiles.append(profile_name)
 
-            pub_sessions = self._X2goClient__client_pubapp_sessions_of_profile_name(session_uuid, return_objects=True)
+            pubapp_sessions = self._X2goClient__client_pubapp_sessions_of_profile_name(profile_name, return_objects=True)
             pubapp_session_started = False
             pubapp_session_resumed = False
-            if not (pub_sessions and pub_sessions[0].is_running()):
-                for session_name in [_sn for _sn in session_list.keys() if session_list[_sn].status == 'S' ]:
+            pubapp_session_running = (len([ _pas for _pas in pubapp_sessions if _pas.is_running() ]) >= 1)
+            if not pubapp_session_running:
+                for session_name in [_sn for _sn in session_list.keys() if session_list[_sn].is_suspended() ]:
 
+                    print session_name
                     if session_list[session_name].is_published_applications_provider() and not pubapp_session_resumed:
+                        print "RESUME %s" % session_name
                         # resume sessions in published applications mode immediately
                         pubapp_session = self._X2goClient__register_session(profile_name=profile_name, published_applications=True, cmd='PUBLISHED', session_type='published', session_name=session_name, return_object=True)
                         pubapp_session.resume()
                         pubapp_session_resumed = True
                     elif session_list[session_name].is_published_applications_provider() and pubapp_session_resumed:
                         # if there are more then one (in suspended state, of course), terminate them now...
+                        print "TERMINATING %s" % session_name
                         self._X2goClient__get_session_of_session_name(session_name, return_object=True).terminate()
 
                 if not pubapp_session_resumed:
@@ -399,7 +403,8 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
             if profile_name in self._temp_launching_pubapp_profiles:
                 self._temp_launching_pubapp_profiles.remove(profile_name)
 
-            return pubapp_session_started and pubapp_session_resumed
+            print pubapp_session_started | pubapp_session_resumed
+            return pubapp_session_started | pubapp_session_resumed
 
         self.notifier.send(_(u'%s - server warning') % profile_name, _(u'The X2Go Server does not publish an application menu.'), icon='session_warning', timeout=10000)
         return None
@@ -409,6 +414,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         try:
 
             profile_name = self.get_session(session_uuid).get_profile_name()
+            self._hide_notifications_map[profile_name] = []
             if self._X2goClient__get_profile_config(profile_name)['published']:
                 if self.args.single_session_profile:
                     self._init_pubapp_session(session_uuid=session_uuid)
@@ -688,11 +694,15 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
 
         """
         self.current_profile_name = self._eventid_profilenames_map[evt.GetId()]
-        session_uuid = self._X2goClient__client_registered_sessions_of_profile_name(self.current_profile_name)[0]
-        # disconnect all profile sessions
-        if self._X2goClient__server_is_alive(session_uuid) and not self.args.single_session_profile:
-            self._X2goClient__disconnect_profile(self.current_profile_name)
-            self.notifier.send(_(u'%s - disconnect') % self.current_profile_name, _(u'X2Go Profile is now disconnected.'), icon='auth_disconnect', timeout=4000)
+        session_uuids = self._X2goClient__client_registered_sessions_of_profile_name(self.current_profile_name)
+        if session_uuids:
+
+            # disconnect all sessions of profile
+            if self._X2goClient__server_is_alive(session_uuids[0]) and not self.args.single_session_profile:
+                self._hide_notifications_map[self.current_profile_name] = self._X2goClient__client_running_sessions_of_profile_name(self.current_profile_name, return_session_names=True)
+
+        self._X2goClient__disconnect_profile(self.current_profile_name)
+        self.notifier.send(_(u'%s - disconnect') % self.current_profile_name, _(u'X2Go Profile is now disconnected.'), icon='auth_disconnect', timeout=4000)
         if self.exit_on_disconnect:
             self._pyhoca_logger('Exiting %s because %s got disconnected.' % (self.appname, self.current_profile_name), loglevel=x2go.loglevel_NOTICE)
             self.WakeUpIdle()
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index d5ef21f..4675976 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -501,6 +501,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
                     _pub_app_start_item = self.Append(id=ID_PUBAPPSESSIONSTART, text=_(u"Retrieving Application Menu..."))
                     _pub_app_start_item.Enable(False)
                 else:
+                    self._PyHocaGUI._eventid_profilenames_map[ID_PUBAPPSESSIONSTART] = profile_name
                     _pub_app_start_item = self.Append(id=ID_PUBAPPSESSIONSTART, text=_(u"Retrieve Application Menu"))
                 self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnPubAppSessionStart, id=ID_PUBAPPSESSIONSTART)
             else:
@@ -511,7 +512,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
 
             if current_profile_config['command'] == '' and current_profile_config['published']:
 
-                _pub_app_sessions = self._PyHocaGUI.client_pubapp_sessions_of_profile_name(profile_name, return_objects=True)
+                _pub_app_sessions = [ _pas for _pas in self._PyHocaGUI.client_pubapp_sessions_of_profile_name(profile_name, return_objects=True) if _pas.is_running() ]
                 if _pub_app_sessions:
                     _pub_app_session = _pub_app_sessions[0]
                     _pub_app_start_item.Enable(False)
@@ -549,6 +550,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
                     self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnSessionTerminate, id=ID_TERMINATESESSION)
 
             else:
+
                 # preparing profile_name information for the main PyHocaGUI instance
                 self._PyHocaGUI._eventid_profilenames_map[ID_LAUNCHAPPLICATION] = \
                     self._PyHocaGUI._eventid_profilenames_map[ID_CLEANSESSIONS] = profile_name
@@ -562,7 +564,7 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
                 if current_profile_config['published']:
 
                     _pub_app_session = None
-                    _pub_app_sessions = self._PyHocaGUI.client_pubapp_sessions_of_profile_name(profile_name, return_objects=True)
+                    _pub_app_sessions = [ _pas for _pas in self._PyHocaGUI.client_pubapp_sessions_of_profile_name(profile_name, return_objects=True) if _pas.is_running() ]
                     if _pub_app_sessions:
                         _pub_app_session = _pub_app_sessions[0]
                     if _pub_app_session and _pub_app_session.is_running():


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




More information about the x2go-commits mailing list