Declare static methods with annotation (see #103)

This commit is contained in:
coderkun 2024-11-03 10:42:29 +01:00
parent 54fe825acf
commit 420946d7d4
2 changed files with 7 additions and 0 deletions

View file

@ -1035,6 +1035,7 @@ class MCGAlbum:
return False
return True
@staticmethod
def compare(album1, album2, criterion=None, reverse=False):
if criterion == None:
criterion = SortOrder.TITLE

View file

@ -13,6 +13,7 @@ class Utils:
CSS_SELECTION = 'selection'
STOCK_ICON_DEFAULT = 'image-x-generic-symbolic'
@staticmethod
def load_pixbuf(data):
loader = GdkPixbuf.PixbufLoader()
try:
@ -21,6 +22,7 @@ class Utils:
loader.close()
return loader.get_pixbuf()
@staticmethod
def load_thumbnail(cache, client, album, size):
cache_url = cache.create_filename(album)
pixbuf = None
@ -38,6 +40,7 @@ class Utils:
pixbuf.savev(cache_url, 'jpeg', [], [])
return pixbuf
@staticmethod
def create_artists_label(album):
label = ', '.join(album.get_albumartists())
if album.get_artists():
@ -45,12 +48,14 @@ class Utils:
label, ", ".join(album.get_artists()))
return label
@staticmethod
def create_length_label(album):
minutes = album.get_length() // 60
seconds = album.get_length() - minutes * 60
return locale.gettext("{}:{} minutes").format(minutes, seconds)
@staticmethod
def create_track_title(track):
title = track.get_title()
if track.get_artists():
@ -58,6 +63,7 @@ class Utils:
title, ", ".join(track.get_artists()))
return title
@staticmethod
def generate_id(values):
if type(values) is not list:
values = [values]