Create a set locked function for album art
We appear to already be locked when we get to the setter function. I was getting deadlocked when trying to do anything. To fix this, I made it so I can set images without needing the lock.
This commit is contained in:
parent
614e009c4e
commit
06ec285734
|
@ -83,7 +83,7 @@ def set_artwork_tags(artist, album, path):
|
|||
cached = cache[artist]
|
||||
cached.delete("%s.jpg" % album)
|
||||
file = cached.get("%s.jpg" % album, set_art_from_file, path)
|
||||
libsaria.event.start("POSTGETART", file)
|
||||
libsaria.event.start("POSTSETART", file)
|
||||
|
||||
def get_artwork_id(id):
|
||||
artist, album = libsaria.sources.get_attrs(id, "artist", "album")
|
||||
|
|
|
@ -45,6 +45,7 @@ class AlbumArtImage(Image):
|
|||
self.connect("button-press-event", self.clicked)
|
||||
libsaria.event.invite("PRELOAD", self.preload)
|
||||
libsaria.event.invite("POSTGETART", self.set)
|
||||
libsaria.event.invite("POSTSETART", self.set_locked)
|
||||
|
||||
def preload(self, *args):
|
||||
self.file = "images/ocarina.png"
|
||||
|
@ -59,9 +60,11 @@ class AlbumArtImage(Image):
|
|||
return True
|
||||
|
||||
def set(self, file=None):
|
||||
#print "attempting to enter"
|
||||
gdk.threads_enter()
|
||||
#print "entered"
|
||||
self.set_locked(file)
|
||||
gdk.threads_leave()
|
||||
|
||||
def set_locked(self, file=None):
|
||||
for i in xrange(2):
|
||||
self.file = file
|
||||
try:
|
||||
|
@ -71,8 +74,6 @@ class AlbumArtImage(Image):
|
|||
except:
|
||||
pass
|
||||
file = "images/ocarina.png"
|
||||
#print "threads leaving"
|
||||
gdk.threads_leave()
|
||||
|
||||
def set_height(self, new_h):
|
||||
size = self.size_request()
|
||||
|
|
Loading…
Reference in New Issue