Ensure status icons always drawn in same place

This commit is contained in:
XANTRONIX Development 2024-01-06 20:10:24 -05:00
parent 949642499a
commit 1f443e97d5

View file

@ -298,18 +298,21 @@ class StatusIconBox(Gauge):
x, y = 0, self.height - self.ICON_HEIGHT x, y = 0, self.height - self.ICON_HEIGHT
for typeof in self.statuses: for icon_type in self.ICONS:
status = self.statuses[typeof] typeof = icon_type.TYPE
icon = self.icons[typeof] status = self.statuses.get(typeof)
if icon.drawable(status): if status is not None:
icon.draw(cr, x, y, status) icon = self.icons[typeof]
x += self.ICON_WIDTH if icon.drawable(status):
icon.draw(cr, x, y, status)
if x >= self.width: x += self.ICON_WIDTH
x = 0
y -= self.ICON_HEIGHT if x >= self.width:
x = 0
y -= self.ICON_HEIGHT
def draw_fg(self, cr: cairo.Context): def draw_fg(self, cr: cairo.Context):
if self._redraw: if self._redraw: