2011-04-18 20:55:01 -04:00
|
|
|
# Bryan Schumaker (2 / 20 / 2011)
|
|
|
|
|
|
|
|
import gtk
|
2011-04-20 08:21:54 -04:00
|
|
|
from libsaria import controls
|
2011-04-18 20:55:01 -04:00
|
|
|
|
|
|
|
SIZE = gtk.ICON_SIZE_MENU
|
|
|
|
|
|
|
|
def on_click(button, func):
|
|
|
|
func()
|
|
|
|
|
|
|
|
def stock_image(stock_item):
|
|
|
|
img = gtk.image_new_from_stock(stock_item, SIZE)
|
|
|
|
img.show()
|
|
|
|
return img
|
|
|
|
|
|
|
|
def make_text(text):
|
|
|
|
lbl = gtk.Label(text)
|
|
|
|
lbl.show()
|
|
|
|
return lbl
|
|
|
|
|
|
|
|
def default_button(func, show):
|
|
|
|
b = gtk.Button()
|
|
|
|
b.set_relief(gtk.RELIEF_NONE)
|
|
|
|
b.connect("clicked", on_click, func)
|
|
|
|
if show == True:
|
|
|
|
b.show()
|
|
|
|
return b
|
|
|
|
|
2011-04-20 08:21:54 -04:00
|
|
|
def make_button(stock_item, func, tooltip, show):
|
2011-04-18 20:55:01 -04:00
|
|
|
b = default_button(func, show)
|
|
|
|
img = stock_image(stock_item)
|
|
|
|
b.add(img)
|
2011-04-20 08:21:54 -04:00
|
|
|
b.set_tooltip_text(tooltip)
|
2011-04-18 20:55:01 -04:00
|
|
|
return b
|
|
|
|
|
2011-04-20 08:21:54 -04:00
|
|
|
|
|
|
|
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)
|
2011-04-20 21:07:00 -04:00
|
|
|
|
|
|
|
def goto_button(goto_func, show):
|
|
|
|
return make_button(gtk.STOCK_JUMP_TO, goto_func, "Go To Current Song", show)
|
2011-04-20 22:07:05 -04:00
|
|
|
|
|
|
|
def clear_button(clear_func, show):
|
|
|
|
return make_button(gtk.STOCK_CLEAR, clear_func, "Clear Current Source", show)
|