rind: Show the fill level when tracks are loaded

This is a small detail, but I like the idea of having an indicator when
tracks are loaded or not.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-03-21 14:22:14 -04:00
parent b9035abf8a
commit e403fd6ba9
3 changed files with 5 additions and 1 deletions

View File

@ -165,7 +165,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">progress_adjustment</property>
<property name="show_fill_level">True</property>
<property name="fill_level">100</property>
<property name="digits">-1</property>
<property name="draw_value">False</property>

View File

@ -57,6 +57,8 @@ class EmmentalAudio:
(old, new, pending) = message.parse_state_changed()
PlayButton.set_visible( new != Gst.State.PLAYING)
PauseButton.set_visible(new == Gst.State.PLAYING)
ProgScale.set_show_fill_level(new == Gst.State.PLAYING or
new == Gst.State.PAUSED)
if new == Gst.State.READY:
Title.set_markup("<big>Emmental</big>")
Artist.set_markup("<big>The Cheesy Music Player</big>")

View File

@ -63,6 +63,8 @@ class TestGst(unittest.TestCase):
self.assertEqual(gst.Adjustment.get_value(), 0.0)
self.assertEqual(gst.Position.get_text(), "00:00")
self.assertEqual(gst.Duration.get_text(), "-00:00")
self.assertFalse(gst.ProgScale.get_show_fill_level())
self.assertEqual(gst.ProgScale.get_fill_level(), 100.0)
self.audio.load(None)
self.assertFalse(gst.PauseButton.is_visible())
@ -94,6 +96,7 @@ class TestGst(unittest.TestCase):
self.main_loop()
self.assertEqual(self.state, Gst.State.PLAYING)
self.assertTrue( gst.ProgScale.get_show_fill_level())
self.assertGreater(self.audio.progress(), 0)
self.assertGreater(self.audio.position(), 0)