Update (don't re-add) already loaded playlists in HookeFrame._postprocess_playlists
authorW. Trevor King <wking@drexel.edu>
Sat, 14 Aug 2010 08:32:23 +0000 (04:32 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 14 Aug 2010 08:32:23 +0000 (04:32 -0400)
hooke/ui/gui/__init__.py
hooke/ui/gui/panel/playlist.py

index 3d8a92da898a7db51611d98bc2aa2d09803f90e9..271b00a05877a8ab0854fdb9158b3ec0d37ca722 100644 (file)
@@ -410,10 +410,9 @@ class HookeFrame (wx.Frame):
             return
         assert len(results) == 2, results
         playlists = results[0]
-        loaded_playlists = []  # TODO
         if 'playlist' in self._c:
             for playlist in playlists:
-                if playlist in loaded_playlists:
+                if self._c['playlist'].is_playlist_loaded(playlist):
                     self._c['playlist'].update_playlist(playlist)
                 else:
                     self._c['playlist'].add_playlist(playlist)
index fd46d2dc526ad56043e9155a5d01de35de73be5c..a863dca9e2f84ac5d42e4ed00a596ec78a3f32c1 100644 (file)
@@ -335,6 +335,11 @@ class Tree (wx.TreeCtrl):
         """
         self._playlists[playlist.name] = playlist
 
+    def is_playlist_loaded(self, playlist):
+        """Return `True` if a playlist is loaded, `False` otherwise.
+        """
+        return playlist.name in self._playlists
+
 
 class Playlist (Panel, wx.Panel):
     """:class:`wx.Panel` subclass wrapper for :class:`Tree`.