[gnome-music/wip/mschraal/player-factor-out-gstreamer] Move value-changed signal handling to player



commit 3a3ba4b695038569611f2a309447b592806c7fa4
Author: Marinus Schraal <mschraal gnome org>
Date:   Sat Feb 17 20:06:08 2018 +0100

    Move value-changed signal handling to player

 gnomemusic/player.py              | 6 ++++++
 gnomemusic/widgets/smoothscale.py | 8 --------
 2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 7224ef3..fb4f478 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -603,6 +603,8 @@ class Player(GObject.GObject):
 
         self._progress_scale.connect('seek-finished', self._on_seek_finished)
         self._progress_scale.connect('seconds-tick', self._on_seconds_tick)
+        self._progress_scale.connect(
+            'value-changed', self._on_progress_value_changed)
 
         self._progress_time_label = self._ui.get_object('playback')
         self._total_time_label = self._ui.get_object('duration')
@@ -622,6 +624,10 @@ class Player(GObject.GObject):
         self._play_button.connect('clicked', self._on_play_button_clicked)
         self._next_button.connect('clicked', self._on_next_button_clicked)
 
+    def _on_progress_value_changed(self, progress_scale):
+        seconds = int(progress_scale.get_value() / 60)
+        self._progress_time_label.set_label(utils.seconds_to_string(seconds))
+
     @log
     def _on_seek_finished(self, klass, time):
         self._player.state = Playback.PLAYING
diff --git a/gnomemusic/widgets/smoothscale.py b/gnomemusic/widgets/smoothscale.py
index dd6bff9..6261e3d 100644
--- a/gnomemusic/widgets/smoothscale.py
+++ b/gnomemusic/widgets/smoothscale.py
@@ -65,7 +65,6 @@ class SmoothScale(Gtk.Scale):
         self.played_seconds = 0
 
         self.connect('button-press-event', self._on_progress_scale_event)
-        self.connect('value-changed', self._on_progress_value_changed)
         self.connect('button-release-event', self._on_progress_scale_button_released)
         self.connect('change-value', self._on_progress_scale_seek)
         self._ps_draw = self.connect('draw', self._on_progress_scale_draw)
@@ -145,12 +144,6 @@ class SmoothScale(Gtk.Scale):
         self._update_position_callback()
         return False
 
-    def _on_progress_value_changed(self, widget):
-        # seconds = int(self.get_value() / 60)
-        # self._progress_time_label.set_label(utils.seconds_to_string(seconds))
-        # return False
-        pass
-
     @log
     def _on_progress_scale_event(self, scale, data):
         self._remove_timeout()
@@ -233,7 +226,6 @@ class SmoothScale(Gtk.Scale):
 
     @log
     def _update_seconds_callback(self):
-        self._on_progress_value_changed(None)
         self.emit('seconds-tick')
         return True
 


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