160 self.cleartop() |
162 self.cleartop() |
161 self.scr.refresh() |
163 self.scr.refresh() |
162 curses.noecho() |
164 curses.noecho() |
163 self.scr.nodelay(1) # disable delay on readkey |
165 self.scr.nodelay(1) # disable delay on readkey |
164 |
166 |
|
167 def readInt(self, msg, default): |
|
168 self.scr.nodelay(0) # enable delay on readkey |
|
169 curses.echo() |
|
170 self.scr.addstr(0,0, "%s [%i]:" % ( |
|
171 msg, |
|
172 default, |
|
173 curses.color_pair(1)) |
|
174 ) |
|
175 self.scr.refresh() |
|
176 inp = self.scr.getstr(1,0, 4) |
|
177 if inp != "": |
|
178 try: |
|
179 inp = int(inp) |
|
180 except Exception: |
|
181 inp = None |
|
182 else: |
|
183 inp = None |
|
184 self.cleartop() |
|
185 self.scr.refresh() |
|
186 curses.noecho() |
|
187 self.scr.nodelay(1) # disable delay on readkey |
|
188 return inp |
|
189 |
|
190 |
165 def monitor_init(self): |
191 def monitor_init(self): |
166 """ |
192 """ |
167 Send initializing commands for live monitoring |
193 Send initializing commands for live monitoring |
168 """ |
194 """ |
169 self.box.query("F1\n") # set fuel logic enabled |
195 self.box.query("F1\n") # set fuel logic enabled |
219 if self.slot[5]["drive"] > 0: self.slot[5]["drive"] -= 1 |
245 if self.slot[5]["drive"] > 0: self.slot[5]["drive"] -= 1 |
220 cli.box.speedminimum(5, self.slot[5]["drive"]) |
246 cli.box.speedminimum(5, self.slot[5]["drive"]) |
221 elif key == ord('x'): |
247 elif key == ord('x'): |
222 if self.slot[5]["drive"] < 16: self.slot[5]["drive"] += 1 |
248 if self.slot[5]["drive"] < 16: self.slot[5]["drive"] += 1 |
223 cli.box.speedminimum(5, self.slot[4]["drive"]) |
249 cli.box.speedminimum(5, self.slot[4]["drive"]) |
|
250 elif key == ord('t'): |
|
251 tmp = self.readInt("Set new Race TIME limit", self.timelimit) |
|
252 if tmp: self.timelimit = tmp |
|
253 elif key == ord('l'): |
|
254 tmp = self.readInt("Set new Race LAP limit", self.laplimit) |
|
255 if tmp: self.laplimit = tmp |
224 |
256 |
225 |
257 |
226 # is there something in the rx buffer? |
258 # is there something in the rx buffer? |
227 rx = self.box.readline() |
259 rx = self.box.readline() |
228 if (rx != "") or self.test: |
260 if (rx != "") or self.test: |