From 31a0d8364ceaf48f4e30fd9f212099b7a68d526b Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 2 Aug 2010 21:29:57 -0400 Subject: [PATCH] Flesh out HookeFrame._on_set_selected_playlist with 'jump to playlist' call --- hooke/ui/gui/__init__.py | 17 ++++++++++++++--- hooke/ui/gui/panel/playlist.py | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hooke/ui/gui/__init__.py b/hooke/ui/gui/__init__.py index c3a9f45..c7409fb 100644 --- a/hooke/ui/gui/__init__.py +++ b/hooke/ui/gui/__init__.py @@ -711,16 +711,27 @@ class HookeFrame (wx.Frame): os.remove(curve.path) def _on_set_selected_playlist(self, _class, method, playlist): - """TODO: playlists plugin with `jump to playlist`. + """Call the `jump to playlist` command. """ - pass + results = self.execute_command( + command=self._command_by_name('playlists')) + if not isinstance(results[-1], Success): + return + assert len(results) == 2, results + playlists = results[0] + matching = [p for p in playlists if p.name == playlist.name] + assert len(matching) == 1, matching + index = playlists.index(matching[0]) + results = self.execute_command( + command=self._command_by_name('jump to playlist'), + args={'index':index}) def _on_set_selected_curve(self, _class, method, playlist, curve): """Call the `jump to curve` command. TODO: playlists plugin. """ - # TODO: jump to playlist, get playlist + self._on_set_selected_playlist(_class, method, playlist) index = playlist.index(curve) results = self.execute_command( command=self._command_by_name('jump to curve'), diff --git a/hooke/ui/gui/panel/playlist.py b/hooke/ui/gui/panel/playlist.py index f5c840f..ddfedb1 100644 --- a/hooke/ui/gui/panel/playlist.py +++ b/hooke/ui/gui/panel/playlist.py @@ -302,9 +302,12 @@ class Tree (wx.TreeCtrl): self._on_set_selected_playlist(name) def _on_set_selected_playlist(self, name): + self.log.debug('playlist tree selecting playlist %s' % name) in_callback(self, self._playlists[name]) def _on_set_selected_curve(self, playlist_name, name): + self.log.debug('playlist tree selecting curve %s in %s' + % (name, playlist_name)) playlist = self._playlists[playlist_name] curve = None for i,c in enumerate(playlist): -- 2.26.2