[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: 64e0edf77904253dfeb00a188b6696e7a3f4d3ff

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


The branch, twofactorauth has been updated
       via  64e0edf77904253dfeb00a188b6696e7a3f4d3ff (commit)
      from  3709ceac2e9a269cd6139031ddae5ea25420c367 (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 |   62 +++++++++++++++++++++++++++++++---------------
 pyhoca/wxgui/notify.py   |    2 ++
 2 files changed, 44 insertions(+), 20 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index b72aeee..536adfc 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -279,8 +279,14 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         self.current_profile_name = self._eventid_profilenames_map[evt.GetId()]
         _query_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0]
         session_uuid = self._X2goClient__register_session(profile_name=self.current_profile_name)
-        gevent.spawn(self._X2goClient__start_session, session_uuid)
-        self.notifier.send(self.current_profile_name, 'New X2go session starting up...', icon='session_start', timeout=10000)
+        if self._X2goClient__server_is_alive(session_uuid):
+            if self._X2goClient__server_is_x2gouser(session_uuid):
+                gevent.spawn(self._X2goClient__start_session, session_uuid)
+                self.notifier.send(self.current_profile_name, 'New X2go session starting up...', icon='session_start', timeout=10000)
+            else:
+                self.notifier.send(self.current_profile_name, 'User is not allowed to start X2go sessions!', icon='session_warning_', timeout=10000)
+        else:
+            self.notifier.send(self.current_profile_name, 'Paramiko/SSH session has died! Try to re-connect to the server.', icon='session_error', timeout=10000)
 
 
     def OnSessionResume(self, evt):
@@ -292,10 +298,14 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         _control_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0]
         session_uuid = _control_session.get_uuid()
         session_name = self._eventid_sessionnames_map[evt.GetId()]
-        gevent.spawn(self._X2goClient__resume_session, session_uuid, session_name=session_name)
-        self.notifier.send(self.current_profile_name, 'Resuming X2go session...\nSession: %s' % session_name, icon='session_resume', timeout=10000)
+        if self._X2goClient__server_is_alive(session_uuid):
+            gevent.spawn(self._X2goClient__resume_session, session_uuid, session_name=session_name)
+            self.notifier.send(self.current_profile_name, 'Resuming X2go session...\nSession: %s' % session_name, icon='session_resume', timeout=10000)
+        else:
+            self.notifier.send(self.current_profile_name, 'Paramiko/SSH session has died! Try to re-connect to the server.', icon='session_error', timeout=10000)
         self._eventid_sessionnames_map = {}
 
+
     def OnSessionSuspend(self, evt):
         """\
         STILL UNDOCUMENTED
@@ -307,9 +317,11 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         session_name = self._eventid_sessionnames_map[evt.GetId()]
         gevent.spawn(self._X2goClient__suspend_session, session_uuid, session_name=session_name)
         gevent.sleep(2)
-        if self._X2goClient__is_session_suspended(session_uuid, session_name):
-            self.notifier.send(self.current_profile_name, 'X2go session has been suspended.\nSession: %s' % session_name, icon='session_suspend', timeout=8000)
-
+        if self._X2goClient__server_is_alive(session_uuid):
+            if self._X2goClient__is_session_suspended(session_uuid, session_name):
+                self.notifier.send(self.current_profile_name, 'X2go session has been suspended.\nSession: %s' % session_name, icon='session_suspend', timeout=8000)
+        else:
+            self.notifier.send(self.current_profile_name, 'Paramiko/SSH transport session has died!', icon='session_error', timeout=10000)
         self._eventid_sessionnames_map = {}
 
     def OnSessionTerminate(self, evt):
@@ -323,8 +335,11 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         session_name = self._eventid_sessionnames_map[evt.GetId()]
         gevent.spawn(self._X2goClient__terminate_session, session_uuid, session_name=session_name)
         gevent.sleep(2)
-        if self._X2goClient__has_session_terminated(session_uuid, session_name):
-            self.notifier.send(self.current_profile_name, 'X2go session has terminated.\nSession: %s' % session_name, icon='session_terminate', timeout=8000)
+        if self._X2goClient__server_is_alive(session_uuid):
+            if self._X2goClient__has_session_terminated(session_uuid, session_name):
+                self.notifier.send(self.current_profile_name, 'X2go session has terminated.\nSession: %s' % session_name, icon='session_terminate', timeout=8000)
+        else:
+            self.notifier.send(self.current_profile_name, 'Paramiko/SSH session has died! Try to re-connect to the server.', icon='session_error', timeout=10000)
 
         self._eventid_sessionnames_map = {}
 
@@ -337,12 +352,15 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         _control_session = self._X2goClient__client_registered_sessions_of_name(self.current_profile_name)[0]
         session_uuid = _control_session.get_uuid()
         session_names = self._X2goClient__server_running_sessions(session_uuid) + self._X2goClient__server_suspended_sessions(session_uuid)
-        if session_names:
-            _notify_text = 'Cleaning X2go sessions...'
-            for session_name in session_names:
-                _notify_text += '\nSession: %s' % session_name
-            self.notifier.send(self.current_profile_name, _notify_text, icon='session_cleanall', timeout=10000)
-        gevent.spawn(self._X2goClient__clean_sessions, session_uuid)
+        if self._X2goClient__server_is_alive(session_uuid):
+            if session_names:
+                _notify_text = 'Cleaning X2go sessions...'
+                for session_name in session_names:
+                    _notify_text += '\nSession: %s' % session_name
+                self.notifier.send(self.current_profile_name, _notify_text, icon='session_cleanall', timeout=10000)
+            gevent.spawn(self._X2goClient__clean_sessions, session_uuid)
+        else:
+            self.notifier.send(self.current_profile_name, 'Paramiko/SSH session has died! Try to re-connect to the server.', icon='session_error', timeout=10000)
 
     def OnSessionDisconnect(self, evt):
         """\
@@ -354,11 +372,15 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
         session_uuid = _control_session.get_uuid()
 
         # disconnect control session
-        self._X2goClient__disconnect_session(session_uuid)
-        gevent.sleep(2)
-        if not self._X2goClient__is_session_connected(session_uuid):
-            self.notifier.send('%s - disconnect' % self.current_profile_name, 'X2go Profile is now disconnected.', icon='auth_disconnect', timeout=4000)
-
+        if self._X2goClient__server_is_alive(session_uuid):
+            self._X2goClient__disconnect_session(session_uuid)
+            gevent.sleep(2)
+            if not self._X2goClient__is_session_connected(session_uuid):
+                self.notifier.send('%s - disconnect' % self.current_profile_name, 'X2go Profile is now disconnected.', icon='auth_disconnect', timeout=4000)
+        else:
+            # do a disconnect anyway...
+            self._X2goClient__disconnect_session(session_uuid)
+            self.notifier.send(self.current_profile_name, 'Paramiko/SSH session has already died!', icon='session_warning', timeout=10000)
 
     def OnProfileAdd(self, evt):
         """\
diff --git a/pyhoca/wxgui/notify.py b/pyhoca/wxgui/notify.py
index 55f3787..aa001db 100644
--- a/pyhoca/wxgui/notify.py
+++ b/pyhoca/wxgui/notify.py
@@ -47,6 +47,8 @@ class libnotify_NotifierPopup(object):
                   'session_suspend': 'from-gtk/32x32/media-playback-pause.png',
                   'session_terminate': 'from-gtk/32x32/window-close.png',
                   'session_cleanall': 'from-wikipedia/32x32/broom-cleanup.png',
+                  'session_warning': 'from-gtk/32x32/dialog-warning.png',
+                  'session_error': 'from-gtk/32x32/dialog-error.png',
                   'profile_new': 'from-gtk/32x32/list-add.png',
                   'profile_delete': 'from-gtk/32x32/edit-delete.png',
                   'profile_edit': 'from-gtk/32x32/gtk-edit.png',


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