Browse Source

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
master
Dan Ballard 10 years ago
parent
commit
f14c79b84f
  1. 15
      cmdline.py
  2. 12
      main.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

@ -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…
Cancel
Save