- 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) object.connect("image-found", self.set_image_cb, object, tmpImage)
elif not pixbuf is None: elif not pixbuf is None:
#tmpImage.set_pixbuf(pixbuf) #tmpImage.set_pixbuf(pixbuf)
tmpImage = ImageFrame(pixbuf, self.image_size) tmpImage = ImageFrame(pixbuf, self.image_size, use_reflection=True)
self.add_texture_group(tmpImage) self.add_texture_group(tmpImage)
@ -48,4 +48,7 @@ class MusicObjectRow(ImageRow):
if not pixbuf is None: if not pixbuf is None:
clutter.threads_init() clutter.threads_init()
tmpImage.set_pixbuf(pixbuf) tmpImage.set_pixbuf(pixbuf)
clutter.threads_leave() clutter.threads_leave()
def get_current_object(self):
return self.objectLibrary[self.currentSelection]

View File

@ -70,6 +70,14 @@ class Module:
#calculate a period of time the loading threads should sleep for when a timline is in progress #calculate a period of time the loading threads should sleep for when a timline is in progress
self.sleep_time = float(MusicObjectRow.frames) / float(MusicObjectRow.fps) self.sleep_time = float(MusicObjectRow.frames) / float(MusicObjectRow.fps)
self.artistImageRow.input_queue.input(event) 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): def begin(self, glossMgr):
@ -91,16 +99,25 @@ class Module:
self.stage.add(self.artistImageRow) self.stage.add(self.artistImageRow)
self.artistImageRow.set_opacity(0) self.artistImageRow.set_opacity(0)
self.artistImageRow.select_first()
self.artistImageRow.show() self.artistImageRow.show()
self.backdrop_behaviour.apply(self.artistImageRow) 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() self.timeline_backdrop.start()
#Load the rest of the images #Load the rest of the images
#thread.start_new_thread(self.load_image_range, (self.num_columns, len(self.artists)-1)) #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.timeline_backdrop.connect("completed", self.artistImageRow.load_image_range_cb)
#self.load_image_range(self.num_columns, len(self.artists)-1) #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 pango
import clutter import clutter
import os import os
from ui_elements.ReflectionTexture import Texture_Reflection
class ImageFrame(clutter.Group): class ImageFrame(clutter.Group):
def __init__(self, pixbuf, img_size): def __init__(self, pixbuf, img_size, use_reflection = False):
clutter.Group.__init__(self) clutter.Group.__init__(self)
self.width = img_size self.width = img_size
self.height = img_size self.height = img_size
@ -33,18 +34,13 @@ class ImageFrame(clutter.Group):
self.main_pic.show() self.main_pic.show()
""" #If a reflection is desired, add it on
#This just seems to keep changing in Clutter so I'll leave it here if use_reflection:
gap = (cover_size - self.main_pic.get_width())/2 self.reflection = Texture_Reflection(self.main_pic)
anchor_x = (cover_size - gap)/2 self.add(self.reflection)
#anchor_x = cover_size/2 self.reflection.show()
gap = (cover_size - self.main_pic.get_height())/2 else:
anchor_y = (cover_size - gap)/2 self.reflection = None
#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)
"""
self.main_pic.set_position(x, y) self.main_pic.set_position(x, y)
self.add(self.main_pic) self.add(self.main_pic)