[X2Go-Commits] pyhoca-gui.git - build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d (branch) updated: 0.1.0.10-132-g05e3a08

X2Go dev team git-admin at x2go.org
Tue Aug 27 13:22:09 CEST 2013


The branch, build-59a18b6e3b5d3f1dd8f07f26433d37fe5984a57d has been updated
       via  05e3a08419451b405d1a8b1d6e676df554b8c1c0 (commit)
      from  f5950620dc1520bb5ea57f61e13bfe82715ec7a2 (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         |    1 +
 pyhoca/wxgui/frontend.py |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index f9c6b0a..76d75af 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -82,6 +82,7 @@ pyhoca-gui (0.1.2.0-0~x2go1) UNRELEASED; urgency=low
     - Add connect and exit menu items if in single-session-profile mode.
     - Properly catch CTRL-C and SIGTERM signals.
     - Make sure application really exits gracefully.
+    - Provide a separate SetExitHandler function to catch signals from outside.
   * 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 f74a58a..4ec9ef0 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
@@ -69,6 +69,26 @@ import sessiontitle
 wx.SetDefaultPyEncoding("utf-8")
 wx.InitAllImageHandlers()
 
+def SetExitHandler(func):
+
+    if os.name == 'nt' :
+        try :
+            import win32api
+            result = win32api.SetConsoleCtrlHandler( func, True )
+            if result == 0:
+                print '\nCould not SetConsoleCtrlHandler (error %r)' % win32api.GetLastError()
+            else :
+                print '\nSetConsoleCtrlHandler SUCCESS'
+
+        except ImportError :
+            version = '.'.join( map( str, sys.version_info[ :2] ) )
+            raise Exception( 'PyWin32 (win32api) is not installed.' )
+
+    else :
+        import signal
+        signal.signal( signal.SIGTERM, func )
+
+
 class PyHocaGUI(wx.App, x2go.X2goClient):
 
     def __init__(self, args, logger, liblogger, 
@@ -155,12 +175,16 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
 
         x2go.X2goClient.__init__(self, **_x2goclient_kwargs)
 
+        SetExitHandler(self._exit_handler)
         wx.App.__init__(self, redirect=False, clearSigInt=False)
         if not self.args.disable_splash:
             splash.PyHocaGUI_SplashScreen()
 
         self.Bind(wx.EVT_IDLE, self.OnIdle)
 
+    def _exit_handler(self):
+        WakeUpIdle()
+        ExitMainLoop()
 
     def OnInit(self):
         """\
@@ -998,3 +1022,4 @@ class PyHocaGUI(wx.App, x2go.X2goClient):
             evt = wx.IdleEvent()
             evt.SetId(_dummy_id)
             self.OnServerDisconnect(evt)
+


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