pp = getattr(\r
self, '_postprocess_%s' % command.name.replace(' ', '_'),\r
self._postprocess_text)\r
- pp(command=command, results=results)\r
+ pp(command=command, args=args, results=results)\r
return results\r
\r
def _handle_request(self, msg):\r
\r
# Command-specific postprocessing\r
\r
- def _postprocess_text(self, command, results):\r
+ def _postprocess_text(self, command, args, results):\r
"""Print the string representation of the results to the Results window.\r
\r
This is similar to :class:`~hooke.ui.commandline.DoCommand`'s\r
self._c['output'].write(result.__class__.__name__+'\n')\r
self._c['output'].write(str(result).rstrip()+'\n')\r
\r
- def _postprocess_load_playlist(self, command, results):\r
+ def _postprocess_load_playlist(self, command, args, results):\r
"""Update `self` to show the playlist.\r
"""\r
if not isinstance(results[-1], Success):\r
self._postprocess_text(command, results)\r
assert len(results) == 2, results\r
playlist = results[0]\r
- print playlist\r
self._c['playlists']._c['tree'].add_playlist(playlist)\r
\r
- def _postprocess_get_playlist(self, command, results):\r
+ def _postprocess_get_playlist(self, command, args, results):\r
if not isinstance(results[-1], Success):\r
self._postprocess_text(command, results)\r
assert len(results) == 2, results\r
playlist = results[0]\r
- print playlist\r
self._c['playlists']._c['tree'].update_playlist(playlist)\r
\r
- def _postprocess_get_curve(self, command, results):\r
+ def _postprocess_get_curve(self, command, args, results):\r
"""Update `self` to show the curve.\r
"""\r
if not isinstance(results[-1], Success):\r
self._postprocess_text(command, results)\r
assert len(results) == 2, results\r
curve = results[0]\r
- playlist = self._c['playlists']._c['tree'].get_selected_playlist()\r
- if playlist != None: # TODO: fix once we have hooke.plugin.playlists\r
- self._c['playlists']._c['tree'].set_selected_curve(\r
- playlist, curve)\r
+ if args.get('curve', None) == None:\r
+ # the command defaults to the current curve of the current playlist\r
+ results = self.execute_command(\r
+ command=self._command_by_name('get playlist'))\r
+ playlist = results[0]\r
+ else:\r
+ raise NotImplementedError()\r
+ self._c['playlists']._c['tree'].set_selected_curve(\r
+ playlist, curve)\r
\r
- def _postprocess_next_curve(self, command, results):\r
+ def _postprocess_next_curve(self, command, args, results):\r
"""No-op. Only call 'next curve' via `self._next_curve()`.\r
"""\r
pass\r
\r
- def _postprocess_previous_curve(self, command, results):\r
+ def _postprocess_previous_curve(self, command, args, results):\r
"""No-op. Only call 'previous curve' via `self._previous_curve()`.\r
"""\r
pass\r