#!/usr/bin/env python3 import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from .image import ScaleImage from assets import image_dict class DiskBox(Gtk.Fixed): def __init__(self): Gtk.Fixed.__init__(self) disk = ScaleImage(image_dict['disk']) handler = ScaleImage(image_dict['handler']) album = ScaleImage() disk.resize(192, 192) album.clip_resize(128).set_radius(64) handler.resize(48, 96) self.handler = handler self.album = album self.put(disk, 16, 16) self.put(album, 48, 48) self.put(handler, 0, 16) def update_state(self, played = False): if played: self.handler.reset(image_dict['handler_a']) else: self.handler.reset(image_dict['handler']) return self def update_album(self, filepath = None): self.album.reset(filepath, True).set_radius(64) return self