Skip to content

Commit

Permalink
fixed alt text for covers
Browse files Browse the repository at this point in the history
  • Loading branch information
SoongNoonien committed Nov 1, 2024
1 parent 06a664e commit 7edf6e0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/plattenalbum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,9 @@ def set_paintable(self, paintable):
self._picture.set_valign(Gtk.Align.FILL)
self._picture.set_paintable(paintable)

def set_alt_text(self, alt_text):
self._picture.update_property([Gtk.AccessibleProperty.LABEL], [alt_text])

###########
# browser #
###########
Expand Down Expand Up @@ -1590,10 +1593,10 @@ def __init__(self, client):
def set_album(self, album):
if album.name:
self._title.set_text(album.name)
self._cover.update_property([Gtk.AccessibleProperty.LABEL], [_("Album cover of {album}").format(album=album.name)])
self._cover.set_alt_text(_("Album cover of {album}").format(album=album.name))
else:
self._title.set_markup(f'<i>{GLib.markup_escape_text(_("Unknown Album"))}</i>')
self._cover.update_property([Gtk.AccessibleProperty.LABEL], [_("Album cover of an unknown album")])
self._cover.set_alt_text(_("Album cover of an unknown album"))
self._date.set_text(album.date)
if album.cover is None:
self._client.tagtypes("clear")
Expand Down Expand Up @@ -1718,11 +1721,11 @@ def __init__(self, client, albumartist, album, date, file=None):
if album:
self.set_title(album)
window_title.set_title(album)
album_cover.update_property([Gtk.AccessibleProperty.LABEL], [_("Album cover of {album}").format(album=album)])
album_cover.set_alt_text(_("Album cover of {album}").format(album=album))
else:
self.set_title(_("Unknown Album"))
window_title.set_title(_("Unknown Album"))
album_cover.update_property([Gtk.AccessibleProperty.LABEL], [_("Album cover of an unknown album")])
album_cover.set_alt_text(_("Album cover of an unknown album"))
window_title.set_subtitle(" • ".join(filter(None, (date, str(Duration(client.count(*tag_filter)["playtime"]))))))
client.restrict_tagtypes("track", "title", "artist")
songs=client.find(*tag_filter)
Expand Down

0 comments on commit 7edf6e0

Please sign in to comment.