merge

Fri, 09 Dec 2011 19:41:28 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Fri, 09 Dec 2011 19:41:28 +0100
changeset 61
040b6b2094fb
parent 60
bfc2f2d6913c (current diff)
parent 58
042c490fdfaa (diff)
child 62
66dd5763dfb3

merge

slotUI/SlotCli.py file | annotate | diff | comparison | revisions
--- a/slotUI/SlotCli.py	Fri Dec 09 14:33:07 2011 +0100
+++ b/slotUI/SlotCli.py	Fri Dec 09 19:41:28 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",
@@ -131,7 +131,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
@@ -154,6 +154,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,
@@ -178,34 +181,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))
 

mercurial