ocarina: Add new library page
Right now, it just adds a new page to the window. I'll add more as I go.
This commit is contained in:
parent
c3dbd8167d
commit
e3450d31ff
|
@ -22,6 +22,7 @@ def quit(window, event):
|
|||
import window
|
||||
import playlist
|
||||
import queue
|
||||
import library
|
||||
import oldlibrary
|
||||
import callbacks
|
||||
|
||||
|
|
|
@ -1,54 +1,8 @@
|
|||
# Bryan Schumaker (11/26/2010)
|
||||
# Bryan Schumaker (5 / 20 / 2011)
|
||||
|
||||
import libsaria
|
||||
import sources
|
||||
import body
|
||||
|
||||
library = libsaria.sources.oldlibrary
|
||||
lib_page = sources.Source()
|
||||
LIB_PAGE = body.add_page(lib_page, "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 = library.walk_library("id", "title", "lenstr", "artist", "album", "year")
|
||||
lib_page.insert(songs)
|
||||
set_label_text()
|
||||
fill_library()
|
||||
|
||||
def refresh():
|
||||
lib_page.clear()
|
||||
fill_library()
|
||||
|
||||
def do_refilter(list, iter):
|
||||
return library.is_visible(list[iter][0])
|
||||
lib_page.set_filter_func(do_refilter)
|
||||
|
||||
def filter(text):
|
||||
library.filter(text)
|
||||
lib_page.refilter()
|
||||
set_label_text()
|
||||
LIB_PAGE.filter = filter
|
||||
|
||||
import playlist
|
||||
import queue
|
||||
|
||||
def clear():
|
||||
queue.clear()
|
||||
playlist.clear()
|
||||
lib_page.clear()
|
||||
library.reset()
|
||||
library.save()
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue