Commit Graph

1016 Commits

Author SHA1 Message Date
Anna Schumaker f3987543ed rind: Set the next iterator using PlaylistNode.next_child
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 17:06:16 -04:00
Anna Schumaker 16bbdb7105 rind: Add the node id to the GtkTreeIter
We don't use user_data3 for anything yet, so let's use it to find
playlists easier.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 17:06:16 -04:00
Anna Schumaker 02f271bba0 rind: Refactor iter_playlist() and playlist_iter()
I want these two functions to be the foundation of the NodeTreeModel, so
they have to be defined without using the GtkTreeModel interface.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 17:06:16 -04:00
Anna Schumaker cf8b88b833 rind: Remove playlist_valid_iter()
I'm about to change how iterators work, so remove this function to
simplify the code.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 17:06:16 -04:00
Anna Schumaker b49e81f580 curds: Rename ManagerModel to NodeTreeModel
This reflects how we're using the custom model to display the playlist
node tree.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 17:06:16 -04:00
Anna Schumaker 8f6be9b6f5 curds: Rename PlaylistManager -> PlaylistRoot
This is the root node of the Playlist Tree, so give it a name reflecting
that.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 17:06:16 -04:00
Anna Schumaker b9ad790abf curds: Reorganize the imports
And instantiate the PlaylistManager instance a little earlier

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 17:06:16 -04:00
Anna Schumaker c834359cdb curds: Keep a map of PlaylistNode ids
Making it easy to look up a PlaylistNode by the python object id means
we can use the object id in the GtkTreeIter rather than storing the
entire path

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 17:06:15 -04:00
Anna Schumaker cfee39ce17 curds: Add a function for finding the root node of the PlaylistNode tree
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-22 08:56:02 -04:00
Anna Schumaker 33e2af2c2d curds: Make sure we're properly setting prev / next pointers
I noticed that the toplevel playlist siblings were always set to None,
so make sure we're properly setting these so they can be used.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-21 10:16:03 -04:00
Anna Schumaker de9c7b0745 curds: Add the DecadeNode to the PlaylistManager
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-20 13:04:33 -04:00
Anna Schumaker a8a9dada49 curds: Add a DecadeNode and DecadePlaylist
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-20 12:49:59 -04:00
Anna Schumaker 0eca51eae1 curds: Change genre and artist node icons
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-19 17:00:39 -04:00
Anna Schumaker 68953c273d curds: Add the ArtistNode to the PlaylistManager
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-19 14:46:13 -04:00
Anna Schumaker 42a26832eb curds: Implement an artist playlist node
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-19 14:45:39 -04:00
Anna Schumaker 0cd702c908 rind: Remove do_iter_previous() from ManagerModel
I haven't seen this get run in the wild, so let's remove it

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-19 12:17:06 -04:00
Anna Schumaker b2dc1b8c5e curds: Remove GenrePlaylist
It is now unused

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-19 12:17:06 -04:00
Anna Schumaker bfe7e3550b rind: Set the row height of PlaylitNodes
If the node is a playlist, then we can use their natural height.
Otherwise, we set a height based on the first playlist in the model.
This way every row has the same height.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-19 11:08:24 -04:00
Anna Schumaker 14851e0c59 curds: Remove newline from PlaylistNode
I'm going to take a different approach with setting the row heights
directly, so start by removing the newline here.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-19 10:14:58 -04:00
Anna Schumaker a767cc08b8 curds: Rename PlaylistManager current_changed()
Simply drop the underscores to make the code a little easier to read.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-18 11:55:01 -04:00
Anna Schumaker dbc7683ccd curds: Move playlist peeking into the Playlist class
It makes more sense to do it here than in the PlaylistManager

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-18 11:48:23 -04:00
Anna Schumaker 277aabb7bd curds: Change the PlaylistManager into a PlaylistNode
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2019-04-18 11:00:12 -04:00
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