curds: Remove the PlaylistNode class

It is now unused

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-12-16 13:43:40 -05:00
parent 88b45a3fee
commit d7ad6c5894
20 changed files with 40 additions and 71 deletions

View File

@ -11,7 +11,6 @@ import threading
Current = [ ]
Library = library.LibraryPlaylist
Lock = threading.Lock()
Node = node.PlaylistNode
Root = None
Track = None

View File

@ -1,7 +1,7 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from . import playlist
from .. import notify
from .. import tree
ALBUM_ICON = "media-optical-cd-audio"
ARTIST_ICON = "avatar-default-symbolic"
@ -16,9 +16,9 @@ class ArtistPlaylist(playlist.Playlist):
self.find_child(track["album"], ALBUM_ICON).add(track)
class ArtistNode(node.PlaylistNode):
class ArtistNode(tree.ETree):
def __init__(self):
node.PlaylistNode.__init__(self, "Artists", ARTIST_ICON)
tree.ETree.__init__(self, "Artists", ARTIST_ICON)
def alloc_child(self, name, icon):
return ArtistPlaylist(name, icon, [ "album", "discnumber", "tracknumber" ])

View File

@ -1,7 +1,7 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from . import playlist
from .. import notify
from .. import tree
DECADE_ICON = "x-office-calendar"
@ -16,9 +16,9 @@ class DecadePlaylist(playlist.Playlist):
self.find_child(str(track["date"]), DECADE_ICON).add(track)
class DecadeNode(node.PlaylistNode):
class DecadeNode(tree.ETree):
def __init__(self):
node.PlaylistNode.__init__(self, "Decades", "x-office-calendar")
tree.ETree.__init__(self, "Decades", "x-office-calendar")
def alloc_child(self, name, icon):
return DecadePlaylist(name, icon,

View File

@ -1,13 +1,13 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from . import playlist
from .. import notify
from .. import tree
GENRE_ICON = "emblem-generic"
class GenreNode(node.PlaylistNode):
class GenreNode(tree.ETree):
def __init__(self):
node.PlaylistNode.__init__(self, "Genres", GENRE_ICON)
tree.ETree.__init__(self, "Genres", GENRE_ICON)
def alloc_child(self, name, icon):
return playlist.Playlist(name, icon,

View File

@ -1,9 +1,9 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from . import playlist
from .. import notify
from .. import threadqueue
from .. import trak
from .. import tree
import os
LIBRARY_ICON = "folder-music"
@ -26,9 +26,9 @@ class LibraryPlaylist(playlist.Playlist):
library_thread.push(self.thread_save)
class LibraryNode(node.PlaylistNode):
class LibraryNode(tree.ETree):
def __init__(self):
node.PlaylistNode.__init__(self, "Libraries", "folder-music")
tree.ETree.__init__(self, "Libraries", "folder-music")
def alloc_child(self, path, icon):
return LibraryPlaylist(path, icon,

View File

@ -1,5 +1,4 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from . import playlist
from .. import notify

View File

@ -1,10 +0,0 @@
# Copyright 2019 (c) Anna Schumaker.
from .. import notify
from .. import sort
from .. import tree
import threading
import unicodedata
class PlaylistNode(tree.ETree):
def __init__(self, name="", icon=""):
tree.ETree.__init__(self, name, icon)

View File

@ -1,13 +1,13 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from .. import notify
from .. import sort
from .. import trak
from .. import tree
import random
import threading
from gi.repository import GLib
class Playlist(node.PlaylistNode):
class Playlist(tree.ETree):
def __init__(self, name, icon="", sort=[], can_loop=True, can_random=True):
self.list = [ ]
self.sort_order = sort
@ -18,7 +18,7 @@ class Playlist(node.PlaylistNode):
self.random = False
self.visible = False
self.plist_lock = threading.Lock()
node.PlaylistNode.__init__(self, name, icon)
tree.ETree.__init__(self, name, icon)
def __find_track__(self, track):
if track == None:
@ -38,7 +38,7 @@ class Playlist(node.PlaylistNode):
def __getstate__(self):
with self.plist_lock:
state = node.PlaylistNode.__getstate__(self)
state = tree.ETree.__getstate__(self)
state["list"] = [ t.path for t in self.list ]
del state["plist_lock"]
return state
@ -61,7 +61,7 @@ class Playlist(node.PlaylistNode):
return None
def __setstate__(self, state):
node.PlaylistNode.__setstate__(self, state)
tree.ETree.__setstate__(self, state)
self.list = [ trak.lookup(path) for path in state["list"] ]
self.sort_order = state["sort_order"]
self.current = state["current"]
@ -151,7 +151,7 @@ class Playlist(node.PlaylistNode):
self.current = -1
self.loop = False
self.random = False
node.PlaylistNode.reset(self)
tree.ETree.reset(self)
def runtime(self):
with self.plist_lock:

View File

@ -1,5 +1,4 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from . import playlist
from .. import notify

View File

@ -4,16 +4,16 @@ from . import collection
from . import decade
from . import genre
from . import library
from . import node
from . import prev
from . import up_next
from . import user
from .. import sort
from .. import tree
class PlaylistRoot(node.PlaylistNode):
class PlaylistRoot(tree.ETree):
def __init__(self):
node.PlaylistNode.__init__(self, "root")
tree.ETree.__init__(self, "root")
with self.tree_lock:
self.__insert__(0, collection.CollectionPlaylist())

View File

@ -1,9 +1,9 @@
# Copyright 2019 (c) Anna Schumaker
from . import artist
from . import node
from . import playlist
from .. import notify
from .. import trak
from .. import tree
import os
import unittest
@ -16,7 +16,7 @@ class TestArtistPlaylist(unittest.TestCase):
def test_artist_node(self):
anode = artist.ArtistNode()
self.assertIsInstance(anode, node.PlaylistNode)
self.assertIsInstance(anode, tree.ETree)
self.assertEqual(anode.name, "Artists")
self.assertEqual(anode.icon, "avatar-default-symbolic")

View File

@ -1,9 +1,9 @@
# Copyright 2019 (c) Anna Schumaker.
from . import decade
from . import node
from . import playlist
from .. import notify
from .. import trak
from .. import tree
import os
import unittest
@ -19,7 +19,7 @@ class TestDecadePlaylist(unittest.TestCase):
def test_decade_node(self):
dnode = decade.DecadeNode()
self.assertIsInstance(dnode, node.PlaylistNode)
self.assertIsInstance(dnode, tree.ETree)
self.assertEqual(dnode.name, "Decades")
self.assertEqual(dnode.icon, "x-office-calendar")

View File

@ -1,9 +1,9 @@
# Copyright 2019 (c) Anna Schumaker.
from . import genre
from . import node
from . import playlist
from .. import notify
from .. import trak
from .. import tree
import os
import unittest
@ -16,7 +16,7 @@ class TestGenrePlaylist(unittest.TestCase):
def test_genre_node(self):
gnode = genre.GenreNode()
self.assertIsInstance(gnode, node.PlaylistNode)
self.assertIsInstance(gnode, tree.ETree)
self.assertEqual(gnode.name, "Genres")
self.assertEqual(gnode.icon, "emblem-generic")

View File

@ -1,10 +1,10 @@
# Copyright 2019 (c) Anna Schumaker.
from . import library
from . import node
from . import playlist
from .. import notify
from .. import threadqueue
from .. import trak
from .. import tree
import os
import time
import unittest
@ -23,7 +23,7 @@ class TestLibraryPlaylist(unittest.TestCase):
def test_library_node(self):
lnode = library.LibraryNode()
self.assertIsInstance(lnode, node.PlaylistNode)
self.assertIsInstance(lnode, tree.ETree)
self.assertEqual(lnode.name, "Libraries")
self.assertEqual(lnode.icon, "folder-music")

View File

@ -1,17 +0,0 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from .. import notify
import threading
import unittest
class TestPlaylistNode(unittest.TestCase):
def test_node_init(self):
n = node.PlaylistNode()
self.assertEqual( n.children, [ ])
self.assertEqual( n.icon, "")
self.assertEqual( n.name, "")
self.assertIsNone(n.sibling)
n = node.PlaylistNode("Test Node", "test-icon")
self.assertEqual(n.icon, "test-icon")
self.assertEqual(n.name, "Test Node")

View File

@ -1,8 +1,8 @@
# Copyright 2019 (c) Anna Schumaker.
from . import node
from . import playlist
from .. import notify
from .. import trak
from .. import tree
import os
import random
import unittest
@ -43,7 +43,7 @@ class TestPlaylist(unittest.TestCase):
self.cb_changed = plist
def test_playlist__init__(self):
self.assertIsInstance(self.plist, node.PlaylistNode)
self.assertIsInstance(self.plist, tree.ETree)
self.assertEqual(self.plist.name, "Test Playlist")
self.assertEqual(self.plist.icon, "")
self.assertEqual(self.plist.list, [ ])

View File

@ -4,7 +4,6 @@ from . import collection
from . import decade
from . import genre
from . import library
from . import node
from . import playlist
from . import prev
from . import root
@ -13,6 +12,7 @@ from . import user
from .. import notify
from .. import threadqueue
from .. import trak
from .. import tree
import os
import random
import unittest
@ -52,7 +52,7 @@ class TestPlaylistRoot(unittest.TestCase):
def test_root_init(self):
self.assertIsInstance(self.playman, root.PlaylistRoot)
self.assertIsInstance(self.playman, node.PlaylistNode)
self.assertIsInstance(self.playman, tree.ETree)
self.assertIsInstance(self.playman.lookup("Collection"), collection.CollectionPlaylist)
self.assertIsInstance(self.playman.lookup("Up Next"), up_next.UpNextPlaylist)

View File

@ -1,16 +1,16 @@
# Copyright 2019 (c) Anna Schumaker.
from . import new
from . import node
from . import user
from .. import notify
from .. import trak
from .. import tree
import unittest
class TestUserPlaylists(unittest.TestCase):
def test_user_node(self):
unode = user.UserNode()
self.assertIsInstance(unode, node.PlaylistNode)
self.assertIsInstance(unode, tree.ETree)
self.assertEqual(unode.name, "Playlists")
self.assertEqual(unode.icon, "audio-x-generic")

View File

@ -1,24 +1,24 @@
# Copyright 2019 (c) Anna Schumaker.
from . import new
from . import node
from . import playlist
from .. import tree
class UserNode(node.PlaylistNode):
class UserNode(tree.ETree):
def __init__(self):
sort = [ "artist", "date", "album", "discnumber", "tracknumber" ]
self.starred = playlist.Playlist("Starred", "starred", sort)
self.new = new.NewPlaylist()
node.PlaylistNode.__init__(self, "Playlists", "audio-x-generic")
tree.ETree.__init__(self, "Playlists", "audio-x-generic")
self.insert_child(self.new)
self.insert_child(self.starred)
def __setstate__(self, state):
self.new = state["new"]
self.starred = state["starred"]
node.PlaylistNode.__setstate__(self, state)
tree.ETree.__setstate__(self, state)
def reset(self):
node.PlaylistNode.reset(self)
tree.ETree.reset(self)
self.new.reset()
self.starred.reset()
self.insert_child(self.new)

View File

@ -12,7 +12,6 @@ class TestEmmental(unittest.TestCase):
self.assertEqual(curds.Playlist, curds.playlist.playlist.Playlist)
self.assertEqual(curds.playlist.Library, curds.playlist.library.LibraryPlaylist)
self.assertEqual(curds.playlist.Node, curds.playlist.node.PlaylistNode)
self.assertEqual(curds.playlist.Starred, curds.playlist.lookup("Playlists").lookup("Starred"))
self.assertIsNotNone(curds.notify)