Random new preferences
The random feature uses the new preferences tree, rather than the preferences map.
This commit is contained in:
parent
5a02227e99
commit
3cd7f4b20f
|
@ -8,6 +8,7 @@ call = libsaria.event.call
|
||||||
exists = libsaria.path.exists
|
exists = libsaria.path.exists
|
||||||
expand = libsaria.path.expand
|
expand = libsaria.path.expand
|
||||||
FileRef = tagpy.FileRef
|
FileRef = tagpy.FileRef
|
||||||
|
prefs = None
|
||||||
|
|
||||||
import library
|
import library
|
||||||
import playlist
|
import playlist
|
||||||
|
@ -20,11 +21,13 @@ inc_score = library.inc_score
|
||||||
inc_count = library.inc_count
|
inc_count = library.inc_count
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
libsaria.init_pref("random", False)
|
global prefs
|
||||||
|
prefs = libsaria.prefs2
|
||||||
|
prefs.init_pref("libsaria.random", False)
|
||||||
libsaria.event.invite("POSTINIT", init)
|
libsaria.event.invite("POSTINIT", init)
|
||||||
|
|
||||||
def toggle_rand():
|
def toggle_rand():
|
||||||
libsaria.prefs["random"] = not libsaria.prefs["random"]
|
prefs.set_pref("libsaria.random", not prefs.get_pref("libsaria.random"))
|
||||||
|
|
||||||
cur_lib_id = -1
|
cur_lib_id = -1
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ def rand_next():
|
||||||
return id
|
return id
|
||||||
|
|
||||||
def next():
|
def next():
|
||||||
if libsaria.prefs["random"] == True:
|
if libsaria.prefs2.get_pref("libsaria.random") == True:
|
||||||
id = rand_next()
|
id = rand_next()
|
||||||
else:
|
else:
|
||||||
id = seq_next()
|
id = seq_next()
|
||||||
|
|
|
@ -5,6 +5,7 @@ import image
|
||||||
LS = ocarina.libsaria
|
LS = ocarina.libsaria
|
||||||
gtk = ocarina.gtk
|
gtk = ocarina.gtk
|
||||||
prefs = LS.prefs
|
prefs = LS.prefs
|
||||||
|
prefs2 = LS.prefs2
|
||||||
|
|
||||||
|
|
||||||
class Button(gtk.Button):
|
class Button(gtk.Button):
|
||||||
|
@ -115,7 +116,7 @@ class RandomButton(gtk.ToggleButton):
|
||||||
img = gtk.image_new_from_file("images/random.png")
|
img = gtk.image_new_from_file("images/random.png")
|
||||||
img.show()
|
img.show()
|
||||||
self.add(img)
|
self.add(img)
|
||||||
self.set_active(prefs["random"])
|
self.set_active(prefs2.get_pref("libsaria.random"))
|
||||||
self.set_relief(gtk.RELIEF_NONE)
|
self.set_relief(gtk.RELIEF_NONE)
|
||||||
self.connect("toggled", self.toggle)
|
self.connect("toggled", self.toggle)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
Loading…
Reference in New Issue