From: W. Trevor King Date: Thu, 10 Nov 2011 17:03:39 +0000 (-0500) Subject: Call 'remove curve from playlist' when deleting curves via the playlist panel. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f8741021dba93cd5ee42db15346f47f962f394d2;p=hooke.git Call 'remove curve from playlist' when deleting curves via the playlist panel. --- diff --git a/hooke/ui/gui/__init__.py b/hooke/ui/gui/__init__.py index f5a0958..fc41717 100644 --- a/hooke/ui/gui/__init__.py +++ b/hooke/ui/gui/__init__.py @@ -609,7 +609,10 @@ class HookeFrame (wx.Frame): pass def _on_delete_curve(self, _class, method, playlist, curve): - # TODO: execute_command 'remove curve from playlist' + index = playlist.index(curve) + results = self.execute_command( + command=self._command_by_name('remove curve from playlist'), + args={'index': index}) #os.remove(curve.path) pass diff --git a/hooke/ui/gui/panel/playlist.py b/hooke/ui/gui/panel/playlist.py index f355e6d..9c8dc36 100644 --- a/hooke/ui/gui/panel/playlist.py +++ b/hooke/ui/gui/panel/playlist.py @@ -244,7 +244,9 @@ class Tree (wx.TreeCtrl): if c.name == name: curve = c break - self._delete_curve(playlist, curve) + if curve is None: + raise ValueError(name) + self._delete_curve(playlist=playlist, curve=curve) in_callback(self, playlist, curve) def _delete_curve(self, playlist, curve): @@ -254,7 +256,7 @@ class Tree (wx.TreeCtrl): """ _id = self._id_for_name.pop((playlist.name, curve.name)) del(self._name_for_id[_id]) - in_callback(self, playlist, curve) + in_callback(self, playlist=playlist, curve=curve) # Get selection