ocarina: Add buttons to tiny footer
The new buttons are much simpler than my old ones. This should work out better.
This commit is contained in:
parent
b5665b016f
commit
5ab592dcda
|
@ -1,6 +1,7 @@
|
|||
# Bryan Schumaker (2 / 20 / 2011)
|
||||
|
||||
import gtk
|
||||
from libsaria import controls
|
||||
|
||||
SIZE = gtk.ICON_SIZE_MENU
|
||||
|
||||
|
@ -25,9 +26,28 @@ def default_button(func, show):
|
|||
b.show()
|
||||
return b
|
||||
|
||||
def make_button(stock_item, func, show):
|
||||
def make_button(stock_item, func, tooltip, show):
|
||||
b = default_button(func, show)
|
||||
img = stock_image(stock_item)
|
||||
b.add(img)
|
||||
b.set_tooltip_text(tooltip)
|
||||
return b
|
||||
|
||||
|
||||
def rewind_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_REWIND, controls.seek_backward, "Rewind", show)
|
||||
|
||||
def forward_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_FORWARD, controls.seek_forward, "Fast Forward", show)
|
||||
|
||||
def play_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_PLAY, controls.play, "Play", show)
|
||||
|
||||
def pause_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_PAUSE, controls.pause, "Pause", show)
|
||||
|
||||
def stop_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_STOP, controls.stop, "Stop", show)
|
||||
|
||||
def next_button(show):
|
||||
return make_button(gtk.STOCK_MEDIA_NEXT, controls.next, "Next", show)
|
||||
|
|
|
@ -3,11 +3,23 @@
|
|||
import gtk
|
||||
import pango
|
||||
import ocarina
|
||||
from ocarina.body import button
|
||||
|
||||
tiny = gtk.HBox()
|
||||
now_playing = gtk.Label(ocarina.__vers__)
|
||||
now_playing.set_ellipsize(pango.ELLIPSIZE_END)
|
||||
now_playing.show()
|
||||
|
||||
def add_button(name, button_func, show = True):
|
||||
b = button_func(show)
|
||||
globals()[name] = b
|
||||
tiny.pack_start(b, False, False)
|
||||
|
||||
tiny.pack_start(now_playing, True, True)
|
||||
add_button( "REWIND", button.rewind_button)
|
||||
add_button("FORWARD", button.forward_button)
|
||||
add_button( "PLAY", button.play_button)
|
||||
add_button( "PAUSE", button.pause_button)
|
||||
add_button( "STOP", button.stop_button)
|
||||
add_button( "NEXT", button.next_button)
|
||||
tiny.show()
|
||||
|
|
|
@ -60,30 +60,6 @@ class PauseButton(Button):
|
|||
if playing == True:
|
||||
Button.show(self)
|
||||
|
||||
class StopButton(Button):
|
||||
def __init__(self):
|
||||
Button.__init__(self, gtk.STOCK_MEDIA_STOP, "Stop")
|
||||
def clicked(self, button):
|
||||
LS.controls.stop()
|
||||
|
||||
class NextButton(Button):
|
||||
def __init__(self):
|
||||
Button.__init__(self, gtk.STOCK_MEDIA_NEXT, "Next")
|
||||
def clicked(self, button):
|
||||
LS.controls.next()
|
||||
|
||||
class ForwardButton(Button):
|
||||
def __init__(self):
|
||||
Button.__init__(self, gtk.STOCK_MEDIA_FORWARD, "Skip Forward")
|
||||
def clicked(self, button):
|
||||
LS.controls.seek_forward()
|
||||
|
||||
class RewindButton(Button):
|
||||
def __init__(self):
|
||||
Button.__init__(self, gtk.STOCK_MEDIA_REWIND, "Skip Backward")
|
||||
def clicked(self, button):
|
||||
LS.controls.seek_backward()
|
||||
|
||||
class OpenButton(Button):
|
||||
def __init__(self):
|
||||
Button.__init__(self, gtk.STOCK_OPEN, "Open Anything")
|
||||
|
|
Loading…
Reference in New Issue