# Bryan Schumaker (8/26/2010) import ocarina LS = ocarina.libsaria gtk = ocarina.gtk class Button(gtk.Button): def __init__(self, stock, func=None, show=True): gtk.Button.__init__(self) self.func = func img = gtk.image_new_from_stock(stock, gtk.ICON_SIZE_MENU) img.show() self.add(img) self.set_relief(gtk.RELIEF_NONE) self.click_id = self.connect("clicked", self.clicked) if show == True: self.show() def clicked(self, button): self.func() def show(self, *args): gtk.Button.show(self) def hide(self, *args): gtk.Button.hide(self) class PlayButton(Button): def __init__(self): Button.__init__(self, gtk.STOCK_MEDIA_PLAY) LS.event.invite("POSTPLAY", self.hide) LS.event.invite("POSTPAUSE", self.show) LS.event.invite("POSTSTOP", self.show) def clicked(self, button): LS.music.play() class PauseButton(Button): def __init__(self): Button.__init__(self, gtk.STOCK_MEDIA_PAUSE, show=False) LS.event.invite("POSTPLAY", self.show) LS.event.invite("POSTPAUSE", self.hide) LS.event.invite("POSTSTOP", self.hide) def clicked(self, button): LS.music.pause()