Adjust blank lines to match Code Style Guide (see #103)
This commit is contained in:
parent
75b99e5820
commit
d2e1f6f5d8
14 changed files with 14 additions and 413 deletions
21
src/utils.py
21
src/utils.py
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version('Gtk', '4.0')
|
||||
import hashlib
|
||||
import locale
|
||||
|
|
@ -11,13 +11,10 @@ import urllib
|
|||
from gi.repository import Gdk, GdkPixbuf, GObject, Gtk
|
||||
|
||||
|
||||
|
||||
|
||||
class Utils:
|
||||
CSS_SELECTION = 'selection'
|
||||
STOCK_ICON_DEFAULT = 'image-x-generic-symbolic'
|
||||
|
||||
|
||||
def load_pixbuf(data):
|
||||
loader = GdkPixbuf.PixbufLoader()
|
||||
try:
|
||||
|
|
@ -26,7 +23,6 @@ class Utils:
|
|||
loader.close()
|
||||
return loader.get_pixbuf()
|
||||
|
||||
|
||||
def load_thumbnail(cache, client, album, size):
|
||||
cache_url = cache.create_filename(album)
|
||||
pixbuf = None
|
||||
|
|
@ -43,7 +39,6 @@ class Utils:
|
|||
pixbuf.savev(cache_url, 'jpeg', [], [])
|
||||
return pixbuf
|
||||
|
||||
|
||||
def create_artists_label(album):
|
||||
label = ', '.join(album.get_albumartists())
|
||||
if album.get_artists():
|
||||
|
|
@ -53,14 +48,12 @@ class Utils:
|
|||
)
|
||||
return label
|
||||
|
||||
|
||||
def create_length_label(album):
|
||||
minutes = album.get_length() // 60
|
||||
seconds = album.get_length() - minutes * 60
|
||||
|
||||
return locale.gettext("{}:{} minutes").format(minutes, seconds)
|
||||
|
||||
|
||||
def create_track_title(track):
|
||||
title = track.get_title()
|
||||
if track.get_artists():
|
||||
|
|
@ -70,7 +63,6 @@ class Utils:
|
|||
)
|
||||
return title
|
||||
|
||||
|
||||
def generate_id(values):
|
||||
if type(values) is not list:
|
||||
values = [values]
|
||||
|
|
@ -80,8 +72,6 @@ class Utils:
|
|||
return m.hexdigest()
|
||||
|
||||
|
||||
|
||||
|
||||
class SortOrder:
|
||||
ARTIST = 0
|
||||
TITLE = 1
|
||||
|
|
@ -89,15 +79,12 @@ class SortOrder:
|
|||
MODIFIED = 3
|
||||
|
||||
|
||||
|
||||
|
||||
class GridItem(GObject.GObject):
|
||||
__gtype_name__ = "GridItem"
|
||||
|
||||
tooltip = GObject.Property(type=str, default=None)
|
||||
cover = GObject.Property(type=Gdk.Paintable, default=None)
|
||||
|
||||
|
||||
def __init__(self, album, cover):
|
||||
super().__init__()
|
||||
self._album = album
|
||||
|
|
@ -110,24 +97,18 @@ class GridItem(GObject.GObject):
|
|||
Utils.create_length_label(album)
|
||||
]))
|
||||
|
||||
|
||||
def get_album(self):
|
||||
return self._album
|
||||
|
||||
|
||||
def set_cover(self, cover):
|
||||
self.cover = Gdk.Texture.new_for_pixbuf(cover)
|
||||
|
||||
|
||||
|
||||
|
||||
class SearchFilter(Gtk.Filter):
|
||||
|
||||
|
||||
def __init__(self, search_string):
|
||||
super().__init__()
|
||||
self._search_string = search_string
|
||||
|
||||
|
||||
def do_match(self, grid_item):
|
||||
return grid_item.get_album().filter(self._search_string)
|
||||
|
|
|
|||
Loading…
Reference in a new issue