Move set_volume() and toggle_rand()
This commit is contained in:
parent
604d602448
commit
933e961d34
|
@ -39,11 +39,6 @@ def load(file):
|
||||||
return call("LOAD", audio.load, file)
|
return call("LOAD", audio.load, file)
|
||||||
|
|
||||||
|
|
||||||
#def stop():
|
|
||||||
# global audio
|
|
||||||
# return call("STOP", audio.stop)
|
|
||||||
|
|
||||||
|
|
||||||
def seek(prcnt):
|
def seek(prcnt):
|
||||||
global audio
|
global audio
|
||||||
return call("SEEK", audio.seek, prcnt)
|
return call("SEEK", audio.seek, prcnt)
|
||||||
|
@ -80,8 +75,3 @@ def get_time():
|
||||||
time = time.rsplit('.', 1)[0]
|
time = time.rsplit('.', 1)[0]
|
||||||
time = time.split(':', 1)[1]
|
time = time.split(':', 1)[1]
|
||||||
return time
|
return time
|
||||||
|
|
||||||
|
|
||||||
def set_volume(prcnt):
|
|
||||||
global audio
|
|
||||||
return call("SETVOLUME", audio.set_volume, prcnt)
|
|
||||||
|
|
|
@ -3,18 +3,22 @@
|
||||||
audio = None
|
audio = None
|
||||||
call = None
|
call = None
|
||||||
invite = None
|
invite = None
|
||||||
|
prefs = None
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
global call
|
global call
|
||||||
global audio
|
global audio
|
||||||
global invite
|
global invite
|
||||||
|
global prefs
|
||||||
|
|
||||||
import libsaria
|
import libsaria
|
||||||
call = libsaria.event.call
|
call = libsaria.event.call
|
||||||
invite = libsaria.event.invite
|
invite = libsaria.event.invite
|
||||||
|
prefs = libsaria.prefs
|
||||||
|
|
||||||
from audio import audio
|
from audio import audio
|
||||||
invite("PREEOS", pause)
|
invite("PREEOS", pause)
|
||||||
|
libsaria.init_pref("libsaria.random", False)
|
||||||
|
|
||||||
def play():
|
def play():
|
||||||
return call("PLAY", audio.play)
|
return call("PLAY", audio.play)
|
||||||
|
@ -24,3 +28,9 @@ def pause():
|
||||||
|
|
||||||
def stop():
|
def stop():
|
||||||
return call("STOP", audio.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"))
|
||||||
|
|
|
@ -20,15 +20,6 @@ reset = library.reset
|
||||||
inc_score = library.inc_score
|
inc_score = library.inc_score
|
||||||
inc_count = library.inc_count
|
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
|
cur_lib_id = -1
|
||||||
|
|
||||||
def new_source(path, bg=True):
|
def new_source(path, bg=True):
|
||||||
|
|
|
@ -122,8 +122,7 @@ class RandomButton(gtk.ToggleButton):
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def toggle(self, button):
|
def toggle(self, button):
|
||||||
LS.sources.toggle_rand()
|
LS.controls.toggle_rand()
|
||||||
|
|
||||||
|
|
||||||
class UpButton(Button):
|
class UpButton(Button):
|
||||||
def __init__(self, callback):
|
def __init__(self, callback):
|
||||||
|
@ -162,5 +161,5 @@ class VolumeButton(gtk.VolumeButton):
|
||||||
image.set_from_icon_name(icon, gtk.ICON_SIZE_BUTTON)
|
image.set_from_icon_name(icon, gtk.ICON_SIZE_BUTTON)
|
||||||
|
|
||||||
def changed(self, widget, value):
|
def changed(self, widget, value):
|
||||||
LS.audio.set_volume(value)
|
LS.controls.set_volume(value)
|
||||||
widget.resize()
|
widget.resize()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user