Finish new prefrences moveover
I have renamed libsaria.prefs2 to libsaria.prefs
This commit is contained in:
parent
a149b2f360
commit
5650f2d750
|
@ -18,40 +18,30 @@ from cache import Cache
|
||||||
|
|
||||||
# The cache is also saved across sessions
|
# The cache is also saved across sessions
|
||||||
prefs = None
|
prefs = None
|
||||||
prefs2 = None
|
|
||||||
cache = Cache()
|
cache = Cache()
|
||||||
|
|
||||||
plugin = None
|
plugin = None
|
||||||
audio = None
|
audio = None
|
||||||
lastfm = None
|
lastfm = None
|
||||||
|
|
||||||
init_pref2 = None
|
init_pref = None
|
||||||
|
|
||||||
|
|
||||||
# Initialize helpful variables
|
# Initialize helpful variables
|
||||||
def init():
|
def init():
|
||||||
global prefs
|
global prefs
|
||||||
global prefs2
|
global init_pref
|
||||||
global init_pref2
|
|
||||||
global audio
|
global audio
|
||||||
global lastfm
|
global lastfm
|
||||||
|
|
||||||
prefs = Map("preferences")
|
prefs = trees.get_pref_tree("preferences")
|
||||||
prefs2 = trees.get_pref_tree("preferences")
|
init_pref = prefs.init_pref
|
||||||
init_pref2 = prefs2.init_pref
|
|
||||||
import audio
|
import audio
|
||||||
import lastfm
|
import lastfm
|
||||||
|
|
||||||
event.start("POSTINIT")
|
event.start("POSTINIT")
|
||||||
|
|
||||||
|
|
||||||
# If a preference has not already been set, set pref[key] = value
|
|
||||||
def init_pref(key, value):
|
|
||||||
global prefs
|
|
||||||
if prefs.get(key, None) == None:
|
|
||||||
prefs[key] = value
|
|
||||||
|
|
||||||
|
|
||||||
def startup():
|
def startup():
|
||||||
global plugin
|
global plugin
|
||||||
import plugin
|
import plugin
|
||||||
|
|
|
@ -10,7 +10,7 @@ audio = None
|
||||||
tdelta = None
|
tdelta = None
|
||||||
|
|
||||||
def ls_init():
|
def ls_init():
|
||||||
libsaria.init_pref2("libsaria.audio.volume", 1.0)
|
libsaria.init_pref("libsaria.audio.volume", 1.0)
|
||||||
libsaria.event.invite("POSTINIT", ls_init)
|
libsaria.event.invite("POSTINIT", ls_init)
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
|
|
|
@ -20,7 +20,7 @@ def init():
|
||||||
|
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
player = gst.element_factory_make("playbin2", "player")
|
player = gst.element_factory_make("playbin2", "player")
|
||||||
set_volume_locked(libsaria.prefs2.get_pref("libsaria.audio.volume"))
|
set_volume_locked(libsaria.prefs.get_pref("libsaria.audio.volume"))
|
||||||
time = gst.Format(gst.FORMAT_TIME)
|
time = gst.Format(gst.FORMAT_TIME)
|
||||||
bus = player.get_bus()
|
bus = player.get_bus()
|
||||||
bus.add_signal_watch()
|
bus.add_signal_watch()
|
||||||
|
@ -181,7 +181,7 @@ def seek(prcnt):
|
||||||
def set_volume_locked(prcnt):
|
def set_volume_locked(prcnt):
|
||||||
global player
|
global player
|
||||||
player.set_property("volume", prcnt)
|
player.set_property("volume", prcnt)
|
||||||
libsaria.prefs2.set_pref("libsaria.audio.volume", prcnt)
|
libsaria.prefs.set_pref("libsaria.audio.volume", prcnt)
|
||||||
return prcnt
|
return prcnt
|
||||||
|
|
||||||
def set_volume(prcnt):
|
def set_volume(prcnt):
|
||||||
|
|
|
@ -22,7 +22,7 @@ inc_count = library.inc_count
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
global prefs
|
global prefs
|
||||||
prefs = libsaria.prefs2
|
prefs = libsaria.prefs
|
||||||
prefs.init_pref("libsaria.random", False)
|
prefs.init_pref("libsaria.random", False)
|
||||||
libsaria.event.invite("POSTINIT", init)
|
libsaria.event.invite("POSTINIT", init)
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@ import ocarina
|
||||||
|
|
||||||
from ocarina import collection
|
from ocarina import collection
|
||||||
|
|
||||||
libsaria.init_pref2("ocarina.window.width", 800)
|
libsaria.init_pref("ocarina.window.width", 800)
|
||||||
libsaria.init_pref2("ocarina.window.height", 600)
|
libsaria.init_pref("ocarina.window.height", 600)
|
||||||
|
|
||||||
prefs2 = libsaria.prefs2
|
prefs = libsaria.prefs
|
||||||
win_prefs = prefs2.lookup_child(["ocarina", "window"])
|
win_prefs = prefs.lookup_child(["ocarina", "window"])
|
||||||
size = (win_prefs.get_pref("width"), win_prefs.get_pref("height"))
|
size = (win_prefs.get_pref("width"), win_prefs.get_pref("height"))
|
||||||
|
|
||||||
win = ocarina.get_window(size)
|
win = ocarina.get_window(size)
|
||||||
|
|
|
@ -5,7 +5,6 @@ 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):
|
||||||
|
@ -116,7 +115,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(prefs2.get_pref("libsaria.random"))
|
self.set_active(prefs.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()
|
||||||
|
@ -146,7 +145,7 @@ class VolumeButton(gtk.VolumeButton):
|
||||||
|
|
||||||
adj = self.get_adjustment()
|
adj = self.get_adjustment()
|
||||||
adj.set_page_increment(0.05)
|
adj.set_page_increment(0.05)
|
||||||
self.set_value(prefs2.get_pref("libsaria.audio.volume"))
|
self.set_value(prefs.get_pref("libsaria.audio.volume"))
|
||||||
self.resize()
|
self.resize()
|
||||||
|
|
||||||
self.connect("value-changed", self.changed)
|
self.connect("value-changed", self.changed)
|
||||||
|
|
|
@ -142,7 +142,7 @@ class TwoWayPane(InfoBar):
|
||||||
self.bar = self.contents
|
self.bar = self.contents
|
||||||
self.tab = InfoTab(self.down_button)
|
self.tab = InfoTab(self.down_button)
|
||||||
self.pack_start(self.tab)
|
self.pack_start(self.tab)
|
||||||
if libsaria.prefs2.get_pref("ocarina.infopane.up") == True:
|
if libsaria.prefs.get_pref("ocarina.infopane.up") == True:
|
||||||
self.up_button()
|
self.up_button()
|
||||||
else:
|
else:
|
||||||
self.down_button()
|
self.down_button()
|
||||||
|
@ -150,12 +150,12 @@ class TwoWayPane(InfoBar):
|
||||||
def up_button(self):
|
def up_button(self):
|
||||||
self.bar.hide()
|
self.bar.hide()
|
||||||
self.tab.show()
|
self.tab.show()
|
||||||
libsaria.prefs2.set_pref("ocarina.infopane.up", True)
|
libsaria.prefs.set_pref("ocarina.infopane.up", True)
|
||||||
|
|
||||||
def down_button(self):
|
def down_button(self):
|
||||||
self.bar.show()
|
self.bar.show()
|
||||||
self.tab.hide()
|
self.tab.hide()
|
||||||
libsaria.prefs2.set_pref("ocarina.infopane.up", False)
|
libsaria.prefs.set_pref("ocarina.infopane.up", False)
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
|
|
|
@ -37,8 +37,8 @@ def init(size):
|
||||||
|
|
||||||
|
|
||||||
def resized(widget, geom):
|
def resized(widget, geom):
|
||||||
libsaria.prefs2.set_pref("ocarina.window.width", geom.width)
|
libsaria.prefs.set_pref("ocarina.window.width", geom.width)
|
||||||
libsaria.prefs2.set_pref("ocarina.window.height", geom.height)
|
libsaria.prefs.set_pref("ocarina.window.height", geom.height)
|
||||||
|
|
||||||
|
|
||||||
def dnd_receive(widget, context, x, y, selection, type, time):
|
def dnd_receive(widget, context, x, y, selection, type, time):
|
||||||
|
|
Loading…
Reference in New Issue