Declare static methods with annotation (see #103)
This commit is contained in:
parent
54fe825acf
commit
420946d7d4
2 changed files with 7 additions and 0 deletions
|
|
@ -1035,6 +1035,7 @@ class MCGAlbum:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def compare(album1, album2, criterion=None, reverse=False):
|
def compare(album1, album2, criterion=None, reverse=False):
|
||||||
if criterion == None:
|
if criterion == None:
|
||||||
criterion = SortOrder.TITLE
|
criterion = SortOrder.TITLE
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ class Utils:
|
||||||
CSS_SELECTION = 'selection'
|
CSS_SELECTION = 'selection'
|
||||||
STOCK_ICON_DEFAULT = 'image-x-generic-symbolic'
|
STOCK_ICON_DEFAULT = 'image-x-generic-symbolic'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def load_pixbuf(data):
|
def load_pixbuf(data):
|
||||||
loader = GdkPixbuf.PixbufLoader()
|
loader = GdkPixbuf.PixbufLoader()
|
||||||
try:
|
try:
|
||||||
|
|
@ -21,6 +22,7 @@ class Utils:
|
||||||
loader.close()
|
loader.close()
|
||||||
return loader.get_pixbuf()
|
return loader.get_pixbuf()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def load_thumbnail(cache, client, album, size):
|
def load_thumbnail(cache, client, album, size):
|
||||||
cache_url = cache.create_filename(album)
|
cache_url = cache.create_filename(album)
|
||||||
pixbuf = None
|
pixbuf = None
|
||||||
|
|
@ -38,6 +40,7 @@ class Utils:
|
||||||
pixbuf.savev(cache_url, 'jpeg', [], [])
|
pixbuf.savev(cache_url, 'jpeg', [], [])
|
||||||
return pixbuf
|
return pixbuf
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def create_artists_label(album):
|
def create_artists_label(album):
|
||||||
label = ', '.join(album.get_albumartists())
|
label = ', '.join(album.get_albumartists())
|
||||||
if album.get_artists():
|
if album.get_artists():
|
||||||
|
|
@ -45,12 +48,14 @@ class Utils:
|
||||||
label, ", ".join(album.get_artists()))
|
label, ", ".join(album.get_artists()))
|
||||||
return label
|
return label
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def create_length_label(album):
|
def create_length_label(album):
|
||||||
minutes = album.get_length() // 60
|
minutes = album.get_length() // 60
|
||||||
seconds = album.get_length() - minutes * 60
|
seconds = album.get_length() - minutes * 60
|
||||||
|
|
||||||
return locale.gettext("{}:{} minutes").format(minutes, seconds)
|
return locale.gettext("{}:{} minutes").format(minutes, seconds)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def create_track_title(track):
|
def create_track_title(track):
|
||||||
title = track.get_title()
|
title = track.get_title()
|
||||||
if track.get_artists():
|
if track.get_artists():
|
||||||
|
|
@ -58,6 +63,7 @@ class Utils:
|
||||||
title, ", ".join(track.get_artists()))
|
title, ", ".join(track.get_artists()))
|
||||||
return title
|
return title
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def generate_id(values):
|
def generate_id(values):
|
||||||
if type(values) is not list:
|
if type(values) is not list:
|
||||||
values = [values]
|
values = [values]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue