ocarina/ocarina/body/footer/__init__.py

70 lines
1.2 KiB
Python

# Bryan Schumaker (11/25/2010)
import gtk
import gobject
import tiny
import detailed
import libsaria
from libsaria import audio
from ocarina import shortcuts
footer = gtk.VBox()
hsep = gtk.HSeparator()
hsep.show()
footer.pack_start(hsep, True, True)
footer.pack_start(tiny.tiny, True, True)
footer.pack_start(detailed.detailed, True, True)
footer.show()
def update_pos():
time = audio.get_progstr()
tiny.update_pos(time)
detailed.update_pos(time)
return True
gobject.timeout_add(500, update_pos)
def show_more():
tiny.hide()
detailed.show()
libsaria.prefs.set("ocarina.footer.up", True)
def show_less():
tiny.show()
detailed.hide()
libsaria.prefs.set("ocarina.footer.up", False)
def toggle_footer():
up = libsaria.prefs.get("ocarina.footer.up")
if up == True:
show_less()
else:
show_more()
shortcuts.register_shortcut("f", toggle_footer)
up = libsaria.prefs.init("ocarina.footer.up", False)
if up == True:
show_more()
else:
show_less()
def set_art(path):
tiny.set_art(path)
detailed.set_art(path)
def on_play():
tiny.on_play()
detailed.on_play()
def on_pause():
tiny.on_pause()
detailed.on_pause()
def on_load(attrs):
tiny.on_load(attrs)
detailed.on_load(attrs)
def on_like(like):
detailed.nowplaying.on_like(like)