Author: jerome
Date: 2009-10-05 12:24:07 +0200 (Mon, 05 Oct 2009)
New Revision: 5588

Modified:
   
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
Log:
* Fixed a bug quitting Skype client.

Modified: 
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
===================================================================
--- 
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
    2009-10-05 09:53:55 UTC (rev 5587)
+++ 
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
    2009-10-05 10:24:07 UTC (rev 5588)
@@ -91,6 +91,7 @@
         self.normalStart = False
         self.quitSkypeClient = False
         self.count = 1
+        self.__skypeProcess = -1
 
     def start(self):
         """Plugin entry point.
@@ -137,15 +138,26 @@
                 self.__skype._API.Close()
                 self.__skype = None
                 self.__apiAttachState = -1
+                
                 if self.__skype.Client.IsRunning:
                     #Shutting down Skype application.
-                    self.__skype.Client.Shutdown()
+                
+                    if os.name != 'nt':
+                        os.system("kill -15 `ps h --ppid " + 
str(self.__skypeProcess.pid ) + " | awk '{print $1}'` 2>/dev/null")
+                    else:
+                        self.__skype.Client.Shutdown()
                 refreshTaskBar()
         try:
         
             #Sending 'Shutdown command' first to do not block the quit process 
that is quite long.
             if self.quitSkypeClient:
-                self.__skype.Client.Shutdown()
+                if os.name != 'nt':
+                    os.system("kill -15 `ps h --ppid " + 
str(self.__skypeProcess.pid ) + " | awk '{print $1}'` 2>/dev/null")
+                    
+                else:
+                    
+                    self.__skype.Client.Shutdown()
+                
                 time.sleep(1.0)
                 
             if self.__skype != None:
@@ -423,10 +435,45 @@
             self.normalStart = True
             return
         self.quitSkypeClient = True
-        self.throwMessage("Please wait while I launch the skeyepe 
application") 
-        self.__skype.Client.Start(Minimized=False, Nosplash=True)
+        self.throwMessage("Please wait while I launch the skeyepe application")
         
+        if os.name == 'nt': 
+            self.__skype.Client.Start(Minimized=False, Nosplash=True)
+        else:
+            self.__startSkypeAppLinux()
+    
+    
+    def __startSkypeAppLinux(self):
+        """Start skype on linux ( thread needed to do not block the script ).
+        """
+        # Searching for skype binary.
+        result = []
+        found =False
 
+        result = os.environ
+
+        result = result['PATH'].split(':')
+
+        for path in result:
+           cmd = 'ls ' + path + ' | grep skype'
+           res = commands.getoutput(cmd)
+           if res.find('skype') >= 0:
+               found = True
+               break
+
+        if found:
+            #start skype
+            self.__skypeProcess = subprocess.Popen("skype", stdin = 
subprocess.PIPE,
+                stdout = subprocess.PIPE)
+            
+            while not self.__getSkypeAppConnected():
+                time.sleep(1)
+            self.__activeMain = True
+        else:
+            self.throwMessage("Sorry, it looks like skeyepe is not installed. 
Please go to the skeyepe website to download the software.")
+            self.__activeMain = False
+        
+
     # 
==========================================================================
     # Tux Droid body
     # 
==========================================================================


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to