ocarina: Add more callbacks
This should make the code more readable and useable
This commit is contained in:
parent
d72d16f39d
commit
5b5a232b43
|
@ -1,6 +1,7 @@
|
||||||
# Bryan Schumaker (4 / 20 / 2011)
|
# Bryan Schumaker (4 / 20 / 2011)
|
||||||
|
|
||||||
import libsaria
|
import libsaria
|
||||||
|
import queue
|
||||||
from ocarina.body import footer
|
from ocarina.body import footer
|
||||||
|
|
||||||
invite = libsaria.event.invite
|
invite = libsaria.event.invite
|
||||||
|
@ -12,3 +13,11 @@ invite("POSTPLAY", on_play)
|
||||||
def on_pause(*args):
|
def on_pause(*args):
|
||||||
footer.on_pause()
|
footer.on_pause()
|
||||||
invite("POSTPAUSE", 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)
|
||||||
|
|
|
@ -30,36 +30,6 @@ class Button(gtk.Button):
|
||||||
def hide(self, *args):
|
def hide(self, *args):
|
||||||
gtk.Button.hide(self)
|
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):
|
class OpenButton(Button):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Button.__init__(self, gtk.STOCK_OPEN, "Open Anything")
|
Button.__init__(self, gtk.STOCK_OPEN, "Open Anything")
|
||||||
|
|
|
@ -64,7 +64,6 @@ queue_page.set_right_click(show_menu)
|
||||||
#queue_page.init(filter, is_visible, right_click, play_id, reset)
|
#queue_page.init(filter, is_visible, right_click, play_id, reset)
|
||||||
#menu.add_queue_menu_item("Remove from queue", rm_selected_from_queue)
|
#menu.add_queue_menu_item("Remove from queue", rm_selected_from_queue)
|
||||||
#queue_page.fill(queue.walk, True)
|
#queue_page.fill(queue.walk, True)
|
||||||
#ocarina.libsaria.event.invite("POSTNEXT", refresh)
|
|
||||||
|
|
||||||
#def reset():
|
#def reset():
|
||||||
#queue_page.clear()
|
#queue_page.clear()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user