Change the battery icon to one in the adwaita icon theme
The previous one must've been from some leftover theme I had sitting around.
This commit is contained in:
parent
5f5c49b6d0
commit
de23da9a84
|
@ -72,7 +72,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="margin_left">10</property>
|
<property name="margin_left">10</property>
|
||||||
<property name="margin_right">10</property>
|
<property name="margin_right">10</property>
|
||||||
<property name="icon_name">battery-empty-symbolic</property>
|
<property name="icon_name">battery-missing-symbolic</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
|
@ -84,14 +84,20 @@ class DrawingPerspective(Gtk.Stack):
|
||||||
self.device.connect('notify::drawings-available',
|
self.device.connect('notify::drawings-available',
|
||||||
self._update_drawings)
|
self._update_drawings)
|
||||||
|
|
||||||
# icon name is something like battery-020-charging, or battery-040
|
if device.battery_percent > 80:
|
||||||
# in 20-step increments
|
percent = 'full'
|
||||||
|
elif device.battery_percent > 40:
|
||||||
|
percent = 'good'
|
||||||
|
elif device.battery_percent > 10:
|
||||||
|
percent = 'low'
|
||||||
|
else:
|
||||||
|
percent = 'caution'
|
||||||
|
|
||||||
if device.battery_state == 1:
|
if device.battery_state == 1:
|
||||||
state = '-charging'
|
state = '-charging'
|
||||||
else:
|
else:
|
||||||
state = ''
|
state = ''
|
||||||
percent = f'{int(device.battery_percent/20) * 20:03d}'
|
batt_icon_name = f'battery-{percent}{state}-symbolic'
|
||||||
batt_icon_name = f'battery-{percent}{state}'
|
|
||||||
_, isize = self.image_battery.get_icon_name()
|
_, isize = self.image_battery.get_icon_name()
|
||||||
self.image_battery.set_from_icon_name(batt_icon_name, isize)
|
self.image_battery.set_from_icon_name(batt_icon_name, isize)
|
||||||
self._update_drawings(self.device, None)
|
self._update_drawings(self.device, None)
|
||||||
|
|
Loading…
Reference in New Issue