From f8741021dba93cd5ee42db15346f47f962f394d2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 10 Nov 2011 12:03:39 -0500 Subject: [PATCH] Call 'remove curve from playlist' when deleting curves via the playlist panel. --- hooke/ui/gui/__init__.py | 5 ++++- hooke/ui/gui/panel/playlist.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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 -- 2.26.2