# defaultFilter=self.gui.config['folders-filter-index']), 'left'),
(panel.PANELS['playlist'](
callbacks={
- 'delete_playlist':self._on_user_delete_playlist,
- '_delete_playlist':self._on_delete_playlist,
- 'delete_curve':self._on_user_delete_curve,
- '_delete_curve':self._on_delete_curve,
+ '_delete_playlist':self._delete_playlist,
+ '_delete_curve':self._delete_curve,
'_on_set_selected_playlist':self._on_set_selected_playlist,
'_on_set_selected_curve':self._on_set_selected_curve,
},
callbacks={
'next': self._next_curve,
'previous': self._previous_curve,
+ 'delete': self._delete_curve,
},
- parent=self,
- style=wx.TB_FLAT | wx.TB_NODIVIDER)
+ parent=self)
self._c['manager'].AddPane(
self._c['navigation bar'],
aui.AuiPaneInfo().Name('Navigation').Caption('Navigation'
self.Bind(wx.EVT_SIZE, self._on_size)
self.Bind(wx.EVT_CLOSE, self._on_close)
self.Bind(aui.EVT_AUI_PANE_CLOSE, self._on_pane_close)
+ self.Bind(wx.EVT_CHAR_HOOK, self._on_key)
return # TODO: cleanup
treeCtrl = self._c['folders'].GetTreeCtrl()
def _on_close(self, *args):
self.log.info('closing GUI framework')
+
# apply changes
self._set_config('main height', self.GetSize().GetHeight())
self._set_config('main left', self.GetPosition()[0])
def _on_erase_background(self, event):
event.Skip()
+ def _on_key(self, event):
+ code = event.GetKeyCode()
+ if code == wx.WXK_RIGHT:
+ self._next_curve()
+ elif code == wx.WXK_LEFT:
+ self._previous_curve()
+ elif code == wx.WXK_DELETE or code == wx.WXK_BACK:
+ self._delete_curve()
+ else:
+ event.Skip()
# Panel utility functions
self.execute_command(
command=self._command_by_name('get playlist'))
+ def _postprocess_delete_curve(self, command, args={}, results=[]):
+ """No-op. Only call 'delete curve' via `self._delete_curve()`.
+ """
+ pass
+
def _update_curve(self, command, args={}, results=[]):
"""Update the curve, since the available columns may have changed.
"""
# Playlist panel interface
- def _on_user_delete_playlist(self, _class, method, playlist):
- pass
-
- def _on_delete_playlist(self, _class, method, playlist):
- if hasattr(playlist, 'path') and playlist.path != None:
- os.remove(playlist.path)
-
- def _on_user_delete_curve(self, _class, method, playlist, curve):
- pass
-
- def _on_delete_curve(self, _class, method, playlist, curve):
- index = playlist.index(curve)
- results = self.execute_command(
- command=self._command_by_name('remove curve from playlist'),
- args={'index': index})
- #os.remove(curve.path)
+ def _delete_playlist(self, _class, method, playlist):
+ #if hasattr(playlist, 'path') and playlist.path != None:
+ # os.remove(playlist.path)
+ # TODO: remove playlist from underlying hooke instance and call ._c['playlist'].delete_playlist()
+ # possibly rename this method to _postprocess_delete_playlist...
pass
def _on_set_selected_playlist(self, _class, method, playlist):
self.execute_command(
command=self._command_by_name('get curve'))
+ def _delete_curve(self, *args, **kwargs):
+ cmd_kwargs = {}
+ playlist = kwargs.get('playlist', None)
+ curve = kwargs.get('curve', None)
+ if playlist is not None and curve is not None:
+ cmd_kwargs['index'] = playlist.index(curve)
+ results = self.execute_command(
+ command=self._command_by_name('remove curve from playlist'),
+ args=cmd_kwargs)
+ if isinstance(results[-1], Success):
+ results = self.execute_command(
+ command=self._command_by_name('get playlist'))
# Panel display handling