# HG changeset patch # User Matt Johnston # Date 1340552905 -28800 # Node ID cec925666c270280abe04beb7b4cf44b3d268bd5 # Parent 8e897a682208a5293a2881157189d90b16bf43cd# Parent 79761ee67134eb58187b362fa60c2ca12017848c merge diff -r 8e897a682208 -r cec925666c27 web/config.py --- a/web/config.py Sun Jun 24 23:47:56 2012 +0800 +++ b/web/config.py Sun Jun 24 23:48:25 2012 +0800 @@ -10,8 +10,9 @@ LINE_WIDTH = 2 -SENSOR_NAMES = {'sensor_test1': "First Test"} +SENSOR_NAMES = {'sensor_28 CE B2 1A 03 00 00 99': "Wort", + 'sensor_28 CC C1 1A 03 00 00 D4': "Board"} -SENSOR_COLOURS = {} +SENSOR_COLOURS = {'Wort': 'e49222', 'Board': '028b3d'} GRAPH_FONT = "Courier" diff -r 8e897a682208 -r cec925666c27 web/log.py --- a/web/log.py Sun Jun 24 23:47:56 2012 +0800 +++ b/web/log.py Sun Jun 24 23:48:25 2012 +0800 @@ -62,12 +62,15 @@ '-h', str(config.GRAPH_HEIGHT), '--slope-mode', '--border', '0', + '--y-grid', '1:1', + '--grid-dash', '1:0', + '--color', 'GRID#00000000', + '--color', 'MGRID#aaaaaa', '--color', 'BACK#ffffff', - '--alt-y-grid', '--imgformat', 'PNG'] \ + graph_args if config.GRAPH_FONT: - args += ['--font', 'DEFAULT:0:%s' % config.GRAPH_FONT] + args += ['--font', 'DEFAULT:11:%s' % config.GRAPH_FONT] print>>sys.stderr, args rrdtool.graph(*args) return tempf.read() diff -r 8e897a682208 -r cec925666c27 web/templog.py --- a/web/templog.py Sun Jun 24 23:47:56 2012 +0800 +++ b/web/templog.py Sun Jun 24 23:48:25 2012 +0800 @@ -32,11 +32,15 @@ if 'day' in request.query: start_day = datetime.datetime.strptime(request.query.day, '%Y%m%d') start = time.mktime(start_day.timetuple()) - length = int(request.query.length) * 3600 * 24 + length = int(request.query.get('length', 5)) * 3600 * 24 else: - start_hour = datetime.datetime.strptime(request.query.hour, '%Y%m%d%H') + if 'hour' in request.query: + start_hour = datetime.datetime.strptime(request.query.hour, '%Y%m%d%H') + else: + start_hour = datetime.datetime.now() - datetime.timedelta(days=1) + start = time.mktime(start_hour.timetuple()) - length = int(request.query.length) * 3600 + length = int(request.query.get('length', 36)) * 3600 response.set_header('Content-Type', 'image/png') return log.graph_png(start, length)