From: W. Trevor King Date: Sat, 14 Aug 2010 08:32:23 +0000 (-0400) Subject: Update (don't re-add) already loaded playlists in HookeFrame._postprocess_playlists X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=de74cfcdca28ab34a98ab0823ab0509ae3228e6a;p=hooke.git Update (don't re-add) already loaded playlists in HookeFrame._postprocess_playlists --- diff --git a/hooke/ui/gui/__init__.py b/hooke/ui/gui/__init__.py index 3d8a92d..271b00a 100644 --- a/hooke/ui/gui/__init__.py +++ b/hooke/ui/gui/__init__.py @@ -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) diff --git a/hooke/ui/gui/panel/playlist.py b/hooke/ui/gui/panel/playlist.py index fd46d2d..a863dca 100644 --- a/hooke/ui/gui/panel/playlist.py +++ b/hooke/ui/gui/panel/playlist.py @@ -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`.