[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: 0.0.30.1-74-g864aae7

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


The branch, twofactorauth has been updated
       via  864aae75196136c95ba296d97ab80220a4b3243c (commit)
      from  8239ce836ad58d7b0bf482a4200487324f5f6f31 (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      |   23 +++++++++++++++++++++++
 pyhoca/wxgui/menus_taskbar.py |   10 ++++++----
 2 files changed, 29 insertions(+), 4 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index f8c2370..0258223 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -201,6 +201,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         self._eventid_profilenames_map = {}
         self._eventid_sessionnames_map = {}
         self._temp_disabled_profile_names = []
+        self._temp_disabled_session_names = {}
 
         # We register one session per available session profile.
         # These registered sessions will be used to access the profile's 
@@ -388,6 +389,17 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
             gevent.spawn(self._X2goClient__start_session, session_uuid)
             _dummy = self._X2goClient__list_sessions(session_uuid, refresh_cache=True)
 
+    def _disable_session_name(self, profile_name, session_name):
+        if profile_name not in self._temp_disabled_session_names.keys():
+            self._temp_disabled_session_names[profile_name] = []
+        self._temp_disabled_session_names[profile_name].append(session_name)
+
+    def _enable_session_name(self, profile_name, session_name):
+        try:
+            self._temp_disabled_session_names[profile_name].remove(session_name)
+        except (KeyError, ValueError):
+            pass
+
     def OnSessionResume(self, evt):
         """\
         STILL UNDOCUMENTED
@@ -396,6 +408,7 @@ 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]
         session_name = self._eventid_sessionnames_map[evt.GetId()]
+        self._disable_session_name(self.current_profile_name, session_name)
         if self._X2goClient__server_is_alive(session_uuid):
             gevent.spawn(self._X2goClient__resume_session, session_name=session_name)
             _dummy = self._X2goClient__list_sessions(session_uuid, refresh_cache=True)
@@ -409,6 +422,7 @@ 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]
         session_name = self._eventid_sessionnames_map[evt.GetId()]
+        self._disable_session_name(self.current_profile_name, session_name)
         gevent.spawn(self._X2goClient__suspend_session, session_uuid, session_name=session_name)
         self._eventid_sessionnames_map = {}
 
@@ -420,6 +434,7 @@ 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]
         session_name = self._eventid_sessionnames_map[evt.GetId()]
+        self._disable_session_name(self.current_profile_name, session_name)
         gevent.spawn(self._X2goClient__terminate_session, session_uuid, session_name=session_name)
         self._eventid_sessionnames_map = {}
 
@@ -438,6 +453,7 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
                 for session_name in session_names:
                     _notify_text += '\n%s' % session_name
                     self._hide_notifications_map[self.current_profile_name].append(session_name)
+                    self._disable_session_name(self.current_profile_name, session_name)
                 self.notifier.send(self.current_profile_name, _notify_text, icon='session_cleanall', timeout=10000)
             gevent.spawn(self._X2goClient__clean_sessions, session_uuid)
 
@@ -628,24 +644,31 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
             self.notifier.send(_(u'%s - print error') % profile_name, _(u'%s\n...caused by session\n%s')  % (err_msg, session_name), icon='session_error', timeout=5000)
 
     def HOOK_on_session_has_started_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self._enable_session_name(profile_name, session_name)
         self.notifier.send(_(u'%s - start') % profile_name, _(u'New X2go session starting up...\n%s') % session_name, icon='session_start', timeout=5000)
 
     def HOOK_on_session_has_started_by_other(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self._enable_session_name(profile_name, session_name)
         self.notifier.send(_(u'%s - start') % profile_name, _(u'Another client started X2go session\n%s') % session_name, icon='session_start', timeout=5000)
 
     def HOOK_on_session_has_resumed_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self._enable_session_name(profile_name, session_name)
         self.notifier.send(_(u'%s - resume') % profile_name, _(u'Resuming X2go session...\n%s') % session_name, icon='session_resume', timeout=5000)
 
     def HOOK_on_session_has_resumed_by_other(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self._enable_session_name(profile_name, session_name)
         self.notifier.send(_(u'%s - resume') % profile_name, _(u'Another client resumed X2go session\n%s') % session_name, icon='session_resume', timeout=5000)
 
     def HOOK_on_found_session_running_after_connect(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self._enable_session_name(profile_name, session_name)
         gevent.spawn_later(5, self.notifier.send, _(u'%s - running') % profile_name, _(u'Found already running session\n%s') %  session_name, icon='session_resume', timeout=5000)
 
     def HOOK_on_session_has_been_suspended(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self._enable_session_name(profile_name, session_name)
         self.notifier.send(_(u'%s - suspend') % profile_name, _(u'X2go Session has been suspended\n%s') % session_name, icon='session_suspend', timeout=5000)
 
     def HOOK_on_session_has_terminated(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self._enable_session_name(profile_name, session_name)
         # avoid notification if X2goClient.clean_sessions has been used to terminate sessions
         if self._hide_notifications_map.has_key(profile_name) and session_name in self._hide_notifications_map[profile_name]:
             self._hide_notifications_map[profile_name].remove(session_name)
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index d0df21e..b833e8c 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
@@ -195,12 +195,12 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
         _query_session_uuid = self._PyHocaGUI.client_connected_sessions_of_profile_name(profile_name, return_objects=False)[0]
         _session_list = self._PyHocaGUI.list_sessions(_query_session_uuid)
 
-        # newest sessions at the top
-        _session_list.reverse()
-
         if _session_list:
 
-            for session_name in _session_list.keys():
+            # newest sessions at the top
+            _session_list_names = _session_list.keys()
+            _session_list_names.reverse()
+            for session_name in _session_list_names:
 
                 _s_id = wx.NewId()
 
@@ -215,6 +215,8 @@ class PyHocaGUI_Menu_TaskbarSessionProfile(wx.Menu):
                                                                                                status=_session_list[session_name].status,
                                                                                               )
                                                  )
+                if self._PyHocaGUI._temp_disabled_session_names.has_key(profile_name) and session_name in self._PyHocaGUI._temp_disabled_session_names[profile_name]:
+                    session_submenu.Enable(False)
 
         if _session_list.keys():
             self.Append(id=ID_CLEANSESSIONS, text=_(u"&Clean all sessions"))


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