ocarina: Add more callbacks

This should make the code more readable and useable
This commit is contained in:
Bryan Schumaker 2011-04-20 19:44:45 -04:00
parent d72d16f39d
commit 5b5a232b43
3 changed files with 9 additions and 31 deletions

View File

@ -1,6 +1,7 @@
# Bryan Schumaker (4 / 20 / 2011)
import libsaria
import queue
from ocarina.body import footer
invite = libsaria.event.invite
@ -12,3 +13,11 @@ invite("POSTPLAY", on_play)
def on_pause(*args):
footer.on_pause()
invite("POSTPAUSE", on_pause)
def on_stop(*args):
footer.on_pause()
invite("POSTSTOP", on_stop)
def on_next(*args):
queue.refresh()
invite("POSTNEXT", on_next)

View File

@ -30,36 +30,6 @@ class Button(gtk.Button):
def hide(self, *args):
gtk.Button.hide(self)
class PlayButton(Button):
def __init__(self):
Button.__init__(self, gtk.STOCK_MEDIA_PLAY, "Play")
invite("POSTPLAY", self.hide)
invite("POSTPAUSE", self.show)
invite("POSTSTOP", self.show)
def clicked(self, button):
LS.controls.play()
def hide(self, playing):
if playing == True:
Button.hide(self)
def show(self, paused):
if paused == True:
Button.show(self)
class PauseButton(Button):
def __init__(self):
Button.__init__(self, gtk.STOCK_MEDIA_PAUSE, "Pause", show=False)
invite("POSTPLAY", self.show)
invite("POSTPAUSE", self.hide)
invite("POSTSTOP", self.hide)
def clicked(self, button):
LS.controls.pause()
def hide(self, paused):
if paused == True:
Button.hide(self)
def show(self, playing):
if playing == True:
Button.show(self)
class OpenButton(Button):
def __init__(self):
Button.__init__(self, gtk.STOCK_OPEN, "Open Anything")

View File

@ -64,7 +64,6 @@ queue_page.set_right_click(show_menu)
#queue_page.init(filter, is_visible, right_click, play_id, reset)
#menu.add_queue_menu_item("Remove from queue", rm_selected_from_queue)
#queue_page.fill(queue.walk, True)
#ocarina.libsaria.event.invite("POSTNEXT", refresh)
#def reset():
#queue_page.clear()