modified to consume new daemon data structure
-client works and now handles multiple cpus -GUI is now broken but has code in place to be fixed, but I can't test, sorry
This commit is contained in:
parent
4a4eb6008d
commit
f14c79b84f
15
cmdline.py
15
cmdline.py
|
@ -12,16 +12,21 @@ while True:
|
|||
sock.close()
|
||||
#print data
|
||||
stats = json.loads(data)
|
||||
for stat in stats["Stats"]:
|
||||
print "%s: %f" % (stat["type"] ,stat["value"])
|
||||
for k in stats:
|
||||
v = stats[k]
|
||||
if type(v) is list:
|
||||
for i in range(0,len(v)):
|
||||
print "%s[%d]: %f" % (k, i, v[i]['percent'])
|
||||
else :
|
||||
print "%s: %f" % (k,v['percent'])
|
||||
print "----"
|
||||
time.sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
print "\nExiting..."
|
||||
break
|
||||
except:
|
||||
print "\nError..."
|
||||
break
|
||||
# except Exception as err:
|
||||
# print "\nError ", type(err), ': ', err, "..."
|
||||
# break
|
||||
|
||||
|
||||
|
||||
|
|
12
main.py
12
main.py
|
@ -55,8 +55,16 @@ class MenuExampleWindow(Gtk.Window):
|
|||
sock.close()
|
||||
#print data
|
||||
stats = json.loads(data)
|
||||
for stat in stats["Stats"]:
|
||||
self.stats[stat["type"]].set_label("%f"%stat["value"])
|
||||
#for stat in stats["Stats"]:
|
||||
# self.stats[stat["type"]].set_label("%f"%stat["value"])
|
||||
for k in stats:
|
||||
v = stats[k]
|
||||
if type(v) is list:
|
||||
for i in range(0,len(v)):
|
||||
print "%s[%d]: %f" % (k, i, v[i]['percent'])
|
||||
else :
|
||||
print "%s: %f" % (k,v['percent'])
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue