Move set_volume() and toggle_rand()

This commit is contained in:
Bryan Schumaker 2010-11-23 21:10:22 -05:00
parent 604d602448
commit 933e961d34
4 changed files with 12 additions and 22 deletions

View File

@ -39,11 +39,6 @@ def load(file):
return call("LOAD", audio.load, file)
#def stop():
# global audio
# return call("STOP", audio.stop)
def seek(prcnt):
global audio
return call("SEEK", audio.seek, prcnt)
@ -80,8 +75,3 @@ def get_time():
time = time.rsplit('.', 1)[0]
time = time.split(':', 1)[1]
return time
def set_volume(prcnt):
global audio
return call("SETVOLUME", audio.set_volume, prcnt)

View File

@ -3,18 +3,22 @@
audio = None
call = None
invite = None
prefs = None
def init():
global call
global audio
global invite
global prefs
import libsaria
call = libsaria.event.call
invite = libsaria.event.invite
prefs = libsaria.prefs
from audio import audio
invite("PREEOS", pause)
libsaria.init_pref("libsaria.random", False)
def play():
return call("PLAY", audio.play)
@ -24,3 +28,9 @@ def pause():
def stop():
return call("STOP", audio.stop)
def set_volume(prcnt):
return call("SETVOLUME", audio.set_volume, prcnt)
def toggle_rand():
prefs.set_pref("libsaria.random", not prefs.get_pref("libsaria.random"))

View File

@ -20,15 +20,6 @@ reset = library.reset
inc_score = library.inc_score
inc_count = library.inc_count
def init():
global prefs
prefs = libsaria.prefs
prefs.init_pref("libsaria.random", False)
libsaria.event.invite("POSTINIT", init)
def toggle_rand():
prefs.set_pref("libsaria.random", not prefs.get_pref("libsaria.random"))
cur_lib_id = -1
def new_source(path, bg=True):

View File

@ -122,8 +122,7 @@ class RandomButton(gtk.ToggleButton):
self.show()
def toggle(self, button):
LS.sources.toggle_rand()
LS.controls.toggle_rand()
class UpButton(Button):
def __init__(self, callback):
@ -162,5 +161,5 @@ class VolumeButton(gtk.VolumeButton):
image.set_from_icon_name(icon, gtk.ICON_SIZE_BUTTON)
def changed(self, widget, value):
LS.audio.set_volume(value)
LS.controls.set_volume(value)
widget.resize()