Adjust line length to match Code Style Guide (see #103)
This commit is contained in:
parent
d2e1f6f5d8
commit
a1f8b73590
11 changed files with 436 additions and 258 deletions
|
|
@ -15,8 +15,8 @@ class CoverPanel(Gtk.Overlay):
|
|||
__gtype_name__ = 'McgCoverPanel'
|
||||
__gsignals__ = {
|
||||
'toggle-fullscreen': (GObject.SIGNAL_RUN_FIRST, None, ()),
|
||||
'set-song': (GObject.SIGNAL_RUN_FIRST, None, (int, int,)),
|
||||
'albumart': (GObject.SIGNAL_RUN_FIRST, None, (str,))
|
||||
'set-song': (GObject.SIGNAL_RUN_FIRST, None, (int, int, )),
|
||||
'albumart': (GObject.SIGNAL_RUN_FIRST, None, (str, ))
|
||||
}
|
||||
|
||||
# Widgets
|
||||
|
|
@ -47,7 +47,8 @@ class CoverPanel(Gtk.Overlay):
|
|||
self._cover_pixbuf = None
|
||||
self._timer = None
|
||||
self._properties = {}
|
||||
self._icon_theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default())
|
||||
self._icon_theme = Gtk.IconTheme.get_for_display(
|
||||
Gdk.Display.get_default())
|
||||
self._fullscreened = False
|
||||
self._current_size = None
|
||||
|
||||
|
|
@ -62,7 +63,8 @@ class CoverPanel(Gtk.Overlay):
|
|||
# Button controller for songs scale
|
||||
buttonController = Gtk.GestureClick()
|
||||
buttonController.connect('pressed', self.on_songs_scale_pressed)
|
||||
buttonController.connect('unpaired-release', self.on_songs_scale_released)
|
||||
buttonController.connect('unpaired-release',
|
||||
self.on_songs_scale_released)
|
||||
self.songs_scale.add_controller(buttonController)
|
||||
|
||||
def get_toolbar(self):
|
||||
|
|
@ -89,7 +91,7 @@ class CoverPanel(Gtk.Overlay):
|
|||
time = self._current_album.get_length()
|
||||
tracks = self._current_album.get_tracks()
|
||||
pos = 0
|
||||
for index in range(len(tracks)-1, -1, -1):
|
||||
for index in range(len(tracks) - 1, -1, -1):
|
||||
time = time - tracks[index].get_length()
|
||||
pos = tracks[index].get_pos()
|
||||
if time < value:
|
||||
|
|
@ -102,7 +104,8 @@ class CoverPanel(Gtk.Overlay):
|
|||
# Set labels
|
||||
self.album_title_label.set_label(album.get_title())
|
||||
self.album_date_label.set_label(', '.join(album.get_dates()))
|
||||
self.album_artist_label.set_label(', '.join(album.get_albumartists()))
|
||||
self.album_artist_label.set_label(', '.join(
|
||||
album.get_albumartists()))
|
||||
|
||||
# Set tracks
|
||||
self._set_tracks(album)
|
||||
|
|
@ -126,7 +129,7 @@ class CoverPanel(Gtk.Overlay):
|
|||
for index in range(0, pos):
|
||||
time = time + tracks[index].get_length()
|
||||
|
||||
self.songs_scale.set_value(time+1)
|
||||
self.songs_scale.set_value(time + 1)
|
||||
self._timer = GObject.timeout_add(1000, self._playing)
|
||||
|
||||
def set_pause(self):
|
||||
|
|
@ -171,18 +174,12 @@ class CoverPanel(Gtk.Overlay):
|
|||
if length > 0 and length < album.get_length():
|
||||
cur_length = cur_length + 1
|
||||
self.songs_scale.add_mark(
|
||||
cur_length,
|
||||
Gtk.PositionType.RIGHT,
|
||||
GObject.markup_escape_text(
|
||||
Utils.create_track_title(track)
|
||||
)
|
||||
)
|
||||
cur_length, Gtk.PositionType.RIGHT,
|
||||
GObject.markup_escape_text(Utils.create_track_title(track)))
|
||||
length = length + track.get_length()
|
||||
self.songs_scale.add_mark(
|
||||
length,
|
||||
Gtk.PositionType.RIGHT,
|
||||
"{0[0]:02d}:{0[1]:02d} minutes".format(divmod(length, 60))
|
||||
)
|
||||
length, Gtk.PositionType.RIGHT,
|
||||
"{0[0]:02d}:{0[1]:02d} minutes".format(divmod(length, 60)))
|
||||
|
||||
def _enable_tracklist(self):
|
||||
if self._current_album:
|
||||
|
|
@ -219,7 +216,10 @@ class CoverPanel(Gtk.Overlay):
|
|||
current_width, current_height = self._current_size
|
||||
if size_width == current_width and size_height == current_height:
|
||||
return
|
||||
self._current_size = (size_width, size_height,)
|
||||
self._current_size = (
|
||||
size_width,
|
||||
size_height,
|
||||
)
|
||||
|
||||
# Get pixelbuffer
|
||||
pixbuf = self._cover_pixbuf
|
||||
|
|
@ -234,9 +234,10 @@ class CoverPanel(Gtk.Overlay):
|
|||
ratio = min(ratioW, ratioH)
|
||||
ratio = min(ratio, 1)
|
||||
# Neue Breite und Höhe berechnen
|
||||
width = int(math.floor(pixbuf.get_width()*ratio))
|
||||
height = int(math.floor(pixbuf.get_height()*ratio))
|
||||
width = int(math.floor(pixbuf.get_width() * ratio))
|
||||
height = int(math.floor(pixbuf.get_height() * ratio))
|
||||
if width <= 0 or height <= 0:
|
||||
return
|
||||
self.cover_image.set_from_pixbuf(pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.HYPER))
|
||||
self.cover_image.set_from_pixbuf(
|
||||
pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.HYPER))
|
||||
self.cover_image.show()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue