Rename a the variable used to generate the icon name

pull/145/head
Peter Hutterer 2019-07-16 11:06:57 +10:00
parent c7fe771082
commit 6c8d586caa
1 changed files with 5 additions and 5 deletions

View File

@ -102,19 +102,19 @@ class DrawingPerspective(Gtk.Stack):
def _on_battery_changed(self, device, pspec):
if device.battery_percent > 80:
percent = 'full'
fill = 'full'
elif device.battery_percent > 40:
percent = 'good'
fill = 'good'
elif device.battery_percent > 10:
percent = 'low'
fill = 'low'
else:
percent = 'caution'
fill = 'caution'
if device.battery_state == 1:
state = '-charging'
else:
state = ''
batt_icon_name = f'battery-{percent}{state}-symbolic'
batt_icon_name = f'battery-{fill}{state}-symbolic'
_, isize = self.image_battery.get_icon_name()
self.image_battery.set_from_icon_name(batt_icon_name, isize)
self.image_battery.set_tooltip_text(f'{device.battery_percent}%')