# style=wx.DIRCTRL_SHOW_FILTERS,\r
# filter=self.gui.config['folders-filters'],\r
# defaultFilter=int(self.gui.config['folders-filter-index'])), 'left'), #HACK: config should convert\r
-# ('playlists', panel.PANELS['playlist'](\r
-# callbacks={},\r
-# config=self.gui.config,\r
-# parent=self,\r
-# style=wx.WANTS_CHARS|wx.NO_BORDER,\r
-# # WANTS_CHARS so the panel doesn't eat the Return key.\r
-# size=(160, 200)), 'left'),\r
+ ('playlists', panel.PANELS['playlist'](\r
+ callbacks={},\r
+ config=self.gui.config,\r
+ parent=self,\r
+ style=wx.WANTS_CHARS|wx.NO_BORDER,\r
+ # WANTS_CHARS so the panel doesn't eat the Return key.\r
+# size=(160, 200),\r
+ ), 'left'),\r
# ('note', panel.note.Note(\r
# parent=self\r
# style=wx.WANTS_CHARS|wx.NO_BORDER,\r
parent=self,\r
style=wx.WANTS_CHARS|wx.NO_BORDER,\r
# WANTS_CHARS so the panel doesn't eat the Return key.\r
-# size=(160, 200)\r
- ), 'center'),\r
+# size=(160, 200),\r
+ ), 'right'),\r
('property', panel.PANELS['propertyeditor2'](\r
callbacks={},\r
parent=self,\r
self._c['output'].write(result.__class__.__name__+'\n')\r
self._c['output'].write(str(result).rstrip()+'\n')\r
\r
- def _postprocess_get_curve(self, command, results):\r
- """Update `self` to show the curve.\r
+ def _postprocess_text(self, command, 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
+ approach, except that :class:`~hooke.ui.commandline.DoCommand`\r
+ doesn't print some internally handled messages\r
+ (e.g. :class:`~hooke.interaction.ReloadUserInterfaceConfig`).\r
+ """\r
+ for result in results:\r
+ if isinstance(result, CommandExit):\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
+ """Update `self` to show the playlist.\r
"""\r
if not isinstance(results[-1], Success):\r
- return # error executing 'get curve'\r
+ return # error executing 'load playlist'\r
assert len(results) == 2, results\r
- curve = results[0]\r
- print curve\r
-\r
- selected_item = self._c['playlists']._c['tree'].GetSelection()\r
- if self._c['playlists']._c['tree'].ItemHasChildren(selected_item):\r
- #GetFirstChild returns a tuple\r
- #we only need the first element\r
- next_item = self._c['playlists']._c['tree'].GetFirstChild(selected_item)[0]\r
- else:\r
- next_item = self._c['playlists']._c['tree'].GetNextSibling(selected_item)\r
- if not next_item.IsOk():\r
- parent_item = self._c['playlists']._c['tree'].GetItemParent(selected_item)\r
- #GetFirstChild returns a tuple\r
- #we only need the first element\r
- next_item = self._c['playlists']._c['tree'].GetFirstChild(parent_item)[0]\r
- self._c['playlists']._c['tree'].SelectItem(next_item, True)\r
- if not self._c['playlists']._c['tree'].ItemHasChildren(selected_item):\r
- playlist = self.GetActivePlaylist()\r
- if playlist.count > 1:\r
- playlist.next()\r
- self._c['status bar'].set_playlist(playlist)\r
- self.UpdateNote()\r
- self.UpdatePlot()\r
+ playlist = results[0]\r
+ print playlist\r
\r
+ self._c['playlists']._c['tree'].add_playlist(playlist)\r
\r
\r
# TODO: cruft\r
event.Skip()\r
\r
def _on_left_doubleclick(self, event):\r
- playlist.index = index\r
- event.Skip()\r
+ pass\r
+ #playlist.index = index\r
+ #event.Skip()\r
\r
def _on_context_menu(self, event):\r
"""Launch a popup :class:`Menu` with per-playlist/curve activities.\r
hit_id,hit_flags = self.HitTest(event.GetPosition())\r
if (hit_flags & wx.TREE_HITTEST_ONITEM) != 0:\r
self._hit_id = self._canonical_id(hit_id) # store for callbacks\r
- self.PopupMenu(\r
- Menu(self._on_delete), event.GetPoint())\r
+ menu = Menu(self._on_delete)\r
+ self.PopupMenu(menu, event.GetPosition())\r
menu.Destroy()\r
\r
def _on_delete(self, event):\r
"""Add a :class:`hooke.curve.Curve` to a curently loaded playlist.\r
"""\r
p = self._playlists[playlist_name]\r
- p.append(curve)\r
- c_id = AppendItem(\r
+ if curve not in p:\r
+ p.append(curve)\r
+ c_id = self.AppendItem(\r
parent=self._id_for_name[playlist_name],\r
text=self._name(curve.name),\r
image=self.image['curve'])\r
- self._id_for_name[(playlist.name, curve.name)] = c_id\r
+ self._id_for_name[(p.name, curve.name)] = c_id\r
in_callback(self, p, curve)\r
\r
def delete_playlist(self, name):\r