2011-05-20 21:42:57 -04:00
|
|
|
# Bryan Schumaker (5 / 20 / 2011)
|
2010-11-26 23:31:12 -05:00
|
|
|
|
2011-05-21 08:20:44 -04:00
|
|
|
import libsaria
|
2011-04-18 20:29:56 -04:00
|
|
|
import sources
|
|
|
|
import body
|
2010-11-26 23:31:12 -05:00
|
|
|
|
2011-05-21 08:20:44 -04:00
|
|
|
library = libsaria.sources.library
|
2011-05-20 21:42:57 -04:00
|
|
|
lib_page = sources.Source()
|
|
|
|
LIB_PAGE = body.add_page(lib_page, "Library")
|
2011-04-20 21:07:00 -04:00
|
|
|
LIB_PAGE.goto = lib_page.goto
|
2011-05-21 08:20:44 -04:00
|
|
|
|
|
|
|
def set_label_text():
|
|
|
|
LIB_PAGE.label.set_text("Library (%s)" % library.num_visible())
|
|
|
|
|
|
|
|
def fill_library():
|
2011-05-25 23:01:17 -04:00
|
|
|
songs = libsaria.sources.list_library(*sources.column.attrs)
|
2011-05-21 08:20:44 -04:00
|
|
|
lib_page.insert(songs)
|
|
|
|
set_label_text()
|
|
|
|
fill_library()
|
|
|
|
|
|
|
|
def refresh():
|
|
|
|
lib_page.clear()
|
|
|
|
fill_library()
|
2011-05-21 15:43:29 -04:00
|
|
|
|
2011-05-22 09:25:47 -04:00
|
|
|
def refilter():
|
2011-05-21 22:06:37 -04:00
|
|
|
lib_page.refilter()
|
|
|
|
set_label_text()
|
|
|
|
|
2011-05-21 15:43:29 -04:00
|
|
|
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)
|