[gnome-music/wip/mschraal/gapless-v3] player: Clarify song-changed signal argument



commit 038a45c6b10e2ae5ad627ecb65af8d2a8075d99d
Author: Marinus Schraal <mschraal gnome org>
Date:   Sat May 4 17:03:27 2019 +0200

    player: Clarify song-changed signal argument
    
    The playlist model index of the currently playing song was refered to as
    'position'. 'position' is also used for the time progress in the player.
    
    Refer to the playlist model index as 'index' instead.

 gnomemusic/mpris.py                      | 2 +-
 gnomemusic/views/playlistview.py         | 6 +++---
 gnomemusic/views/songsview.py            | 6 +++---
 gnomemusic/widgets/albumwidget.py        | 4 ++--
 gnomemusic/widgets/artistalbumswidget.py | 4 ++--
 gnomemusic/widgets/playertoolbar.py      | 4 ++--
 6 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 91464d0e..8ad0b4cb 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -440,7 +440,7 @@ class MediaPlayer2Service(Server):
         return (True, (path, playlist_name, ""))
 
     @log
-    def _on_current_song_changed(self, player, position):
+    def _on_current_song_changed(self, player, index):
         self._update_songs_list()
         if self.player.props.repeat_mode == RepeatMode.SONG:
             self.Seeked(0)
diff --git a/gnomemusic/views/playlistview.py b/gnomemusic/views/playlistview.py
index 1e6742ba..13e1770c 100644
--- a/gnomemusic/views/playlistview.py
+++ b/gnomemusic/views/playlistview.py
@@ -245,11 +245,11 @@ class PlaylistView(BaseView):
             cell.set_visible(False)
 
     @log
-    def _update_model(self, player, position):
+    def _update_model(self, player, index):
         """Updates model when the song changes
 
         :param Player player: The main player object
-        :param int position: current song position
+        :param int index: Current song playlist index
         """
         if self._current_playlist is None:
             return
@@ -260,7 +260,7 @@ class PlaylistView(BaseView):
                 PlayerPlaylist.Type.PLAYLIST, self._current_playlist.get_id()):
             return False
 
-        iter_ = self.model.get_iter_from_string(str(position))
+        iter_ = self.model.get_iter_from_string(str(index))
         self.model[iter_][10] = True
         path = self.model.get_path(iter_)
         self._view.scroll_to_cell(path, None, False, 0., 0.)
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index 32a8f46d..1c416a2a 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -229,18 +229,18 @@ class SongsView(BaseView):
             self.props.selected_items_count = len(self.get_selected_songs())
 
     @log
-    def _update_model(self, player, position):
+    def _update_model(self, player, index):
         """Updates model when the song changes
 
         :param Player player: The main player object
-        :param int position: current song position
+        :param int index: Current song playlist index
         """
         if self._iter_to_clean:
             self.model[self._iter_to_clean][10] = False
         if not player.playing_playlist(PlayerPlaylist.Type.SONGS, None):
             return False
 
-        iter_ = self.model.get_iter_from_string(str(position))
+        iter_ = self.model.get_iter_from_string(str(index))
         self.model[iter_][10] = True
         path = self.model.get_path(iter_)
         self._view.scroll_to_cell(path, None, False, 0., 0.)
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index f380ad2e..3a909c97 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -236,11 +236,11 @@ class AlbumWidget(Gtk.EventBox):
             self._update_model(self._player)
 
     @log
-    def _update_model(self, player, position=None):
+    def _update_model(self, player, index=None):
         """Updates model when the song changes
 
         :param Player player: The main player object
-        :param int position: current song position
+        :param int index: Current song model index
         """
         if not player.playing_playlist(
                 PlayerPlaylist.Type.ALBUM, self._album_name):
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index b9150d71..44c9bf8d 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -137,11 +137,11 @@ class ArtistAlbumsWidget(Gtk.Box):
         widget.connect('songs-loaded', self._on_album_displayed)
 
     @log
-    def _update_model(self, player, position):
+    def _update_model(self, player, index):
         """Updates model when the song changes
 
         :param Player player: The main player object
-        :param int position: current song position
+        :param int index: Current song model index
         """
         if not player.playing_playlist(
                 PlayerPlaylist.Type.ARTIST, self._artist):
diff --git a/gnomemusic/widgets/playertoolbar.py b/gnomemusic/widgets/playertoolbar.py
index c58938aa..8cc97574 100644
--- a/gnomemusic/widgets/playertoolbar.py
+++ b/gnomemusic/widgets/playertoolbar.py
@@ -153,11 +153,11 @@ class PlayerToolbar(Gtk.ActionBar):
         self._prev_button.props.sensitive = self._player.props.has_previous
 
     @log
-    def _update_view(self, player, position):
+    def _update_view(self, player, index):
         """Update all visual elements on song change
 
         :param Player player: The main player object
-        :param int position: current song position
+        :param int index: Current song playlist index
         """
         current_song = player.props.current_song
         self._duration_label.set_label(


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]