Button improvements

Changed the size of the random icon, and made the top row icons slightly
larger.
This commit is contained in:
Bryan Schumaker 2010-11-02 20:49:48 -04:00
parent 9eae107dee
commit 5803f74701
3 changed files with 11 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,16 +1,17 @@
# Bryan Schumaker (8/26/2010)
import ocarina
import image
LS = ocarina.libsaria
gtk = ocarina.gtk
prefs = LS.prefs
class Button(gtk.Button):
def __init__(self, stock, func=None, show=True):
def __init__(self, stock, size=gtk.ICON_SIZE_MENU, func=None, show=True):
gtk.Button.__init__(self)
self.func = func
img = gtk.image_new_from_stock(stock, gtk.ICON_SIZE_MENU)
img = gtk.image_new_from_stock(stock, size)
img.show()
self.add(img)
self.set_relief(gtk.RELIEF_NONE)
@ -78,15 +79,19 @@ class RewindButton(Button):
class OpenButton(Button):
def __init__(self):
Button.__init__(self, gtk.STOCK_OPEN)
Button.__init__(self, gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON)
def clicked(self, button):
from ocarina import fsselect
fsselect.run_chooser2(LS.data.universal_open)
class RandomButton(gtk.CheckButton):
class RandomButton(gtk.ToggleButton):
def __init__(self):
gtk.CheckButton.__init__(self, "Random")
gtk.ToggleButton.__init__(self)
img = gtk.image_new_from_file("images/random.png")
img.show()
self.add(img)
self.set_active(prefs["random"])
self.set_relief(gtk.RELIEF_NONE)
self.connect("toggled", self.toggle)
self.show()
@ -128,7 +133,7 @@ class VolumeButton(gtk.VolumeButton):
def resize(self):
image = self.get_children()[0]
icon = image.get_icon_name()[0]
image.set_from_icon_name(icon, gtk.ICON_SIZE_MENU)
image.set_from_icon_name(icon, gtk.ICON_SIZE_BUTTON)
def changed(self, widget, value):
LS.music.set_volume(value)