def update_people(person_uuid, handup):
if person_uuid not in PEOPLE:
mi = gtk.MenuItem(person_uuid)
n = notify.Notification.new("", "", "")
PEOPLE[person_uuid] = ["off", mi, n]
menu.append(mi)
PEOPLE[person_uuid][0] = handup
if handup == "on":
PEOPLE[person_uuid][1].show()
else:
PEOPLE[person_uuid][1].hide()
their = "their"
name = person_uuid
if handup == "on":
updown = "up"
icon = os.path.abspath("open-green.svg")
else:
updown = "down"
icon = os.path.abspath("closed.svg")
if unicode(person_uuid) == unicode(pnconfig.uuid):
their = "your"
name = "You"
if handup == "on":
icon = os.path.abspath("open-yellow.svg")
PEOPLE[person_uuid][2].update("%s put %s hand %s" % (name, their, updown), "", icon)
PEOPLE[person_uuid][2].show()
hand_state = "closed.svg"
print " Checking whether people have their hands up"
for p, hm in PEOPLE.items():
h, m, n = hm
if h == "on":
if unicode(p) == unicode(pnconfig.uuid):
print " I do, so let's go with a yellow hand, unless anyone else does too"
hand_state = "open-yellow.svg"
else:
print " ", p, "does, so it's a green hand icon"
hand_state = "open-green.svg"
break
print(" OK, finished checking; we're setting the hand to %s" % (hand_state,))
indicator.set_icon(os.path.abspath(hand_state))
评论列表
文章目录