Author: jerome
Date: 2009-03-13 08:13:42 +0100 (Fri, 13 Mar 2009)
New Revision: 4040

Modified:
   
software_suite_v2/software/gadgets/tuxdroid-gadget-skype/trunk/tuxdroid-skype-gadget/executables/tuxdroid-gadget-skype.py
Log:
*Auto start of skype in case of not found in process list.

Modified: 
software_suite_v2/software/gadgets/tuxdroid-gadget-skype/trunk/tuxdroid-skype-gadget/executables/tuxdroid-gadget-skype.py
===================================================================
--- 
software_suite_v2/software/gadgets/tuxdroid-gadget-skype/trunk/tuxdroid-skype-gadget/executables/tuxdroid-gadget-skype.py
   2009-03-12 23:11:05 UTC (rev 4039)
+++ 
software_suite_v2/software/gadgets/tuxdroid-gadget-skype/trunk/tuxdroid-skype-gadget/executables/tuxdroid-gadget-skype.py
   2009-03-13 07:13:42 UTC (rev 4040)
@@ -99,8 +99,8 @@
          '''
          try:
             #Get skype aplication state
-            if not self.__getSkypeConnected():
-                self.__startSkype()    
+            if not self.__getSkypeConnected():    
+                self.__startSkype()
                 t = threading.Thread(target = self.__start, args = [])
                 t.start()
                 return
@@ -288,13 +288,34 @@
         
         if self.isWindows():
             if "ProgramFiles" in os.environ:
-                subprocess.Popen(os.environ["ProgramFiles"] + 
"\\Skype\\Phone\\Skype.exe", stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+                process = subprocess.Popen(os.environ["ProgramFiles"] + 
"\\Skype\\Phone\\Skype.exe", stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+                result = process.stdout.read()
+                if ("not" in result) and ("recognized" in result) and 
("command" in result):
+                    print("message: \"" + "Cannot find Skype client" + "\"")
+                    self.__destroy()
         else:
-            cmd = ["skype", ]
-            subprocess.Popen(cmd, stdin=subprocess.PIPE, 
stdout=subprocess.PIPE)
+            #Searching for skype binary.
+            cmd = ["skype", "--version"]
+            process = subprocess.Popen(cmd, stdin=subprocess.PIPE, 
stdout=subprocess.PIPE)
+            result = process.stdout.read()
+            result = result.split()
+            if("Skype" in result) and ("Copyright" in result):
+                #Then skype is in PATH
+                thread = threading.Thread(target=self.__startSkypeLinux, 
args=[])
+                thread.start()
+     
+     
+     
+     def __startSkypeLinux(self):
+         '''
+         Start skype on linux ( thread needed to do not block the script ).
+         '''
+         #checking for auto-connect user parameter
+         subprocess.Popen("skype", stdin=subprocess.PIPE, 
stdout=subprocess.PIPE)
+            
         
+        
 
-
      def __getConnected(self):
          '''
          Return true if connected.


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to