- Small fixes

This commit is contained in:
noisymime 2008-04-28 13:18:32 +00:00
parent 7b9c77ffbf
commit b033753e6e
3 changed files with 38 additions and 24 deletions

View File

@ -38,8 +38,8 @@ class MusicObjectRow(ImageRow):
print "loading: " + object.name
pixbuf = object.get_image()
#If there is currently motion, we need to pause this work
if self.should_sleep():
time.sleep(0.1)
#if self.should_sleep():
# time.sleep(0.1)
#if self.sleep:
#self.timeline.connect('completed', self.restart_cb)
#time.sleep(self.music_player.sleep_time)

View File

@ -89,7 +89,7 @@ class Module:
self.artistImageRow.sleep = True
self.artistImageRow.input_queue.input(event)
#self.artistImageRow.input_queue.connect("queue-flushed", self.start_delay, self.load_albums, None)
self.artistImageRow.objectLibrary[0].pause_threads()
#self.artistImageRow.objectLibrary[0].pause_threads()
if self.queue_id == 0: self.queue_id = self.artistImageRow.input_queue.connect("queue-flushed", self.load_albums)
self.artistImageRow.sleep = False
@ -114,10 +114,12 @@ class Module:
self.list1.select_none_elegant()
self.current_context = self.CONTEXT_ROW
else:
self.list1.input_queue.input(event)
self.update_main_img()
elif (event.keyval == clutter.keysyms.Down):
self.list1.input_queue.input(event)
#if self.artist_queue_id == 0: self.artist_queue_id = self.list1.input_queue.connect("queue-flushed", self.update_main_img)
#self.update_main_img()
#Fills self.list2 with songs from an album
def process_songlist_from_album(self, list_item, album):
@ -128,12 +130,6 @@ class Module:
tmpItem = self.list2.add_item(song.name)
self.list2.display()
"""
#Simple delay
def start_delay(self, queue, function, args):
self.timeout_id = gobject.timeout_add((self.delay * 1000), function, args)
"""
#Loads albums into List1
def load_albums(self, queue):
if self.artistImageRow.input_queue.handler_is_connected(self.queue_id):
@ -148,29 +144,35 @@ class Module:
self.conn_id = self.backend.connect("query-complete", self.update_for_albums, artist)
def update_for_albums(self, data, artist = None):
if not artist == self.artistImageRow.get_current_object(): return
if not self.backend.handler_is_connected(self.conn_id):
return
self.backend.disconnect(self.conn_id)
albums = self.backend.get_albums_by_artistID(artist.artistID)
self.current_albums = self.backend.get_albums_by_artistID(artist.artistID)
clutter.threads_enter()
self.list1.clear()
for album in albums:
for album in self.current_albums:
tmpItem = self.list1.add_item(album.name)
tmpItem.connect("selected", self.process_songlist_from_album, album)
#name_string += album.name
self.list1.display()
#self.tmpLabel.set_text(name_string)
pixbuf = albums[0].get_image()
self.update_main_img()
clutter.threads_leave()
def update_main_img(self, data = None):
#clutter.threads_enter()
pixbuf = self.current_albums[self.list1.selected].get_image()
if not pixbuf is None:
self.main_img.set_pixbuf(pixbuf)
#clutter.threads_leave()
self.main_img.show()
else:
#clutter.threads_enter()
self.main_img.set_pixbuf(None)
self.main_img.hide()
clutter.threads_leave()
#clutter.threads_leave()
def begin(self, glossMgr):
self.timeline_loading = clutter.Timeline(10,40)
@ -198,11 +200,11 @@ class Module:
self.path_behaviour = clutter.BehaviourPath(knots = knots, alpha = self.alpha)
self.path_behaviour.apply(self.loading_img)
self.timeline_loading.start()
self.artistImageRow.objectLibrary = self.artists
self.artistImageRow.connect("load-complete", self.display, glossMgr)
self.timeline_loading.connect("completed", self.artistImageRow.load_image_range_cb, 0, len(self.artists)-1, False)
self.timeline_loading.start()
#thread.start_new_thread(self.artistImageRow.load_image_range, (0, len(self.artists)-1, True))
#gobject.idle_add(self.artistImageRow.load_image_range, 0, len(self.artists)-1, True)
@ -227,6 +229,7 @@ class Module:
#Just a nasty temp label for outputting stuff
self.list1 = LabelList(5)
self.list1.setup_from_theme_id(self.glossMgr.themeMgr, "music_albums")
self.list1.input_queue.connect("queue-flushed", self.update_main_img)
#self.list1.set_position(self.stage.get_width()/3, 350)
self.stage.add(self.list1)

View File

@ -63,7 +63,7 @@ class LabelList(clutter.Group):
def add_item(self, itemLabel):
if len(self.items) == 0:
#Perform a cheap hack to figure out the height of a label
tempLabel = clutter.Label()
tempLabel = clutter.Label()
tempLabel.set_font_name(self.font_string)
tempLabel.set_text("S")
@ -72,7 +72,7 @@ class LabelList(clutter.Group):
label_y = len(self.items) * (self.label_height + self.item_gap)
newItem = ListItem(self.font_string, itemLabel)
newItem = ListItem(self.font_string, itemLabel, label_list = self)
newItem.set_position(0, label_y)
newItem.show()
self.items.append(newItem)
@ -86,6 +86,7 @@ class LabelList(clutter.Group):
self.remove(item)
item = None
self.items = []
self.selected = 0
def display(self):
@ -177,7 +178,8 @@ class LabelList(clutter.Group):
self.selected = None
for i in range(0,len(self.items)):
self.items[i].scaleLabel(ListItem.SCALE_NONE, self.timeline)
self.selected = 0
self.timeline.start()
def select_none_elegant(self):
@ -247,13 +249,22 @@ class ListItem(clutter.Group):
scale_step_medium = 0.5
scale_step_none = 0.4
def __init__ (self, font, label_left = "", label_right = ""):
def __init__ (self, font, label_left = "", label_right = "", label_list = None):
clutter.Group.__init__ (self) #, menu, itemLabel, y)
self.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
self.set_anchor_point_from_gravity(clutter.GRAVITY_WEST)
self.label_left = clutter.Label()
self.label_right = clutter.Label()
#Takes the scale and opacity values from a label list, if given
if not label_list is None:
self.opacity_step_full = label_list.opacityStep0
self.opacity_step_medium = label_list.opacityStep1
self.opacity_step_none = label_list.opacityStep2
self.scale_step_full = label_list.zoomStep0
self.scale_step_medium = label_list.zoomStep1
self.scale_step_none = label_list.zoomStep2
#setup the label/s
self.add(self.label_left)
self.label_left.show()