Commit Graph

1016 Commits

Author SHA1 Message Date
Anna Schumaker ec6744755d curds: Begin implementing a PlaylistNode
My intention is to try to match the GtkTreeModel interface in terms of
functionality. This way, each node can act as its own iterator.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 07:39:49 -04:00
Anna Schumaker 2ae7ac1aa1 curds: Check if the current playlist has changed from a single spot
This helps reduce code duplication, since we can just call a single
function to handle sending the changed() signal.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-15 21:09:28 -04:00
Anna Schumaker b0d124a0e5 curds: Previous playlist should send playlist-changed
Otherwise we won't update the row in the sidebar with the number of
tracks played.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 20:34:04 -04:00
Anna Schumaker 8eb865217a rind: Change playlists on double click
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 20:26:37 -04:00
Anna Schumaker 390f7c4a28 curds: Forbid selecting the Previous playlist
I guess this could be lifted later if anybody asks for it, but I don't
think this really makes sense as a playlist source.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 19:35:19 -04:00
Anna Schumaker 3871cc5d9c rind: Make the current playlist bold
This helps the user know what the current source of tracks is.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 19:26:04 -04:00
Anna Schumaker 6255e22cf0 curds: Send the playlist-changed notification when changin current
This tells the UI that it needs to update how playlists are displayed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 19:24:25 -04:00
Anna Schumaker 8a04d63c52 curds: Make it easier to send the playlist-changed notification
We're going to use this to notify that the current playlist has been
changed

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 17:36:37 -04:00
Anna Schumaker 6c0d269b2d curds: Clear the current list when selecting the Collection playlist
The collection playlist always has loop=True, so we'll never pop it from
the stack under normal conditions. Let's clear the list when selecting
this playlist so we don't keep a list of unreachable playlists.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 17:32:41 -04:00
Anna Schumaker b1521c3d35 curds: Push playlists to the front of the current list
And when we've played all the tracks, remove it.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 17:29:00 -04:00
Anna Schumaker b22ffbf5aa curds: Change PlaylistManager.current into a list
I'm going to keep a list of playlists that have been selected so we can
switch playlists automatically when one ends.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 16:37:27 -04:00
Anna Schumaker a7802b8794 rind: Set pause label text
I use my time remaining estimate to tell the user how many more tracks
until we pause.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-14 09:48:58 -04:00
Anna Schumaker 40a353681c rind: Show a popover when configuring automatic pausing
This will eventually display the remaining time before the pause takes
effect, but for now just show the widget.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-12 21:54:55 -04:00
Anna Schumaker 25c55fdac4 rind: Calculate an estimate for how long until we pause
I either round to the nearest minute or nearest 5-second interval
depending on how much time is left. This will eventually be used to
populate a GtkPopover to display the remaining time.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-12 16:07:28 -04:00
Anna Schumaker 01c4988cce rind: Make a function for converting seconds into a time string
We need to do this in a couple of different places, so let's make it
easier to do the conversion manually. Additionally, the datetime module
was having some trouble handling times over one hour. The new code
should handle it just fine, though.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-12 13:42:52 -04:00
Anna Schumaker d025727f1f curds: Add a function for peeking at the next few tracks
I'm planning to use this for the automatic pausing code to tell the user
how much longer until we pause.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-11 17:16:30 -04:00
Anna Schumaker 0985b2929b rind: Enable automatic pausing
Users tell us how many tracks they would like to listen to, and then we
pause when that is complete. I make sure we test the about-to-finish
signal with this patch, since we hadn't been doing that up until now.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-11 12:03:44 -04:00
Anna Schumaker e09a4ed6ae rind: Implement a custom spin button for automatic pause controls
We have to do this because the "input" signal attached to a real
Gtk.SpinButton is broken, and likes to increment from -1 to 1, bypassing
0 all together.

Of course, this is only a problem when I try to have "This Track" and
"Next Track" text displayed instead of numbers, but I think everything
looks nicer this way.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-10 17:52:45 -04:00
Anna Schumaker a226305623 rind: Refine the behavior of can_activate_entry()
Now we only toggle the show-more button state if the entry is already
focused. Otherwise, we allow the grab focus.

Additionally, I rename "updown_button" to "show_more" to match how it's
being used.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-09 11:20:58 -04:00
Anna Schumaker ce302ff773 rind: Add track filtering and pause-after widgets
I change the keyboard shortcuts up slightly with this patch:
- ctrl+m shows and hides the search widgets
- ctrl+f now shows the widgets and focuses the track filtering entry

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-08 21:17:14 -04:00
Anna Schumaker 7d470bbf94 rind: Split out gst seek tests
And also add in more comprehensive testing for seek_step()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-08 14:36:49 -04:00
Anna Schumaker a94996b3fa curds: Move the os.remove() onto the same line as the existence check
If everything goes well and the test passes, then this line will never
be reached. Let's move it so it doesn't skew the code coverage report.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-08 14:12:22 -04:00
Anna Schumaker 51ffc23a46 rind: Split out a test_gst_volume() function
The test_gst_controls() function is pretty long, so split this out into
a separate test.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-08 13:55:37 -04:00
Anna Schumaker ea0028e482 rind: Switch tests to the new gtk.main_loop() function
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-08 13:54:52 -04:00
Anna Schumaker dc3377bca5 rind: Improve the gtk unit test
- Make sure we properly test the idle_id
- Make sure we're testing all the can_activate_accel() code
- Provide a generic main_loop() function that can be used by other test
  code

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-08 13:44:50 -04:00
Anna Schumaker 36ff8414fb curds: Test finding the index of playlists not in the manager
We should make sure this returns None just like we expect.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-08 13:41:44 -04:00
Anna Schumaker 4187b3b8dc rind: Add seek keypresses
- Ctrl+Right seeks forward by 10 seconds
- Ctrl+Left seeks backwards by 10 seconds

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-07 21:03:14 -04:00
Anna Schumaker 0c1dcad3f3 rind: Add keyboard shortcuts
The following shortcuts are currently supported:
- Backspace: Previous song
- Return: Next Song
- Space: Toggle play / pause
- Ctrl+f: Open search bar
- Ctrl+s: Open search bar and focus search entry
- Ctrl+r: Toggle random
- Ctrl+Up: Increase volume
- Ctrl+Down: Decrease volume

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-07 20:25:01 -04:00
Anna Schumaker 7ec500bcd7 rind: Add runtime label
I add this to the overlay so it doesn't take up space on its own.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-06 21:33:24 -04:00
Anna Schumaker c2d876b545 curds: Also clear queued tasks when resetting
Otherwise we could end up sending notifications that don't make any
sense after their corresponding test ends.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-06 21:17:43 -04:00
Anna Schumaker 50a86f0edd rind: Add playlist filtering
This patch allows the user to filter playlists based on text that they
enter. I use the python regex module to handle searching, which gives
the user more flexibility in how they search. If the user inputs an
invalid regular expression, then I apply the "warning" style class to
the entry to let them know something has gone wrong.

I needed to change how the new-playlist signal is handled when I
switched over to using the playlist entry. For some reason the
GtkTreeModelFilter would glitch out whenever I sent the row-added
signal, so instead I let the filter model detect new rows when their
size is set instead. This seems to work, even if it's not how everything
is intended to be used.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-06 21:01:36 -04:00
Anna Schumaker 786ed226fe rind: Allow new-playlist notifications to run in other threads
We really need the UI to know about playlists as early as possible, so
send that notification as soon as playlists are allocated to avoid
potential ordering issues with the track scanning thread.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-05 14:02:28 -04:00
Anna Schumaker 0e6b788af1 curds: Improve queueing notifications
The UI might take a while to process queued notifications, so to keep
from overwhelming the UI we want to only queue notification that haven't
been added already.

I also add in a lock around the notification queue since the main thread
processes notifications added by other threads.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-05 13:35:57 -04:00
Anna Schumaker 56f7930032 rind: Don't spawn multiple idle sources when tasks are queued
We don't want to overload the application with multiple idle sources
running in parallel.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-05 10:27:54 -04:00
Anna Schumaker 07d1e1e113 rind: Clean up playlist manager selection test
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-04 15:19:18 -04:00
Anna Schumaker 9af3d251c1 rind: Start idle processing when a task has been queued
And stop the idle source when all tasks have been processed.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-04 13:50:27 -04:00
Anna Schumaker 6c7e063eac curds: Send a notification when a notification is queued
This lets the UI know that it has something to process when it gets the
chance. Additionally, I change the return value of run_queued() to
return false when there are no tasks remaining on the queue.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-04 13:50:01 -04:00
Anna Schumaker 8781ab1b3a rind: Make use of the new information in "new-playlist"
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-04 13:31:02 -04:00
Anna Schumaker ad9828c494 curds: Send the "new-playlist" notification after playlists are alloc-ed
Rather than doing this as part of the playlist constructor. This ensures
that the UI is notified AFTER the playlist has been appended to the
PlaylistManager to prevent race conditions.

Additionally, I send the sorted index of the playlist and an indicator
if this is the first playlist added as part of the notification to help
 make the UI's job easier.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-04 13:30:58 -04:00
Anna Schumaker 791e126ace rind: Listen for the "playlist-changed" notification
We ask for the notification to be placed on the queue so multiple
changes to the same playlist will get batched together.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-04 09:28:04 -04:00
Anna Schumaker b5c15598bc curds: Send a "playlist-changed" notification
The playlist manager doesn't need all the information about what changed
in the playlist, since it's mostly just updating the track count. Let's
just send the playlist so it won't get queued multiple times.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-04 09:22:35 -04:00
Anna Schumaker 4b1ef863b8 rind: Make sure we test manger get_iter(), get_path(), and get_value()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-03 20:54:35 -04:00
Anna Schumaker b65a6d9929 rind: Rewrite playlist manager unittest
I was having some trouble when adding in a GtkTreeModelFilter, so I
figured a good first step is to make sure we're testing the TreeModel
properly

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-03 17:53:44 -04:00
Anna Schumaker 8c755300be rind: Clean up find_playlist() and iter_playlist() functions
Now that we can use direct indexing on the PlaylistManager, let's
simplify these functions. Additionally, I implemented an iter_valid()
function to help determin if we have a valid Gtk.TreeIter.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-03 17:50:32 -04:00
Anna Schumaker cfbb6cfcd9 curds: Add a Placeholder() instance to the playlist manager
This isn't intended to hold playlists. Instead, it represents extra
spacing between playlists for the UI.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-02 16:58:41 -04:00
Anna Schumaker 2cf0ad8df9 curds: Replace the Library.add() function with a lookup
This makes the user's intentions a little more explicit, and saves us a
couple of lines of code.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-02 16:55:07 -04:00
Anna Schumaker 084567e3b8 curds: Create the PlaylistManagerBase class
This replaces the PlaylistAllocator, and provides a true base class that
can be used by each type of playlist manager.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-02 16:55:05 -04:00
Anna Schumaker ebabf1a479 curds: Replace string indexing with a lookup function
This matches how we handle playlist lookups for the other playlist
managers.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-02 16:02:37 -04:00
Anna Schumaker 6a0d793fa7 curds: Convert PlaylistManager into a list
This lines up with how we handle the Library and Genre managers, and it
seems best to keep things consistent. For now, I keep string-indexing
implemented but I plan to switch over to numeric indexing soon.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-02 16:02:37 -04:00
Anna Schumaker 5a88fac10a curds: Add a way to get parent playlists from the playlist manager
We can figure this out a little easier on the backend side, so let's
handle this there rather than on the UI side

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-02 16:02:29 -04:00