comparison web/log.py @ 478:fc8ddea46987

sort sensor lines
author Matt Johnston <matt@ucc.asn.au>
date Thu, 30 Jan 2014 22:56:05 +0800
parents c3926e7cfb0c
children e731c0d30b09
comparison
equal deleted inserted replaced
465:a40f30fad8f6 478:fc8ddea46987
75 #volts_shift = 2 75 #volts_shift = 2
76 volts_div = 1 76 volts_div = 1
77 volts_shift = 0 77 volts_shift = 0
78 78
79 volts_mult = 1.0/volts_div 79 volts_mult = 1.0/volts_div
80
81 # (title, sensorline) pairs.
82 sensor_lines = []
80 83
81 for n, (rrdfile, sensor) in enumerate(rrds): 84 for n, (rrdfile, sensor) in enumerate(rrds):
82 unit = None 85 unit = None
83 if 'avrtemp' in sensor: 86 if 'avrtemp' in sensor:
84 continue 87 continue
110 colour = config.SENSOR_COLOURS.get(legend, colour_from_string(sensor)) 113 colour = config.SENSOR_COLOURS.get(legend, colour_from_string(sensor))
111 if format_last_value: 114 if format_last_value:
112 print_legend = '%s (%s)' % (legend, format_last_value) 115 print_legend = '%s (%s)' % (legend, format_last_value)
113 else: 116 else:
114 print_legend = legend 117 print_legend = legend
115 graph_args.append('LINE%(width)f:%(vname)s#%(colour)s:%(print_legend)s' % locals()) 118 sensor_lines.append( (legend, 'LINE%(width)f:%(vname)s#%(colour)s:%(print_legend)s' % locals()) )
119
120 sensor_lines.sort(key = lambda (legend, line): "Wort" in legend)
121
122 graph_args += (line for (legend, line) in sensor_lines)
116 123
117 end = int(start+length) 124 end = int(start+length)
118 start = int(start) 125 start = int(start)
119 126
120 tempf = tempfile.NamedTemporaryFile() 127 tempf = tempfile.NamedTemporaryFile()