curds: Remove the __init_common__() function
And fix up the user node so it still works as expected Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
708ae8ede2
commit
f5262278df
|
@ -9,10 +9,6 @@ class PlaylistNode(tree.ETree):
|
|||
def __init__(self, name="", icon=""):
|
||||
tree.ETree.__init__(self, name, icon)
|
||||
self.node_lock = threading.RLock()
|
||||
self.__init_common__()
|
||||
|
||||
def __init_common__(self):
|
||||
pass
|
||||
|
||||
def __getstate__(self):
|
||||
state = tree.ETree.__getstate__(self)
|
||||
|
@ -22,12 +18,7 @@ class PlaylistNode(tree.ETree):
|
|||
def __setstate__(self, state):
|
||||
tree.ETree.__setstate__(self, state)
|
||||
self.node_lock = threading.RLock()
|
||||
self.__init_common__()
|
||||
|
||||
def append_child(self, child):
|
||||
with self.tree_lock:
|
||||
return self.__insert__(len(self.children), child)
|
||||
|
||||
def reset(self):
|
||||
tree.ETree.reset(self)
|
||||
self.__init_common__()
|
||||
|
|
|
@ -59,14 +59,3 @@ class TestPlaylistNode(unittest.TestCase):
|
|||
self.assertEqual(root.name, "name")
|
||||
self.assertEqual(root.sibling, 2)
|
||||
self.assertEqual(root.parent, 3)
|
||||
|
||||
def test_node_reset(self):
|
||||
root = node.PlaylistNode()
|
||||
a = node.PlaylistNode("a")
|
||||
b = node.PlaylistNode("b")
|
||||
|
||||
root.insert_child(a)
|
||||
root.insert_child(b)
|
||||
|
||||
root.reset()
|
||||
self.assertEqual(root.children, [ ])
|
||||
|
|
|
@ -9,8 +9,6 @@ class UserNode(node.PlaylistNode):
|
|||
self.starred = playlist.Playlist("Starred", "starred", sort)
|
||||
self.new = new.NewPlaylist()
|
||||
node.PlaylistNode.__init__(self, "Playlists", "audio-x-generic")
|
||||
|
||||
def __init_common__(self):
|
||||
self.insert_child(self.new)
|
||||
self.insert_child(self.starred)
|
||||
|
||||
|
@ -23,3 +21,5 @@ class UserNode(node.PlaylistNode):
|
|||
node.PlaylistNode.reset(self)
|
||||
self.new.reset()
|
||||
self.starred.reset()
|
||||
self.insert_child(self.new)
|
||||
self.insert_child(self.starred)
|
||||
|
|
Loading…
Reference in New Issue