Author: jerome
Date: 2009-03-14 18:29:44 +0100 (Sat, 14 Mar 2009)
New Revision: 4079

Modified:
   
software_suite_v2/software/gadgets/tuxdroid-gadget-system/trunk/tuxdroid-gadget-system/executables/tuxdroid-gadget-system.py
Log:
* Added check of cpu load for windows.

Modified: 
software_suite_v2/software/gadgets/tuxdroid-gadget-system/trunk/tuxdroid-gadget-system/executables/tuxdroid-gadget-system.py
===================================================================
--- 
software_suite_v2/software/gadgets/tuxdroid-gadget-system/trunk/tuxdroid-gadget-system/executables/tuxdroid-gadget-system.py
        2009-03-14 17:22:22 UTC (rev 4078)
+++ 
software_suite_v2/software/gadgets/tuxdroid-gadget-system/trunk/tuxdroid-gadget-system/executables/tuxdroid-gadget-system.py
        2009-03-14 17:29:44 UTC (rev 4079)
@@ -82,6 +82,9 @@
             if not self.isWindows():
                 #linux system.
                 cpu = self.__getLinuxCPULoad()
+            else:
+                #windows system.
+                cpu = self.__getWindowsCPULoad()
                 
                 if self.tgp_useCpuThreshold:
                     #check threshold.
@@ -90,10 +93,6 @@
                 else:   
                     print("message \"Your c p u load is over\"")
                     print("message \"" + str(cpu) + "%\"")
-            else:
-                #windows system.
-                #TODO 
-                pass
                  
         
         if self.tgp_giveMem:
@@ -161,7 +160,10 @@
         '''
         Return the cpu load for windows operating systems.
         '''
-        pass
+        process = subprocess.Popen(["wmic", "CPU", "GET", "LoadPercentage"], 
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+        result = process.stdout.read()
+        return (result[result.find("LoadPercentage") + 
len("LoadPercentage"):]).split()[0]
+        
 
 
 


------------------------------------------------------------------------------
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