e8f633c863
I was recreating this list once for each of playlist, library and queue. I expect it is easier to manage from a single location.
48 lines
917 B
Python
48 lines
917 B
Python
# Bryan Schumaker (5 / 20 / 2011)
|
|
|
|
import libsaria
|
|
import sources
|
|
import body
|
|
|
|
library = libsaria.sources.library
|
|
lib_page = sources.Source()
|
|
LIB_PAGE = body.add_page(lib_page, "Library")
|
|
LIB_PAGE.goto = lib_page.goto
|
|
|
|
def set_label_text():
|
|
LIB_PAGE.label.set_text("Library (%s)" % library.num_visible())
|
|
|
|
def fill_library():
|
|
songs = libsaria.sources.list_library(*sources.column.attrs)
|
|
lib_page.insert(songs)
|
|
set_label_text()
|
|
fill_library()
|
|
|
|
def refresh():
|
|
lib_page.clear()
|
|
fill_library()
|
|
|
|
def refilter():
|
|
lib_page.refilter()
|
|
set_label_text()
|
|
|
|
import playlist
|
|
import queue
|
|
|
|
def clear():
|
|
queue.clear()
|
|
playlist.clear()
|
|
library.reset()
|
|
lib_page.clear()
|
|
refresh()
|
|
LIB_PAGE.clear = clear
|
|
|
|
menu_items = [
|
|
("Add to Queue", queue.add_to_queue),
|
|
("Add to Playlist", playlist.add_to_playlist),
|
|
]
|
|
def show_menu(event):
|
|
m = sources.Menu(lib_page, menu_items)
|
|
m.show(event)
|
|
lib_page.set_right_click(show_menu)
|