Files
cartridges/cartridges/ui/cover.py
kramo 2dba556086 window: Hook up actions to UI
Co-authored-by: Jamie Gravendeel <me@jamie.garden>
2025-12-01 03:13:36 +01:00

24 lines
736 B
Python

# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright 2025 kramo
from gi.repository import Adw, Gdk, GObject, Gtk
from cartridges.config import APP_ID, PREFIX
@Gtk.Template.from_resource(f"{PREFIX}/cover.ui")
class Cover(Adw.Bin):
"""Displays a game's cover art."""
__gtype_name__ = __qualname__
picture = GObject.Property(lambda self: self._picture, type=Gtk.Picture)
paintable = GObject.Property(type=Gdk.Paintable)
app_icon_name = GObject.Property(type=str, default=f"{APP_ID}-symbolic")
_picture = Gtk.Template.Child()
@Gtk.Template.Callback()
def _get_stack_child(self, _obj, paintable: Gdk.Paintable | None) -> str:
return "cover" if paintable else "icon"