33 "fuel_warning2": os.path.abspath(SOUNDPREFIX + "sound/fuel2.mp3"), |
33 "fuel_warning2": os.path.abspath(SOUNDPREFIX + "sound/fuel2.mp3"), |
34 "fuel_full": os.path.abspath(SOUNDPREFIX + "sound/fuel_full.mp3"), |
34 "fuel_full": os.path.abspath(SOUNDPREFIX + "sound/fuel_full.mp3"), |
35 "pitlane_enter": os.path.abspath(SOUNDPREFIX + "sound/pitlane_enter.mp3"), |
35 "pitlane_enter": os.path.abspath(SOUNDPREFIX + "sound/pitlane_enter.mp3"), |
36 "pitlane_exit": os.path.abspath(SOUNDPREFIX + "sound/pitlane_exit.mp3"), |
36 "pitlane_exit": os.path.abspath(SOUNDPREFIX + "sound/pitlane_exit.mp3"), |
37 "data_error": os.path.abspath(SOUNDPREFIX + "sound/data_error.mp3"), |
37 "data_error": os.path.abspath(SOUNDPREFIX + "sound/data_error.mp3"), |
|
38 "panic": os.path.abspath(SOUNDPREFIX + "sound/panic.mp3"), |
|
39 "panic_shortcut": os.path.abspath(SOUNDPREFIX + "sound/panic_shortcut.mp3"), |
|
40 "resume": os.path.abspath(SOUNDPREFIX + "sound/resume.mp3"), |
|
41 |
38 } |
42 } |
39 |
43 |
40 def trigger_sound(what): |
44 def trigger_sound(what): |
41 if what in SOUNDS: |
45 if what in SOUNDS: |
42 Popen(["/usr/bin/mpg123", "-q", SOUNDS[what]]) |
46 Popen(["/usr/bin/mpg123", "-q", SOUNDS[what]]) |
98 idx += 1 |
102 idx += 1 |
99 |
103 |
100 def render_slots(self): |
104 def render_slots(self): |
101 self.update_positions() |
105 self.update_positions() |
102 self.scr.addstr(3,0, |
106 self.scr.addstr(3,0, |
103 "Pos | #/Name | Laps | Best | Last | Fuel | Status ", |
107 #"Pos | #/Name | Laps | Best | Last | Fuel | Status ", |
|
108 "Pos | #/Name ", |
|
109 curses.color_pair(2)) |
|
110 self.scr.addstr(4,4, |
|
111 " Laps | Best | Last | Fuel | Status ", |
104 curses.color_pair(2)) |
112 curses.color_pair(2)) |
105 for idx in range(MAXSLOTS): |
113 for idx in range(MAXSLOTS): |
|
114 """ |
106 self.scr.addstr((3 + (self.slot[idx]["position"] * 2)), 0, |
115 self.scr.addstr((3 + (self.slot[idx]["position"] * 2)), 0, |
107 "%3i | %i %15s | %4i | %7.2fs | %7.2fs | %3i%% | %10s" % ( |
116 "%3i | %i %15s | %4i | %7.2fs | %7.2fs | %3i%% | %10s" % ( |
108 self.slot[idx]["position"], |
117 self.slot[idx]["position"], |
109 self.slot[idx]["car"] + 1, self.slot[idx]["name"], |
118 self.slot[idx]["car"] + 1, self.slot[idx]["name"], |
110 self.slot[idx]["laps"], |
119 self.slot[idx]["laps"], |
111 self.slot[idx]["best"], |
120 self.slot[idx]["best"], |
112 self.slot[idx]["last"], |
121 self.slot[idx]["last"], |
113 self.slot[idx]["fuel"], |
122 self.slot[idx]["fuel"], |
114 self.slot[idx]["status"], |
123 self.slot[idx]["status"], |
115 ) ) |
124 ), |
|
125 curses.color_pair(11 + idx) ) |
|
126 """ |
|
127 self.scr.addstr((3 + (self.slot[idx]["position"] * 2)), 0, |
|
128 "%3i | %i %15s %48s" % ( |
|
129 self.slot[idx]["position"], |
|
130 self.slot[idx]["car"] + 1, self.slot[idx]["name"], |
|
131 "", |
|
132 ), |
|
133 curses.color_pair(11 + idx) ) |
|
134 self.scr.addstr((4 + (self.slot[idx]["position"] * 2)), 4, |
|
135 " %4i | %7.2fs | %7.2fs | %3i%% | %10s %19s" % ( |
|
136 self.slot[idx]["laps"], |
|
137 self.slot[idx]["best"], |
|
138 self.slot[idx]["last"], |
|
139 self.slot[idx]["fuel"], |
|
140 self.slot[idx]["status"], |
|
141 "" |
|
142 ), |
|
143 curses.color_pair(11 + idx) ) |
116 |
144 |
117 def cleartop(self): |
145 def cleartop(self): |
118 self.scr.addstr(0,0, "%80s" % "Live monitor running, press keys to control or (q)uit") |
146 self.scr.addstr(0,0, "%80s" % "Live monitor running, press keys to control or (q)uit") |
119 self.scr.addstr(1,0, "%80s" % " ") |
147 self.scr.addstr(1,0, "%80s" % " ") |
120 |
148 |
152 self.monitor_init() |
180 self.monitor_init() |
153 self.scr = curses.initscr() |
181 self.scr = curses.initscr() |
154 curses.start_color() |
182 curses.start_color() |
155 curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) # standard text |
183 curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) # standard text |
156 curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLUE) # label |
184 curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLUE) # label |
|
185 curses.init_pair(11, curses.COLOR_BLACK, curses.COLOR_YELLOW) # player 1 slot |
|
186 curses.init_pair(12, curses.COLOR_BLACK, curses.COLOR_GREEN) # player 2 slot |
|
187 curses.init_pair(13, curses.COLOR_BLACK, curses.COLOR_RED) # player 3 slot |
|
188 curses.init_pair(14, curses.COLOR_BLACK, curses.COLOR_MAGENTA) # player 4 slot |
|
189 curses.init_pair(15, curses.COLOR_WHITE, curses.COLOR_BLACK) # player 5 slot |
|
190 curses.init_pair(16, curses.COLOR_WHITE, curses.COLOR_BLACK) # player 6 slot |
157 curses.noecho() # disable key echo |
191 curses.noecho() # disable key echo |
158 curses.cbreak() # do not buffer keypresses |
192 curses.cbreak() # do not buffer keypresses |
159 self.scr.keypad(1) # enable special keys |
193 self.scr.keypad(1) # enable special keys |
160 self.scr.nodelay(1) # disable delay on readkey |
194 self.scr.nodelay(1) # disable delay on readkey |
161 |
195 |