Re: [Rhythmbox-devel] Plugins: How do I get selected entry in source?



On 5/6/07, James Doc Livingston <doclivingston gmail com> wrote:
On Sun, 2007-05-06 at 13:14 +0200, Jarek Zgoda wrote:
> I was looking through sources of Python-based plugins for RB and I
> didn't found any, that operates on selected entry (not "currently
> playing"). How do I get selected entry? In PyGTK this is done usually
> by using gtk.TreeSelection from tree_view.get_selection(), but I
> cann't find any pointer to this TreeView.

Sources have a "entry view" which is the track list, an instance of the
class rb.EntryView (which is derived from gtk.TreeView). You can get it
with "view = source.get_entry_view()" and then use it like a normal
TreeView.


rb.EntryView has a method designed for getting the list of selected
entries (remember, there may be more than one) - get_selected_entries().
So you can do things like:

for entry in source.get_entry_view().get_selected_entries():
    do_something (entry)

Thanks for help. I wish I had something like "Rhythmbox API for plugin
writers"...

--
Jarek Zgoda
http://jpa.berlios.de/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]