- Added reflections to music player

- Begun work on showing albums from artist
This commit is contained in:
noisymime 2008-03-19 21:41:47 +00:00
parent 9f8995cd25
commit 1b368ad3f9
3 changed files with 32 additions and 16 deletions

View File

@ -28,7 +28,7 @@ class MusicObjectRow(ImageRow):
object.connect("image-found", self.set_image_cb, object, tmpImage)
elif not pixbuf is None:
#tmpImage.set_pixbuf(pixbuf)
tmpImage = ImageFrame(pixbuf, self.image_size)
tmpImage = ImageFrame(pixbuf, self.image_size, use_reflection=True)
self.add_texture_group(tmpImage)
@ -49,3 +49,6 @@ class MusicObjectRow(ImageRow):
clutter.threads_init()
tmpImage.set_pixbuf(pixbuf)
clutter.threads_leave()
def get_current_object(self):
return self.objectLibrary[self.currentSelection]

View File

@ -71,6 +71,14 @@ class Module:
self.sleep_time = float(MusicObjectRow.frames) / float(MusicObjectRow.fps)
self.artistImageRow.input_queue.input(event)
#Just a little test code
artist = self.artistImageRow.get_current_object()
albums = self.backend.get_albums_by_artistID(artist.artistID)
name_string = ""
for album in albums:
name_string += album.name
self.tmpLabel.set_text(name_string)
def begin(self, glossMgr):
#Create a backdrop for the player. In this case we just use the same background as the menus
@ -91,16 +99,25 @@ class Module:
self.stage.add(self.artistImageRow)
self.artistImageRow.set_opacity(0)
self.artistImageRow.select_first()
self.artistImageRow.show()
self.backdrop_behaviour.apply(self.artistImageRow)
#Just a nasty temp label for outputting stuff
self.tmpLabel = clutter.Label()
self.tmpLabel.set_color(clutter.color_parse('White'))
self.tmpLabel.set_position(0, 350)
self.tmpLabel.set_text("Test")
self.tmpLabel.show()
self.stage.add(self.tmpLabel)
self.timeline_backdrop.start()
#Load the rest of the images
#thread.start_new_thread(self.load_image_range, (self.num_columns, len(self.artists)-1))
self.timeline_backdrop.connect("completed", self.artistImageRow.load_image_range_cb)
#self.load_image_range(self.num_columns, len(self.artists)-1)
self.artistImageRow.select_first()

View File

@ -3,10 +3,11 @@ import gtk
import pango
import clutter
import os
from ui_elements.ReflectionTexture import Texture_Reflection
class ImageFrame(clutter.Group):
def __init__(self, pixbuf, img_size):
def __init__(self, pixbuf, img_size, use_reflection = False):
clutter.Group.__init__(self)
self.width = img_size
self.height = img_size
@ -33,18 +34,13 @@ class ImageFrame(clutter.Group):
self.main_pic.show()
"""
#This just seems to keep changing in Clutter so I'll leave it here
gap = (cover_size - self.main_pic.get_width())/2
anchor_x = (cover_size - gap)/2
#anchor_x = cover_size/2
gap = (cover_size - self.main_pic.get_height())/2
anchor_y = (cover_size - gap)/2
#anchor_y = cover_size/2 #self.main_pic.get_height()/2
self.set_anchor_point(anchor_x, anchor_y)
#self.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
"""
#If a reflection is desired, add it on
if use_reflection:
self.reflection = Texture_Reflection(self.main_pic)
self.add(self.reflection)
self.reflection.show()
else:
self.reflection = None
self.main_pic.set_position(x, y)
self.add(self.main_pic)