Author: jerome
Date: 2009-03-17 10:48:08 +0100 (Tue, 17 Mar 2009)
New Revision: 4106

Modified:
   
software_suite_v2/software/gadgets/tuxdroid-gadget-system/trunk/tuxdroid-gadget-system/executables/tuxdroid-gadget-system.py
Log:
* Fixed a bug on windblows xp.

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-17 09:43:02 UTC (rev 4105)
+++ 
software_suite_v2/software/gadgets/tuxdroid-gadget-system/trunk/tuxdroid-gadget-system/executables/tuxdroid-gadget-system.py
        2009-03-17 09:48:08 UTC (rev 4106)
@@ -158,10 +158,13 @@
         '''
         Return the cpu load for windows operating systems.
         '''
-        process = subprocess.Popen("wmic CPU GET LoadPercentage", 
stdout=subprocess.PIPE)
-        result = process.stdout.read()
-        return (result[result.find("LoadPercentage") + 
len("LoadPercentage"):]).split()[0]
+        from win32com.client import GetObject
+        wmi = GetObject('winmgmts:')
+        cpu = wmi.InstancesOf('Win32_Processor')
         
+        x = cpu[0]
+        return x.Properties_('LoadPercentage').value
+        
 
 
 


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