Commit Graph

1294 Commits

Author SHA1 Message Date
Anna Schumaker cd208134ec curds: Remove direct indexing from the PlaylistManager
The PlaylistNode class doesn't support this, so remove it now.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-18 10:45:07 -04:00
Anna Schumaker 8434446dcd curds: PlaylistManager shouldn't inherit from list
This is just the next step in changing this into a PlaylistNode

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-18 10:38:38 -04:00
Anna Schumaker 8ab2d97cf5 curds: Clean up how nodes are inserted and linked
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 16:57:22 -04:00
Anna Schumaker 91a606e054 curds: Add .parent variable to the PlaylistManager
And then clean up the ManagerModel with the node functions that we can
now use.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 16:14:33 -04:00
Anna Schumaker 8aff4d7f8a curds: Remove the PlaylistManager parent() function
I'm transitioning this class to be a PlaylistNode, and nodes can easily
access their parent through a .parent pointer

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 14:38:36 -04:00
Anna Schumaker af54734726 curds: Merge the PlaylistManager with the PlaylistManagerBase
Nothing else inherits from this class anymore, so let's merge it into
one to make it easier to deal with going forward.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 13:43:12 -04:00
Anna Schumaker 2c779b475d curds: Remove the PlaylistPlaceholder
It is no longer needed

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 11:08:15 -04:00
Anna Schumaker b37a36369f curds: Swap out the GenreManager for the GenreNode
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 11:05:38 -04:00
Anna Schumaker 8769423fe8 curds: Remove the placeholder before the Library node
We're putting a newline before the heading, so we don't need an empty
tree row for this.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 10:10:23 -04:00
Anna Schumaker eee4e134b0 curds: Swap out the LibraryManager for the LibraryNode
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 10:10:23 -04:00
Anna Schumaker c29313dde8 curds: Add a node.has_sibling() function
The UI can use this to determine if this is the first node added to the
parent.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 10:10:23 -04:00
Anna Schumaker 4fc44832ec curds: Send a notification when a node has been inserted
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 10:10:23 -04:00
Anna Schumaker f777a86da9 curds: Make the PlaylistNode easier to access by the UI
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 10:10:23 -04:00
Anna Schumaker 52f787e483 curds: Create a LibraryNode
For managing library playlists

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 10:10:23 -04:00
Anna Schumaker 751ad812f3 curds: Implement a GenreNode
This will eventually replace the GenreManager instance, and makes use of
the new playlist node code

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 10:10:23 -04:00
Anna Schumaker 0ea715a6d5 curds: Make it possible to cast nodes into a string
We'll use this do display the node in the UI. I add a newline so we
don't have to implement some kind of spacer class.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-17 10:10:20 -04:00
Anna Schumaker 261b08f3f4 curds: Convert the Playlist class into a PlaylistNode
We just make it inherit from the base class

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 13:51:37 -04:00
Anna Schumaker 3a89ff8885 curds: Rename node next and prev
This avoids a conflict with the Playlist class next() function

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 13:51:06 -04:00
Anna Schumaker 3f7a68a37a curds: Add a reset function to the playlist node
This is mostly just used for testing

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 13:37:26 -04:00
Anna Schumaker 3c699dddab curds: Add a lookup function to the playlist node
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 13:31:46 -04:00
Anna Schumaker d266218b7c curds: Normalize node names before setting
This makes them easier to look up

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 12:13:30 -04:00
Anna Schumaker 0994e8986e curds: Add a way to get a node from its path
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 11:33:11 -04:00
Anna Schumaker 79ab9d3a40 curds: Add a way to find a node's path
A path is a list of indices in the tree, which can easily be translated
into a GtkTreePath

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 11:33:05 -04:00
Anna Schumaker 7aa2244f97 curds: Add a way to get a nodes nth child
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 11:19:50 -04:00
Anna Schumaker 35e02b5732 curds: Add a way to get the node's index
This will be useful for finding the node's path

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 11:19:27 -04:00
Anna Schumaker 80e09d0378 curds: Store the node's parent in the node
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 10:41:40 -04:00
Anna Schumaker 1a01dd9047 curds: Implement a node.append_child() function
Sometimes we just want to append a node instead of inserting it in a
sorted position.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 09:52:50 -04:00
Anna Schumaker 6efc456f0d curds: Implement a node.insert_child() function
This inserts the node in sorted order

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-16 09:46:22 -04:00
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