The gtk.gdk lock is alread held when we add selected songs to the playlist. I deadlock if I try to grab it again.
49 lines
1.0 KiB
Python
49 lines
1.0 KiB
Python
# Bryan Schumaker (11/26/2010)
|
|
|
|
import ocarina
|
|
from ocarina import body
|
|
from ocarina import source
|
|
import menu
|
|
|
|
gtk = ocarina.gtk
|
|
sources = ocarina.libsaria.sources
|
|
playlist = sources.playlist
|
|
visible = playlist.is_visible
|
|
|
|
plist_page = source.Source()
|
|
|
|
def init():
|
|
body.add_page("Playlist", plist_page)
|
|
playlist.load_bg(filler)
|
|
|
|
def filler():
|
|
plist_page.init(filter, is_visible, right_click, playlist.play_id, reset)
|
|
menu.add_plist_menu_item("Remove from playlist", rm_selected_from_playlist)
|
|
plist_page.fill(playlist.walk, True)
|
|
plist_page.goto()
|
|
|
|
def filter(text):
|
|
playlist.filter(text)
|
|
plist_page.refilter()
|
|
plist_page.goto()
|
|
|
|
def is_visible(list, iter):
|
|
return visible(list[iter][0])
|
|
|
|
def reset():
|
|
plist_page.clear()
|
|
playlist.reset()
|
|
playlist.save()
|
|
|
|
def refresh(*args):
|
|
plist_page.clear()
|
|
plist_page.fill(playlist.walk)
|
|
|
|
def right_click(button, time):
|
|
menu.make_plist_menu(button, time)
|
|
|
|
def rm_selected_from_playlist(menu):
|
|
plist_page.for_each_selected(playlist.rm_id)
|
|
playlist.save()
|
|
refresh()
|