temp: Honor color setting when pango is enabled and dynamic color is False (#625)

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
This commit is contained in:
Johannes Löthberg 2017-11-21 01:09:50 +01:00 committed by Facetoe
parent 9818e8d750
commit 8682fa232a

View File

@ -209,7 +209,8 @@ class Temperature(IntervalModule, ColorRangeModule):
data['temp'] = max((s.current for s in found_sensors)) data['temp'] = max((s.current for s in found_sensors))
return { return {
'full_text': self.format.format(**data), 'full_text': self.format.format(**data),
'urgent': self.get_urgent(found_sensors) 'urgent': self.get_urgent(found_sensors),
'color': self.color if not self.dynamic_color else None,
} }
def get_urgent(self, sensors): def get_urgent(self, sensors):
@ -230,9 +231,7 @@ class Temperature(IntervalModule, ColorRangeModule):
percentage = self.percentage(sensor.current, sensor.critical) percentage = self.percentage(sensor.current, sensor.critical)
if self.dynamic_color: if self.dynamic_color:
color = self.colors[int(percentage)] color = self.colors[int(percentage)]
else: return self.format_pango(color, current_val)
color = self.color
return self.format_pango(color, current_val)
return current_val return current_val
def format_sensor_bar(self, sensor): def format_sensor_bar(self, sensor):
@ -242,9 +241,7 @@ class Temperature(IntervalModule, ColorRangeModule):
if self.pango_enabled: if self.pango_enabled:
if self.dynamic_color: if self.dynamic_color:
color = self.colors[int(percentage)] color = self.colors[int(percentage)]
else: return self.format_pango(color, bar)
color = self.color
return self.format_pango(color, bar)
return bar return bar
def format_pango(self, color, value): def format_pango(self, color, value):