ocarina: Added volume button to header
This commit is contained in:
parent
6291cb6686
commit
5ff0419633
|
@ -27,9 +27,11 @@ def make_text(text):
|
||||||
|
|
||||||
def default_button_attrs(button, img, tooltip, show):
|
def default_button_attrs(button, img, tooltip, show):
|
||||||
button.set_relief(gtk.RELIEF_NONE)
|
button.set_relief(gtk.RELIEF_NONE)
|
||||||
img.show()
|
if img != None:
|
||||||
button.add(img)
|
img.show()
|
||||||
button.set_tooltip_text(tooltip)
|
button.add(img)
|
||||||
|
if tooltip != None:
|
||||||
|
button.set_tooltip_text(tooltip)
|
||||||
if show == True:
|
if show == True:
|
||||||
button.show()
|
button.show()
|
||||||
|
|
||||||
|
@ -118,3 +120,21 @@ def dislike_button(show):
|
||||||
like = None
|
like = None
|
||||||
controls.set_like(like)
|
controls.set_like(like)
|
||||||
return make_toggle("images/thumbs_down.png", set_dislike, "I don't like this", False, show)
|
return make_toggle("images/thumbs_down.png", set_dislike, "I don't like this", False, show)
|
||||||
|
|
||||||
|
def volume_button(volume, show):
|
||||||
|
b = gtk.VolumeButton()
|
||||||
|
default_button_attrs(b, None, None, show)
|
||||||
|
b.get_adjustment().set_page_increment(0.05)
|
||||||
|
b.set_value(volume)
|
||||||
|
|
||||||
|
def resize(button):
|
||||||
|
image = b.get_children()[0]
|
||||||
|
icon = image.get_icon_name()[0]
|
||||||
|
image.set_from_icon_name(icon, gtk.ICON_SIZE_MENU)
|
||||||
|
|
||||||
|
def changed(button, value):
|
||||||
|
controls.set_volume(value)
|
||||||
|
resize(button)
|
||||||
|
b.connect("value-changed", changed)
|
||||||
|
resize(b)
|
||||||
|
return b
|
||||||
|
|
|
@ -27,6 +27,7 @@ header_body.pack_start(sep, False, False)
|
||||||
add_button( "GOTO", button.goto_button(True))
|
add_button( "GOTO", button.goto_button(True))
|
||||||
add_button( "CLEAR", button.clear_button(True))
|
add_button( "CLEAR", button.clear_button(True))
|
||||||
add_button("RANDOM", button.random_button(libsaria.prefs.get_pref("libsaria.random"), True))
|
add_button("RANDOM", button.random_button(libsaria.prefs.get_pref("libsaria.random"), True))
|
||||||
|
add_button("VOLUME", button.volume_button(libsaria.prefs.get_pref("libsaria.audio.volume"), True))
|
||||||
|
|
||||||
#import ocarina
|
#import ocarina
|
||||||
#from ocarina.components import button
|
#from ocarina.components import button
|
||||||
|
|
Loading…
Reference in New Issue
Block a user