davemds pushed a commit to branch master.

http://git.enlightenment.org/enlightenment/modules/edgar.git/commit/?id=4386c386e44534ec808ea3443782229a4e258e4e

commit 4386c386e44534ec808ea3443782229a4e258e4e
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Sun Sep 13 16:47:56 2015 +0200

    Cpu gadget: add compatibility with older psutil
    
    not tested yet, will try tomorrow..but should work
---
 GADGETS/cpu/__init__.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/GADGETS/cpu/__init__.py b/GADGETS/cpu/__init__.py
index 2cc6ca3..7bf9366 100644
--- a/GADGETS/cpu/__init__.py
+++ b/GADGETS/cpu/__init__.py
@@ -106,10 +106,16 @@ class Gadget(e.Gadget):
         
     def popups_poller_cb(self):
         # build an orderd list of all running procs (pid, name, cpu_perc, 
mun_t)
-        self.top_procs = [ (p.pid, p.name(),
-                            p.cpu_percent(interval=0) / self.num_cores,
-                            p.num_threads())
-                           for p in psutil.process_iter() ]
+        if psutil.version_info[0] < 2:
+            self.top_procs = [ (p.pid, p.name,
+                                p.get_cpu_percent(interval=0) / self.num_cores,
+                                p.get_num_threads())
+                               for p in psutil.process_iter() ]
+        else:
+            self.top_procs = [ (p.pid, p.name(),
+                                p.cpu_percent(interval=0) / self.num_cores,
+                                p.num_threads())
+                               for p in psutil.process_iter() ]
         self.top_procs.sort(key=itemgetter(2), reverse=True)
 
         # update all the visible genlists

-- 


Reply via email to