--- a/slotUI/SlotCli.py Fri Dec 09 12:32:36 2011 +0100 +++ b/slotUI/SlotCli.py Fri Dec 09 18:20:21 2011 +0100 @@ -6,11 +6,11 @@ from freeslot import Blackbox from optparse import OptionParser -import time, sys +import sys from copy import copy import curses -VERSION = "1.1" +VERSION = "1.2" MAXSLOTS = 6 TERM = { "caption": "\033[1;37m\033[1;44m", @@ -130,7 +130,7 @@ slot = int(data[3]) - 1 t = int(data[4], 16) l = int(data[2], 16) - t = t / 2000.00 # time in seconds + t /= 2000.00 self.slot[slot]["laps"] = l self.slot[slot]["last"] = t if (self.slot[slot]["best"] > t) or (self.slot[slot]["best"] == 0): self.slot[slot]["best"] = t @@ -146,6 +146,9 @@ curses.endwin() return None + def cyclemode(self): + pass + if __name__ == "__main__": parser = OptionParser(version="%prog " + VERSION) parser.add_option("--live", dest="live", action="store_true", default=False, @@ -170,34 +173,34 @@ cli = SlotCli() # should a CLI function be started? - if options.live == True: + if options.live: # start the live monitor cli.monitor() sys.exit(0) # check commandline if we have to program something - if options.carid == None: + if not options.carid: print "Option --carid is required for all car programming commands!\nUse --help to get a list of available commands" sys.exit(1) - if options.fuel != None: + if options.fuel: print "setFuel: " + cli.box.progcar(int(options.carid), "fuel", int(options.fuel)) - if options.speed != None: + if options.speed: print "setSpeed: " + cli.box.progcar(int(options.carid), "speed", int(options.speed)) - if options.brake != None: + if options.brake: print "setBrake: " + cli.box.progcar(int(options.carid), "brake", int(options.brake)) - if options.blink != None: + if options.blink: state = False if options.blink == "on": state = True print "setBlink: " + cli.box.blinkcar(int(options.carid), state) - if options.limit != None: + if options.limit: print "Change Speed Limit: " + cli.box.speedlimit(int(options.carid), int(options.limit)) - if options.drive != None: + if options.drive: print "Change minimum Speed drive: " + cli.box.speedminimum(int(options.carid), int(options.drive))