\r
self.execute_command(\r
command=self._command_by_name('load playlist'),\r
- args={'input':'test/data/test'},\r
+ args={'input':'test/data/vclamp_picoforce/playlist'},\r
)\r
return # TODO: cleanup\r
self.playlists = self._c['playlist'].Playlists\r
}\r
self.Bind(wx.EVT_TREE_SEL_CHANGED, self._on_selection_changed)\r
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self._on_execute)\r
+ self.Bind(wx.EVT_MOTION, self._on_motion)\r
\r
self._callbacks = callbacks\r
self._setup_commands(commands, selected)\r
+ self._last_tooltip = None\r
\r
def _setup_commands(self, commands, selected):\r
self._plugins = {} # {name: hooke.plugin.Plugin()}\r
for c_id in self._name_for_id.keys():\r
if c_id == _id:\r
return c_id\r
- return _id\r
+ raise KeyError(_id)\r
\r
def _on_selection_changed(self, event):\r
active_id = event.GetItem()\r
def _on_execute(self, event):\r
self.execute()\r
\r
+ def _on_motion(self, event):\r
+ """Enable tooltips.\r
+ """\r
+ hit_id,hit_flags = self.HitTest(event.GetPosition())\r
+ print hit_id\r
+ try:\r
+ hit_id = self._canonical_id(hit_id)\r
+ except KeyError:\r
+ hit_id = None\r
+ if hit_id == None:\r
+ msg = ''\r
+ else:\r
+ name = self._name_for_id[hit_id]\r
+ if self._is_command(name):\r
+ msg = self._commands[name].help()\r
+ else:\r
+ msg = '' # self._plugins[name].help() TODO: Plugin.help method\r
+ if msg != self._last_tooltip:\r
+ self._last_tooltip = msg\r
+ event.GetEventObject().SetToolTipString(msg)\r
+\r
def select_plugin(self, plugin):\r
in_callback(self, plugin)\r
\r