# HG changeset patch # User Malte Bayer # Date 1351451368 -3600 # Node ID fee43a74bed6afe238bcbd1939297d5740a48bf5 # Parent 7e9a451870edb558ff8ece1b0c36508a2a9668aa added controller number to event scripts parameter 1 diff -r 7e9a451870ed -r fee43a74bed6 slotUI/SlotCli.py --- a/slotUI/SlotCli.py Sun Oct 28 20:05:16 2012 +0100 +++ b/slotUI/SlotCli.py Sun Oct 28 20:09:28 2012 +0100 @@ -54,9 +54,9 @@ #os.spawnlp(os.P_NOWAIT, "/usr/bin/mpg123", "mpg123", SOUNDS[what]) #Popen(["/usr/bin/mpg123", SOUNDS[what]]).pid -def trigger_event(what): +def trigger_event(what, slot = 0): trigger_sound(what) - Popen(["/bin/sh", os.path.abspath(EVENTPREFIX + what)]) + Popen(["/bin/sh", os.path.abspath(EVENTPREFIX + what), str(slot)]) class SlotServer(threading.Thread): def __init__(self, blackbox): @@ -427,13 +427,13 @@ if (self.slot[slot]["best"] > t) or (self.slot[slot]["best"] == 0): self.slot[slot]["best"] = t if self.bestlap > t: - trigger_event("lap_record") + trigger_event("lap_record", slot + 1) self.bestlap = t self.slot[slot]["status"] = "IN-RACE" if (self.slot[slot]["laps_last"] != l) and (l == self.laplimit): # we have lap limit reached! - trigger_event("win") + trigger_event("win", slot + 1) self.raceactive = False self.slot[slot]["status"] = "WINNER!" self.box.query("+") # stop race @@ -452,12 +452,12 @@ if (self.slot[slot]["fuel_last"] == 16) and (f == 15): # 15 percent fuel, set speed limit for car to 8 # warning sound - trigger_event("fuel_warning1") + trigger_event("fuel_warning1", slot + 1) cli.box.speedlimit(slot, 8) if (self.slot[slot]["fuel_last"] == 6) and (f == 5): # 5 percent, set speed limit for car to 6 # warning sound - trigger_event("fuel_warning2") + trigger_event("fuel_warning2", slot + 1) cli.box.speedlimit(slot, 6) if (self.slot[slot]["fuel_last"] == 1) and (f == 0): # fuel empty @@ -466,7 +466,7 @@ if (self.slot[slot]["fuel_last"] < f) and (f >= 11) and (f < 20): cli.box.speedlimit(slot, 15) if (self.slot[slot]["fuel_last"] < f) and (f == 100): - trigger_event("fuel_full") + trigger_event("fuel_full", slot + 1) self.render_slots() if rx[:1] == "~": @@ -487,10 +487,10 @@ # pitlane sent something if (status == 5): self.slot[slot]["status"] = "PITLANE" - trigger_event("pitlane_enter") + trigger_event("pitlane_enter", slot + 1) if (status == 7): self.slot[slot]["status"] = "IN-RACE" - trigger_event("pitlane_exit") + trigger_event("pitlane_exit", slot + 1) self.render_slots()