ocarina/ocarina/callbacks.py
Bryan Schumaker 975b153bea libsaria: Remove event.py
I've been looking forward to this.  The last several commits have
replaced the generic event system with a hardcoded callback system.
This should be more efficient, easier to understand, and easier to
follow.  I feel it is a better solution.
2011-05-01 12:46:17 -04:00

44 lines
876 B
Python

# Bryan Schumaker (4 / 20 / 2011)
import libsaria
import queue
from ocarina import body
from ocarina.body import footer
from libsaria import callbacks
import playlist
import library
def on_play():
footer.on_play()
callbacks.on_play = on_play
def on_pause():
footer.on_pause()
callbacks.on_pause = on_pause
def on_load(file):
footer.on_load()
queue.refresh()
body.cur_page_goto()
libsaria.path.lastfm.get_artwork(file)
callbacks.on_load = on_load
def on_like(like):
footer.on_like(like)
callbacks.on_like = on_like
def on_get_art(path, id):
cur_id = libsaria.sources.get_attrs("id")
if id != cur_id:
path = "images/ocarina.png"
footer.set_art(path)
callbacks.on_get_art = on_get_art
def on_load_playlist():
playlist.refresh()
callbacks.on_load_playlist = on_load_playlist
def on_load_library():
library.refresh()
callbacks.on_new_source = on_load_library