Index: src/python/bin/gnuboat
===================================================================
--- src/python/bin/gnuboat	(revision cfdd201c44f868b82017703d68cd25366515bfe9)
+++ src/python/bin/gnuboat	(revision 8befa17780ea19ee1505da184d9942365ba1b034)
@@ -33,6 +33,6 @@
 from gnuboat import daemon
 
-WHITE=1
-BLACK=0
+WHITE = 1
+BLACK = 0
 marginVertical = 10
 marginHorizontal = marginVertical
@@ -48,189 +48,201 @@
 nmeafile = None
 
+
 def rraRows(duration, resolution, step):
     return int(round(float(duration) / rraSteps(resolution, float(step)) / float(step)))
 
+
 def rraSteps(resolution, step):
     return int(round(float(resolution) / float(step)))
 
+
 def createDatabase(databaseFile):
-  rrdDataSources = [ 'DS:latitude:GAUGE:15:-90:90',
-                     'DS:longitude:GAUGE:15:-180:180',
-                     'DS:speedthroughwater:GAUGE:15:U:U',
-                     'DS:speedoverground:GAUGE:15:U:U',
-                     'DS:waterdepth:GAUGE:15:0:10000',
-                     'DS:watertemperature:GAUGE:15:-10:50',
-                     'DS:gpsfix:GAUGE:15:-999:3' ]
-
-  step = logperiod
-  # durations: each archive should contain values for in seconds
-  archives = [
-    {"duration": 240, "resolution": 2},
-    {"duration": 3600, "resolution": 10},
-    {"duration": 86400, "resolution": 60},
-  ]
-  rrdArchives = []
-  for i in range(0, len(archives)):
-    rrdArchives += ['RRA:AVERAGE:0.5:%d:%d' % (rraSteps(archives[i]["resolution"], step), rraRows(archives[i]["duration"], archives[i]["resolution"], step))]
-
-  if not os.path.isfile(databaseFile):
-    rrdtool.create(databaseFile,
-                   "--start",
-                   "N",
-                   "--step",
-                   str(step),
-                   rrdDataSources,
-                   rrdArchives)
+    rrdDataSources = ['DS:latitude:GAUGE:15:-90:90',
+                      'DS:longitude:GAUGE:15:-180:180',
+                      'DS:speedthroughwater:GAUGE:15:U:U',
+                      'DS:speedoverground:GAUGE:15:U:U',
+                      'DS:waterdepth:GAUGE:15:0:10000',
+                      'DS:watertemperature:GAUGE:15:-10:50',
+                      'DS:gpsfix:GAUGE:15:-999:3']
+
+    step = logperiod
+    # durations: each archive should contain values for in seconds
+    archives = [
+        {"duration": 240, "resolution": 2},
+        {"duration": 3600, "resolution": 10},
+        {"duration": 86400, "resolution": 60},
+    ]
+    rrdArchives = []
+    for i in range(0, len(archives)):
+        rrdArchives += ['RRA:AVERAGE:0.5:%d:%d' % (rraSteps(archives[i]["resolution"], step), rraRows(
+            archives[i]["duration"], archives[i]["resolution"], step))]
+
+    if not os.path.isfile(databaseFile):
+        rrdtool.create(databaseFile,
+                       "--start",
+                       "N",
+                       "--step",
+                       str(step),
+                       rrdDataSources,
+                       rrdArchives)
+
 
 def checkShutdownRequest(shutdownFile):
-  global shutdownRequested
-  # have look for new shutdown requests
-  if os.path.isfile(shutdownFile):
-    with open(shutdownFile, "r") as fileHandler:
-      shutdownStart = fileHandler.read().strip()
-    os.remove(shutdownFile)
-    shutdownRequested = dateutil.parser.parse(shutdownStart)
-  # check existing shutdown requests
-  if shutdownRequested is not None:
-    currentTime = datetime.datetime.now()
-    currentTime = currentTime.replace(tzinfo=pytz.utc)
-    if (currentTime - shutdownRequested) > datetime.timedelta(seconds = 0):
-      os.system("sudo shutdown -h now")
+    global shutdownRequested
+    # have look for new shutdown requests
+    if os.path.isfile(shutdownFile):
+        with open(shutdownFile, "r") as fileHandler:
+            shutdownStart = fileHandler.read().strip()
+        os.remove(shutdownFile)
+        shutdownRequested = dateutil.parser.parse(shutdownStart)
+    # check existing shutdown requests
+    if shutdownRequested is not None:
+        currentTime = datetime.datetime.now()
+        currentTime = currentTime.replace(tzinfo=pytz.utc)
+        if (currentTime - shutdownRequested) > datetime.timedelta(seconds=0):
+            os.system("sudo shutdown -h now")
+
 
 def usage():
-  print "Usage of gnuboat daemon:"
-  print "  gnuboat -r PATH_TO_RRD_DATABAE_FILE -s PATH_TO_SHUTDOWN_REQUEST_FILE [-l [LOG_UPDATE_PERIOD] [-d DISPLAY_UPDATE_PERIOD] [-o PATH_TO_NMEA1983_LOG]"
-  print ""
-  print "  -h --help              Display this help"
-  print "  -r --rrdfile           Path to the rrd database used by the webservice to serve the clients"
-  print "  -s --shutdownfile      Path to the shutdown request file, used by the webservice to request a shutdown of the system running gnuboat"
-  print "  -l --logperiod         Time in seconds to update the logs"
-  print "  -d --displayperiod     Timein seconds to update the display"
-  print "  -o --output            File where the NMEA1983 log is stored"
+    print "Usage of gnuboat daemon:"
+    print "  gnuboat -r PATH_TO_RRD_DATABAE_FILE -s PATH_TO_SHUTDOWN_REQUEST_FILE [-l [LOG_UPDATE_PERIOD] [-d DISPLAY_UPDATE_PERIOD] [-o PATH_TO_NMEA1983_LOG]"
+    print ""
+    print "  -h --help              Display this help"
+    print "  -r --rrdfile           Path to the rrd database used by the webservice to serve the clients"
+    print "  -s --shutdownfile      Path to the shutdown request file, used by the webservice to request a shutdown of the system running gnuboat"
+    print "  -l --logperiod         Time in seconds to update the logs"
+    print "  -d --displayperiod     Timein seconds to update the display"
+    print "  -o --output            File where the NMEA1983 log is stored"
+
 
 def main(argv):
-  global rrdfile
-  global shutdownfile
-  global logperiod
-  global displayperiod
-  global logfile
-  global nmeafile
- 
-  try:                                
-    opts, args = getopt.getopt(argv, "hr:s:l:d:o:", ["help", "rrdfile=", "shutdownfile=", "logperiod=", "displayperiod=", "output="]) 
-  except getopt.GetoptError:           
-    usage()                          
-    sys.exit(2)
-
-  for option, argument in opts:
-    if option == ("-h", "--help"):
-      usage()
-      sys.exit()
-    elif option in ("-r", "--rrdfile"):
-       rrdfile = argument
-    elif option in ("-s", "--shutdownfile"):
-      shutdownfile = argument
-    elif option in ("-l", "--logperiod"):
-      logperiod = argument
-    elif option in ("-d", "--displayperiod"):
-      displayperiod = argument
-    elif option in ("-o", "--output"):
-      logfile = argument
-    else:
-      assert False, "unhandled option"
-
-  if not os.path.exists(os.path.dirname(rrdfile)):
-    print "rrd database directory not found %s" % os.path.dirname(rrdfile)
-    print ""
-    usage()
-    sys.exit(2)
-
-  if not os.path.exists(os.path.dirname(shutdownfile)):
-    print "Shutdown request directory not found %s" % os.path.dirname(shutdownfile)
-    print ""
-    usage()
-    sys.exit(2)
-
-  if logperiod < 1:
-    print "Log period must be >= 1"
-    print ""
-    usage()
-    sys.exit(2)
-
-  if displayperiod < 1 or displayperiod < logperiod:
-    print "Display period must be >= 1 and could not be faster than log period"
-    print ""
-    usage()
-    sys.exit(2)
-
-  createDatabase(rrdfile)
-
-  try:
-    nmeafile = open(logfile, 'a', 0)
-  except IOError as error:
-    print "Could not open the logfile: %s" % error
-    sys.exit(2)
-
-  displayHandler = daemon.DisplayHandler(displayperiod)
-
-  gpsp = daemon.GpsdPoller(logperiod)
-  n2kd = daemon.N2kdPoller(logperiod)
-  try:
-    gpsp.start()
-    n2kd.start()
-    while True:
-      # In the main thread, every logPeriod seconds print the current value
-      time.sleep(logperiod)
-      latitude = gpsp.latitude()
-      longitude = gpsp.longitude()
-      speedThroughWater = n2kd.speedThroughWater()
-      speedOverGround = gpsp.speedOverGround()
-      waterDepth = n2kd.waterDepth()
-      waterTemperature = n2kd.waterTemperature()
-      gpsFix = gpsp.gpsFix()
-            
-      # update rrd database for the webservice
-      rrdtool.update(rrdfile, "N:%s:%s:%s:%s:%s:%s:%s" % (latitude, longitude, speedThroughWater, speedOverGround, waterDepth, waterTemperature, gpsFix))
-      
-      # append to log
-      if gpsp.gpsFix() >= 2:
-        timeUtc = gpsp.timeUtc()
-        status = gpsp.status()
-        latitudeDirection = gpsp.latitudeDirection()
-        longitudeDirection = gpsp.longitudeDirection()
-        courseOverGround = gpsp.courseOverGround()
-        
-        mode = 'N'
-        if gpsFix >= 2:
-          mode = 'A'
-        
-        nmeafile.write("%s\r\n" % str(pynmea2.RMC('GN', 'RMC',
-                      ( timeUtc.strftime("%H%M%S"), status, '$%04.3f' % latitude,
-                        latitudeDirection, '$%05.3f' % longitude, longitudeDirection,
-                        '$%02.1f' % speedOverGround, '$%02.1f' % courseOverGround,
-                        timeUtc.strftime("%d%m%y"), '', '', mode ))))
-        if n2kd.waterDepthValid():
-          nmeafile.write("%\r\n" % str(pynmea2.DPT('SD', 'DPT',
-                        ( '%02.2f' % waterDepth, '00.00' ))))
-      
-      # display data
-      displayHandler.setValues(speedThroughWater, speedOverGround, waterDepth, waterTemperature, gpsFix)
-      
-      #check for shutdown request
-      checkShutdownRequest(shutdownfile)
-       
-  except (KeyboardInterrupt, SystemExit): #when you press ctrl+c
-    if nmeafile:
-      nmeafile.close()
-    if gpsp.ident is not None:
-      gpsp.stop()
-      gpsp.join() # wait for the thread to finish what it's doing
-    if n2kd.ident is not None:
-      n2kd.stop()
-      n2kd.join()
-    if displayHandler.ident is not None:
-      displayHandler.stop()
-      displayHandler.join() # wait for the thread to finish what it's doing
+    global rrdfile
+    global shutdownfile
+    global logperiod
+    global displayperiod
+    global logfile
+    global nmeafile
+
+    try:
+        opts, args = getopt.getopt(argv, "hr:s:l:d:o:", [
+                                   "help", "rrdfile=", "shutdownfile=", "logperiod=", "displayperiod=", "output="])
+    except getopt.GetoptError:
+        usage()
+        sys.exit(2)
+
+    for option, argument in opts:
+        if option == ("-h", "--help"):
+            usage()
+            sys.exit()
+        elif option in ("-r", "--rrdfile"):
+            rrdfile = argument
+        elif option in ("-s", "--shutdownfile"):
+            shutdownfile = argument
+        elif option in ("-l", "--logperiod"):
+            logperiod = argument
+        elif option in ("-d", "--displayperiod"):
+            displayperiod = argument
+        elif option in ("-o", "--output"):
+            logfile = argument
+        else:
+            assert False, "unhandled option"
+
+    if not os.path.exists(os.path.dirname(rrdfile)):
+        print "rrd database directory not found %s" % os.path.dirname(rrdfile)
+        print ""
+        usage()
+        sys.exit(2)
+
+    if not os.path.exists(os.path.dirname(shutdownfile)):
+        print "Shutdown request directory not found %s" % os.path.dirname(shutdownfile)
+        print ""
+        usage()
+        sys.exit(2)
+
+    if logperiod < 1:
+        print "Log period must be >= 1"
+        print ""
+        usage()
+        sys.exit(2)
+
+    if displayperiod < 1 or displayperiod < logperiod:
+        print "Display period must be >= 1 and could not be faster than log period"
+        print ""
+        usage()
+        sys.exit(2)
+
+    createDatabase(rrdfile)
+
+    try:
+        nmeafile = open(logfile, 'a', 0)
+    except IOError as error:
+        print "Could not open the logfile: %s" % error
+        sys.exit(2)
+
+    displayHandler = daemon.DisplayHandler(displayperiod)
+
+    gpsp = daemon.GpsdPoller(logperiod)
+    n2kd = daemon.N2kdPoller(logperiod)
+    try:
+        gpsp.start()
+        n2kd.start()
+        while True:
+            # In the main thread, every logPeriod seconds print the current
+            # value
+            time.sleep(logperiod)
+            latitude = gpsp.latitude()
+            longitude = gpsp.longitude()
+            speedThroughWater = n2kd.speedThroughWater()
+            speedOverGround = gpsp.speedOverGround()
+            waterDepth = n2kd.waterDepth()
+            waterTemperature = n2kd.waterTemperature()
+            gpsFix = gpsp.gpsFix()
+
+            # update rrd database for the webservice
+            rrdtool.update(rrdfile, "N:%s:%s:%s:%s:%s:%s:%s" % (
+                latitude, longitude, speedThroughWater, speedOverGround, waterDepth, waterTemperature, gpsFix))
+
+            # append to log
+            if gpsp.gpsFix() >= 2:
+                timeUtc = gpsp.timeUtc()
+                status = gpsp.status()
+                latitudeDirection = gpsp.latitudeDirection()
+                longitudeDirection = gpsp.longitudeDirection()
+                courseOverGround = gpsp.courseOverGround()
+
+                mode = 'N'
+                if gpsFix >= 2:
+                    mode = 'A'
+
+                nmeafile.write("%s\r\n" % str(pynmea2.RMC('GN', 'RMC',
+                                                          (timeUtc.strftime("%H%M%S"), status, '$%04.3f' % latitude,
+                                                           latitudeDirection, '$%05.3f' % longitude, longitudeDirection,
+                                                           '$%02.1f' % speedOverGround, '$%02.1f' % courseOverGround,
+                                                           timeUtc.strftime("%d%m%y"), '', '', mode))))
+                if n2kd.waterDepthValid():
+                    nmeafile.write("%\r\n" % str(pynmea2.DPT('SD', 'DPT',
+                                                             ('%02.2f' % waterDepth, '00.00'))))
+
+            # display data
+            displayHandler.setValues(
+                speedThroughWater, speedOverGround, waterDepth, waterTemperature, gpsFix)
+
+            # check for shutdown request
+            checkShutdownRequest(shutdownfile)
+
+    except (KeyboardInterrupt, SystemExit):  # when you press ctrl+c
+        if nmeafile:
+            nmeafile.close()
+        if gpsp.ident is not None:
+            gpsp.stop()
+            gpsp.join()  # wait for the thread to finish what it's doing
+        if n2kd.ident is not None:
+            n2kd.stop()
+            n2kd.join()
+        if displayHandler.ident is not None:
+            displayHandler.stop()
+            # wait for the thread to finish what it's doing
+            displayHandler.join()
 
 if __name__ == "__main__":
-  main(sys.argv[1:])
+    main(sys.argv[1:])
Index: src/python/bin/gnuboat-splashscreen
===================================================================
--- src/python/bin/gnuboat-splashscreen	(revision cfdd201c44f868b82017703d68cd25366515bfe9)
+++ src/python/bin/gnuboat-splashscreen	(revision 8befa17780ea19ee1505da184d9942365ba1b034)
@@ -21,58 +21,61 @@
 import getopt
 try:
-  from PIL import Image
-  from PIL import ImageOps
-  from EPD import EPD
-  epdEnabled = True
+    from PIL import Image
+    from PIL import ImageOps
+    from EPD import EPD
+    epdEnabled = True
 except:
-  epdEnabled = False
+    epdEnabled = False
+
 
 def displayImage(epd, imageFilePath):
-  image = Image.open(imageFilePath)
-  image = ImageOps.grayscale(image)
-  imageResized = image.resize((epd.width, epd.height))
-  imageBlackWhite = imageResized.convert("1", dither=Image.FLOYDSTEINBERG)
-  epd.display(imageBlackWhite)
-  epd.update()
+    image = Image.open(imageFilePath)
+    image = ImageOps.grayscale(image)
+    imageResized = image.resize((epd.width, epd.height))
+    imageBlackWhite = imageResized.convert("1", dither=Image.FLOYDSTEINBERG)
+    epd.display(imageBlackWhite)
+    epd.update()
+
 
 def usage():
-  print "Usage of gnuboat-splashscreen:"
-  print "  gnuboat-splashscreen [-h] -i PATH_TO_IMAGE_TO_DISPLAY"
-  print ""
-  print "  -h --help    Print this help"
-  print "  -i --image   Path to the image, which should be displayed"
-  sys.exit()
+    print "Usage of gnuboat-splashscreen:"
+    print "  gnuboat-splashscreen [-h] -i PATH_TO_IMAGE_TO_DISPLAY"
+    print ""
+    print "  -h --help    Print this help"
+    print "  -i --image   Path to the image, which should be displayed"
+    sys.exit()
 
-def main(argv):                      
-  image = ""                 
-  try:                                
-    opts, args = getopt.getopt(argv, "hi:", ["help", "image="]) 
-  except getopt.GetoptError:           
-    usage()                          
-    sys.exit(2)
 
-  for option, argument in opts:
-    if option == ("-h", "--help"):
-      usage()
-      sys.exit()
-    elif option in ("-i", "--image"):
-       image = argument
-    else:
-      assert False, "unhandled option"
+def main(argv):
+    image = ""
+    try:
+        opts, args = getopt.getopt(argv, "hi:", ["help", "image="])
+    except getopt.GetoptError:
+        usage()
+        sys.exit(2)
 
-  if not os.path.exists(image):
-    print "Image %s not found" % image
-    print ""
-    usage()
-    sys.exit(2)
+    for option, argument in opts:
+        if option == ("-h", "--help"):
+            usage()
+            sys.exit()
+        elif option in ("-i", "--image"):
+            image = argument
+        else:
+            assert False, "unhandled option"
 
-  if not epdEnabled:
-    print "Could not initialize EPD or PIL python packages"
-    sys.exit(2)
+    if not os.path.exists(image):
+        print "Image %s not found" % image
+        print ""
+        usage()
+        sys.exit(2)
 
-  epd = EPD()
-  epd.clear()
-  displayImage(epd, image)
+    if not epdEnabled:
+        print "Could not initialize EPD or PIL python packages"
+        sys.exit(2)
+
+    epd = EPD()
+    epd.clear()
+    displayImage(epd, image)
 
 if __name__ == "__main__":
-  main(sys.argv[1:])
+    main(sys.argv[1:])
