parent
f60ae2c634
commit
f9417435b1
BIN
MenuMgr.pyc
BIN
MenuMgr.pyc
Binary file not shown.
19
SkinMgr.py
19
SkinMgr.py
|
@ -1,19 +0,0 @@
|
||||||
import clutter
|
|
||||||
import pygtk
|
|
||||||
import gtk
|
|
||||||
|
|
||||||
class SkinMgr:
|
|
||||||
|
|
||||||
def __init__ (self, mainStage):
|
|
||||||
self.stage = mainStage
|
|
||||||
|
|
||||||
def get_Background(self):
|
|
||||||
pixbuf = gtk.gdk.pixbuf_new_from_file("ui/background.png")
|
|
||||||
self.background = clutter.Texture()
|
|
||||||
self.background.set_pixbuf(pixbuf)
|
|
||||||
self.background.set_size(self.stage.get_width(), self.stage.get_height())
|
|
||||||
self.background.show()
|
|
||||||
return self.background
|
|
||||||
|
|
||||||
def get_menu_font(self):
|
|
||||||
return 'Tahoma 40'
|
|
BIN
SkinMgr.pyc
BIN
SkinMgr.pyc
Binary file not shown.
|
@ -0,0 +1,16 @@
|
||||||
|
class album:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def import_from_mythObject(self, mythObject):
|
||||||
|
try:
|
||||||
|
self.albumID = mythObject[0]
|
||||||
|
self.artistID = mythObject[1]
|
||||||
|
self.name = mythObject[2]
|
||||||
|
self.year = mythObject[3]
|
||||||
|
self.compilation = mythObject[4]
|
||||||
|
|
||||||
|
except IndexError, e:
|
||||||
|
print "Music_Player: Found difference in DB structure for albums. Attempting to continue."
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
class album:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def import_from_mythObject(self, mythObject):
|
||||||
|
try:
|
||||||
|
self.artistID = mythObject[0]
|
||||||
|
self.name = mythObject[1]
|
||||||
|
|
||||||
|
except IndexError, e:
|
||||||
|
print "Music_Player: Found difference in DB structure for artists. Attempting to continue."
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
import eyeD3
|
||||||
|
|
||||||
|
class song:
|
||||||
|
filename = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def import_from_mythObject(self, mythObject):
|
||||||
|
try:
|
||||||
|
self.songID = mythObject[0]
|
||||||
|
self.filename = mythObject[1]
|
||||||
|
self.name = mythObject[2]
|
||||||
|
self.track = mythObject[3]
|
||||||
|
self.artistID = mythObject[4]
|
||||||
|
self.albumID = mythObject[5]
|
||||||
|
self.genreID = mythObject[6]
|
||||||
|
self.year = mythObject[7]
|
||||||
|
self.length = mythObject[8]
|
||||||
|
self.numplays = mythObject[9]
|
||||||
|
self.rating = mythObject[10]
|
||||||
|
self.lastplay = mythObject[11]
|
||||||
|
self.date_entered = mythObject[12]
|
||||||
|
self.date_modified = mythObject[13]
|
||||||
|
self.format = mythObject[14]
|
||||||
|
self.mythdigest = mythObject[15]
|
||||||
|
self.size = mythObject[16]
|
||||||
|
self.description = mythObject[17]
|
||||||
|
self.comment = mythObject[18]
|
||||||
|
self.disc_count = mythObject[19]
|
||||||
|
self.disc_number = mythObject[20]
|
||||||
|
self.track_count = mythObject[21]
|
||||||
|
self.start_time = mythObject[22]
|
||||||
|
self.stop_time = mythObject[23]
|
||||||
|
self.eq_preset = mythObject[24]
|
||||||
|
self.retrieve_volume = mythObject[25]
|
||||||
|
self.sample_rate = mythObject[26]
|
||||||
|
self.bitrate = mythObject[27]
|
||||||
|
self.bpm = mythObject[28]
|
||||||
|
|
||||||
|
except IndexError, e:
|
||||||
|
print "Music_Player: Found difference in DB structure for songs. Attempting to continue."
|
||||||
|
|
||||||
|
def get_image(self):
|
||||||
|
#Basic check first up to make sure the filename is set
|
||||||
|
if self.filename is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
tag = eyeD3.Tag()
|
||||||
|
tag.link(filename)
|
||||||
|
"""
|
||||||
|
print tag.getArtist()
|
||||||
|
print tag.getAlbum()
|
||||||
|
print tag.getTitle()
|
||||||
|
"""
|
||||||
|
|
||||||
|
images = tag.getImages()
|
||||||
|
for img in images:
|
||||||
|
#str(img.picTypeToString(img.pictureType) + " Image"), \
|
||||||
|
#print "%s: [Size: %d bytes] [Type: %s]" % "test", len(img.imageData), img.mimeType
|
||||||
|
#print img.picTypeToString(img.pictureType) + " Image"
|
||||||
|
|
||||||
|
print "Image Mine Type: " + str(img.mimeType)
|
||||||
|
data = img.imageData
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import pygtk
|
import pygtk
|
||||||
import gtk
|
import gtk
|
||||||
import clutter
|
import clutter
|
||||||
import eyeD3
|
from modules.music_player.music_objects.song import song
|
||||||
|
from ui_elements.image_row import ImageRow
|
||||||
|
|
||||||
class Module():
|
class Module():
|
||||||
title = "Music"
|
title = "Music"
|
||||||
|
@ -9,10 +10,16 @@ class Module():
|
||||||
def __init__(self, glossMgr, dbMgr):
|
def __init__(self, glossMgr, dbMgr):
|
||||||
self.stage = glossMgr.get_stage()
|
self.stage = glossMgr.get_stage()
|
||||||
self.glossMgr = glossMgr
|
self.glossMgr = glossMgr
|
||||||
|
self.dbMgr = dbMgr
|
||||||
self.setup_ui()
|
self.setup_ui()
|
||||||
self.cover_viewer = coverViewer(self.stage)
|
self.albums = []
|
||||||
|
self.songs = []
|
||||||
|
|
||||||
|
self.base_dir = self.dbMgr.get_setting("MusicLocation")
|
||||||
|
print "Music Base Dir: " + self.base_dir
|
||||||
|
|
||||||
self.is_playing = False
|
self.is_playing = False
|
||||||
|
#self.load_albums()
|
||||||
|
|
||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
self.menu_image = self.glossMgr.themeMgr.get_texture("music_menu_image", None, None)
|
self.menu_image = self.glossMgr.themeMgr.get_texture("music_menu_image", None, None)
|
||||||
|
@ -53,42 +60,60 @@ class Module():
|
||||||
|
|
||||||
def unpause(self):
|
def unpause(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def load_albums(self):
|
||||||
|
"""
|
||||||
|
if not os.path.isdir(dirPath):
|
||||||
|
print "ERROR VideoPlayer: Invalid video path"
|
||||||
|
return None
|
||||||
|
|
||||||
|
final_file_list = []
|
||||||
class coverViewer(clutter.Group):
|
new_file_list = os.listdir(dirPath)
|
||||||
|
|
||||||
def __init__(self, stage):
|
#Videos and Directories
|
||||||
clutter.Group.__init__(self)
|
for dir_entry in new_file_list:
|
||||||
self.stage = stage
|
if os.path.isdir(dirPath + "/" + dir_entry) and not ( dir_entry[0] == "."):
|
||||||
self.covers = []
|
cover_viewer.add_folder(dir_entry)
|
||||||
self.num_covers = 0
|
#print dir_entry
|
||||||
self.cover_size = 50 #A cover will be cover_size * cover_size (X * Y)
|
else:
|
||||||
self.cover_gap = 10
|
final_file_list.append(dir_entry)
|
||||||
|
|
||||||
|
#Check if we're empty
|
||||||
|
if len(final_file_list) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
#Make sure the dirPath ends in "/"
|
||||||
|
if not dirPath[-1] == "/":
|
||||||
|
dirPath = dirPath + "/"
|
||||||
|
"""
|
||||||
|
#Generate some SQL to retrieve videos that were in the final_file_list
|
||||||
|
#Load the videos into the cover viewer
|
||||||
|
sql = "SELECT * FROM music_songs" # WHERE filename IN ("
|
||||||
|
"""
|
||||||
|
for filename in final_file_list:
|
||||||
|
filename = dirPath + filename
|
||||||
|
sql = sql + "\"" + filename + "\", "
|
||||||
|
sqlLength = int(len(sql) - 2)
|
||||||
|
sql = sql[:sqlLength]
|
||||||
|
sql = sql + ")"
|
||||||
|
"""
|
||||||
|
if self.glossMgr.debug: print "Music SQL: " + sql
|
||||||
|
|
||||||
|
results = self.dbMgr.run_sql(sql)
|
||||||
|
|
||||||
self.num_rows = 2
|
#Check for null return
|
||||||
self.num_columns = int(self.stage.get_width() / self.cover_size)
|
if results == None:
|
||||||
|
print "MusicPlayer: No connection to DB or no songs found in DB"
|
||||||
|
return None
|
||||||
|
|
||||||
def add_image(self, imagePath):
|
#Else add the entries in
|
||||||
tempTexture = clutter.Texture()
|
for record in results:
|
||||||
pixbuf = gtk.gdk.pixbuf_new_from_file(imagePath)
|
tempSong = song()
|
||||||
tempTexture.set_pixbuf(pixbuf)
|
tempSong.import_from_mythObject(record)
|
||||||
xy_ratio = tempTexture.get_width() / tempTexture.get_height()
|
self.songs.append(tempSong)
|
||||||
|
filename = self.base_dir + "/" + tempSong.filename
|
||||||
height = int(self.cover_size * xy_ratio)
|
#print filename
|
||||||
tempTexture.set_width(self.cover_size)
|
#tempSong.set_file(filename)
|
||||||
tempTexture.set_height(height)
|
|
||||||
|
|
||||||
self.add(tempTexture)
|
|
||||||
self.num_covers = self.num_covers +1
|
|
||||||
|
|
||||||
#Redo positioning on all textures to add new one :(
|
|
||||||
"""for i = 0 to self.num_covers:
|
|
||||||
tempTexture = self.get_nth_child(i)
|
|
||||||
x = (self.cover_gap + self.cover_size) * i
|
|
||||||
y = (i % self.num_rows) * self.cover_size
|
|
||||||
tempTexture.set_position(x, y)"""
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,10 @@ import pango
|
||||||
import clutter
|
import clutter
|
||||||
import os
|
import os
|
||||||
from modules.video_player.elements.CoverItem import cover_item
|
from modules.video_player.elements.CoverItem import cover_item
|
||||||
|
from ui_elements.image_grid import ImageGrid
|
||||||
from InputQueue import InputQueue
|
from InputQueue import InputQueue
|
||||||
|
|
||||||
class coverViewer(clutter.Group):
|
class coverViewer(ImageGrid):
|
||||||
scaleFactor = 1.4
|
scaleFactor = 1.4
|
||||||
inactiveOpacity = 150
|
inactiveOpacity = 150
|
||||||
covers_size_percent = 0.90 #This is the percentage of the total group size that the covers will take
|
covers_size_percent = 0.90 #This is the percentage of the total group size that the covers will take
|
||||||
|
@ -18,61 +19,11 @@ class coverViewer(clutter.Group):
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, glossMgr, width, height, rows, columns):
|
def __init__(self, glossMgr, width, height, rows, columns):
|
||||||
clutter.Group.__init__(self)
|
ImageGrid.__init__(self, glossMgr, width, height, rows, columns)
|
||||||
self.glossMgr = glossMgr
|
self.cover_size = self.image_size
|
||||||
self.stage = glossMgr.stage
|
|
||||||
self.videoLibrary = []
|
self.videoLibrary = []
|
||||||
self.textureLibrary = []
|
|
||||||
self.folderLibrary = []
|
self.folderLibrary = []
|
||||||
|
|
||||||
self.covers_group = clutter.Group()
|
|
||||||
self.covers_width = int(width * self.covers_size_percent)
|
|
||||||
self.covers_height = int(height * self.covers_size_percent)
|
|
||||||
|
|
||||||
self.num_visible_rows = rows
|
|
||||||
self.num_columns = columns
|
|
||||||
self.cover_size = int(self.covers_width / self.num_columns) #A cover will be cover_size * cover_size (X * Y)
|
|
||||||
|
|
||||||
|
|
||||||
#The viewer actually sits within another group that clips its size
|
|
||||||
self.covers_group_clip = clutter.Group()
|
|
||||||
self.covers_group_clip.add(self.covers_group)
|
|
||||||
#Nasty hack to get around centering problem
|
|
||||||
self.covers_group.set_position(int(self.cover_size/2), int(self.cover_size/2))
|
|
||||||
#And setup the clip size and position
|
|
||||||
scale_amount = int(self.cover_size * self.scaleFactor - self.cover_size)
|
|
||||||
clip_width = (self.cover_size*columns) + scale_amount #Width is the cover size by the number of colums, plus the additional amount required for scaling
|
|
||||||
clip_height = (self.cover_size*rows) + scale_amount
|
|
||||||
self.covers_group_clip.set_clip(-(scale_amount/2), -(scale_amount/2), clip_width, clip_height)
|
|
||||||
|
|
||||||
|
|
||||||
#self.current_video_details = video_details_group(self.covers_width)
|
|
||||||
self.num_covers = 0
|
|
||||||
self.cover_gap = 1
|
|
||||||
|
|
||||||
|
|
||||||
#Setup input queue controller
|
|
||||||
self.input_queue = InputQueue()
|
|
||||||
self.input_queue.set_action(InputQueue.NORTH, self.move_up)
|
|
||||||
self.input_queue.set_action(InputQueue.SOUTH, self.move_down)
|
|
||||||
self.input_queue.set_action(InputQueue.EAST, self.move_right)
|
|
||||||
self.input_queue.set_action(InputQueue.WEST, self.move_left)
|
|
||||||
|
|
||||||
|
|
||||||
#Setup the current min and max viewable rows
|
|
||||||
self.min_visible_rows = 0
|
|
||||||
self.max_visible_rows = self.num_visible_rows
|
|
||||||
|
|
||||||
self.currentSelection = 0
|
|
||||||
|
|
||||||
self.add(self.covers_group_clip)
|
|
||||||
covers_x = int(width * (1-self.covers_size_percent)/2)
|
|
||||||
covers_y = int(height * (1-self.covers_size_percent)/2)
|
|
||||||
#self.covers_group.set_position(covers_x, covers_y)
|
|
||||||
#self.covers_group.set_depth(1) #self.cover_size)
|
|
||||||
self.covers_group.show()
|
|
||||||
self.covers_group_clip.show()
|
|
||||||
|
|
||||||
def add_video(self, video):
|
def add_video(self, video):
|
||||||
self.videoLibrary.append(video)
|
self.videoLibrary.append(video)
|
||||||
tempTexture = cover_item(self.glossMgr, video, None, self.cover_size)
|
tempTexture = cover_item(self.glossMgr, video, None, self.cover_size)
|
||||||
|
@ -81,208 +32,16 @@ class coverViewer(clutter.Group):
|
||||||
def add_folder(self, folder_name):
|
def add_folder(self, folder_name):
|
||||||
tempTexture = cover_item(self.glossMgr, None, folder_name, self.cover_size)
|
tempTexture = cover_item(self.glossMgr, None, folder_name, self.cover_size)
|
||||||
self.folderLibrary.append(folder_name)
|
self.folderLibrary.append(folder_name)
|
||||||
self.add_texture_group(tempTexture)
|
self.add_texture_group(tempTexture)
|
||||||
|
|
||||||
def add_texture_group(self, tempGroup):
|
|
||||||
tempGroup.set_opacity(self.inactiveOpacity)
|
|
||||||
|
|
||||||
#tempGroup.set_position( (self.num_covers * self.cover_size), 0)
|
|
||||||
tempGroup.set_depth(1)
|
|
||||||
|
|
||||||
self.textureLibrary.append(tempGroup)
|
|
||||||
|
|
||||||
x = (self.num_covers % self.num_columns) * self.cover_size + ( (self.num_covers % self.num_columns) * self.cover_gap)
|
|
||||||
y = (self.cover_gap + self.cover_size) * (self.num_covers/self.num_columns)
|
|
||||||
|
|
||||||
#x = (self.num_covers % self.num_columns) * (self.cover_size * 1.5) + ( (self.num_covers % self.num_columns) * self.cover_gap)
|
|
||||||
#y = (self.cover_gap + (self.cover_size*1.5)) * (self.num_covers/self.num_columns)
|
|
||||||
|
|
||||||
tempGroup.set_position(x, y)
|
|
||||||
|
|
||||||
#If we're past the maximum rows, make the pics invistible
|
|
||||||
if self.num_covers > (self.num_columns * self.num_visible_rows)-1:
|
|
||||||
tempGroup.set_opacity(0)
|
|
||||||
else:
|
|
||||||
self.covers_group.add(tempGroup)
|
|
||||||
|
|
||||||
tempGroup.show()
|
|
||||||
self.num_covers = self.num_covers +1
|
|
||||||
|
|
||||||
|
|
||||||
def select_item(self, incomingItem, outgoingItem):
|
def select_item(self, incomingItem, outgoingItem):
|
||||||
self.timeline = clutter.Timeline(10,35)
|
|
||||||
self.input_queue.set_timeline(self.timeline)
|
|
||||||
numFolders = len(self.folderLibrary)
|
numFolders = len(self.folderLibrary)
|
||||||
if incomingItem >= numFolders:
|
if incomingItem >= numFolders:
|
||||||
incomingItemVideo = incomingItem - numFolders
|
incomingItemVideo = incomingItem - numFolders
|
||||||
|
|
||||||
#Check if the cover is currently not visible
|
ImageGrid.select_item(self, incomingItem, outgoingItem)
|
||||||
rolling = False
|
|
||||||
if incomingItem > (self.num_columns * self.max_visible_rows-1):
|
|
||||||
self.rollViewer(True, self.timeline)
|
|
||||||
rolling = True
|
|
||||||
if incomingItem < (self.num_columns * self.min_visible_rows):
|
|
||||||
self.rollViewer(False, self.timeline)
|
|
||||||
rolling = True
|
|
||||||
|
|
||||||
outgoingTexture = self.textureLibrary[outgoingItem]
|
|
||||||
incomingTexture = self.textureLibrary[incomingItem]
|
|
||||||
|
|
||||||
alpha = clutter.Alpha(self.timeline, clutter.smoothstep_inc_func)# clutter.ramp_inc_func)
|
|
||||||
self.behaviourNew_scale = clutter.BehaviourScale(x_scale_start=1, y_scale_start=1, x_scale_end=self.scaleFactor, y_scale_end=self.scaleFactor, alpha=alpha) #clutter.GRAVITY_CENTER)
|
|
||||||
self.behaviourNew_z = clutter.BehaviourDepth(depth_start=1, depth_end=2, alpha=alpha)
|
|
||||||
#If we're performing a roll (See above) then the incoming opacity should start at 0 rather than the normal inactive opacity
|
|
||||||
if rolling:
|
|
||||||
self.behaviourNew_opacity = clutter.BehaviourOpacity(opacity_start=0, opacity_end=255, alpha=alpha)
|
|
||||||
else:
|
|
||||||
self.behaviourNew_opacity = clutter.BehaviourOpacity(opacity_start=self.inactiveOpacity, opacity_end=255, alpha=alpha)
|
|
||||||
|
|
||||||
self.behaviourOld_scale = clutter.BehaviourScale(x_scale_start=self.scaleFactor, y_scale_start=self.scaleFactor, x_scale_end=1, y_scale_end=1, alpha=alpha)
|
|
||||||
self.behaviourOld_z = clutter.BehaviourDepth(depth_start=2, depth_end=1, alpha=alpha)
|
|
||||||
self.behaviourOld_opacity = clutter.BehaviourOpacity(opacity_start=255, opacity_end=self.inactiveOpacity, alpha=alpha)
|
|
||||||
|
|
||||||
(x, y) = incomingTexture.get_position()
|
|
||||||
(x, y) = self.covers_group.get_position()
|
|
||||||
anchor_x = incomingTexture.get_width()/2
|
|
||||||
anchor_y = incomingTexture.get_height()/2
|
|
||||||
#self.covers_group.set_anchor_point(anchor_x, anchor_y)
|
|
||||||
#incomingTexture.set_anchor_point(anchor_x, anchor_y)
|
|
||||||
|
|
||||||
self.behaviourNew_scale.apply(incomingTexture)
|
|
||||||
self.behaviourNew_z.apply(incomingTexture)
|
|
||||||
self.behaviourNew_opacity.apply(incomingTexture)
|
|
||||||
self.behaviourOld_scale.apply(outgoingTexture)
|
|
||||||
self.behaviourOld_z.apply(outgoingTexture)
|
|
||||||
self.behaviourOld_opacity.apply(outgoingTexture)
|
|
||||||
|
|
||||||
#Set gravities
|
|
||||||
|
|
||||||
|
|
||||||
(x, y) = outgoingTexture.get_position()
|
|
||||||
anchor_x = outgoingTexture.get_width()/2
|
|
||||||
anchor_y = outgoingTexture.get_height()/2
|
|
||||||
#outgoingTexture.set_anchor_point(anchor_x, anchor_y)
|
|
||||||
#incomingTexture.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
|
|
||||||
#outgoingTexture.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
|
|
||||||
|
|
||||||
|
|
||||||
self.currentSelection = incomingItem
|
|
||||||
|
|
||||||
self.timeline.start()
|
|
||||||
|
|
||||||
def select_first(self):
|
|
||||||
self.timeline = clutter.Timeline(20,80)
|
|
||||||
self.input_queue.set_timeline(self.timeline)
|
|
||||||
"""
|
|
||||||
if not len(self.folderLibrary) == 0:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self.current_video_details.set_video(self.videoLibrary[0], self.timeline)
|
|
||||||
"""
|
|
||||||
|
|
||||||
incomingItem = 0
|
|
||||||
incomingTexture = self.textureLibrary[incomingItem]
|
|
||||||
|
|
||||||
alpha = clutter.Alpha(self.timeline, clutter.ramp_inc_func)
|
|
||||||
#self.behaviourNew_scale = clutter.BehaviourScale(scale_start=1, scale_end=self.scaleFactor, alpha=alpha)
|
|
||||||
self.behaviourNew_scale = clutter.BehaviourScale(x_scale_start=1, y_scale_start=1, x_scale_end=self.scaleFactor, y_scale_end=self.scaleFactor, alpha=alpha)
|
|
||||||
self.behaviourNew_z = clutter.BehaviourDepth(depth_start=1, depth_end=2, alpha=alpha)
|
|
||||||
self.behaviourNew_opacity = clutter.BehaviourOpacity(opacity_start=self.inactiveOpacity, opacity_end=255, alpha=alpha)
|
|
||||||
|
|
||||||
self.behaviourNew_scale.apply(incomingTexture)
|
|
||||||
self.behaviourNew_z.apply(incomingTexture)
|
|
||||||
self.behaviourNew_opacity.apply(incomingTexture)
|
|
||||||
|
|
||||||
self.currentSelection = incomingItem
|
|
||||||
self.timeline.start()
|
|
||||||
|
|
||||||
def select_none(self):
|
|
||||||
if self.currentSelection is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.timeline = clutter.Timeline(10,35)
|
|
||||||
alpha = clutter.Alpha(self.timeline, clutter.smoothstep_inc_func)
|
|
||||||
|
|
||||||
self.behaviourOld_scale = clutter.BehaviourScale(x_scale_start=self.scaleFactor, y_scale_start=self.scaleFactor, x_scale_end=1, y_scale_end=1, alpha=alpha)
|
|
||||||
self.behaviourOld_z = clutter.BehaviourDepth(depth_start=2, depth_end=1, alpha=alpha)
|
|
||||||
self.behaviourOld_opacity = clutter.BehaviourOpacity(opacity_start=255, opacity_end=self.inactiveOpacity, alpha=alpha)
|
|
||||||
|
|
||||||
current_cover = self.textureLibrary[self.currentSelection]
|
|
||||||
self.behaviourOld_scale.apply(current_cover)
|
|
||||||
self.behaviourOld_z.apply(current_cover)
|
|
||||||
self.behaviourOld_opacity.apply(current_cover)
|
|
||||||
|
|
||||||
self.timeline.start()
|
|
||||||
|
|
||||||
#This moves the visible row of covers up and down
|
|
||||||
# moveUp: True if the covers are to come up, false if they're to go down
|
|
||||||
def rollViewer(self, moveUp, timeline):
|
|
||||||
if moveUp:
|
|
||||||
new_y = self.covers_group.get_y() - self.cover_size
|
|
||||||
self.max_visible_rows = self.max_visible_rows + 1
|
|
||||||
self.min_visible_rows = self.min_visible_rows + 1
|
|
||||||
|
|
||||||
#Define the row of covers that now needs to disapear / appear
|
|
||||||
min_outgoing = (self.min_visible_rows-1) * self.num_columns
|
|
||||||
max_outgoing = min_outgoing + self.num_columns
|
|
||||||
min_incoming = (self.max_visible_rows-1) * self.num_columns
|
|
||||||
max_incoming = min_incoming + self.num_columns
|
|
||||||
|
|
||||||
#Quick check to make sure that max_incoming isn't greater than the max number of images (This occurs when the final row is incomplete)
|
|
||||||
if max_incoming > self.num_covers:
|
|
||||||
max_incoming = min_incoming + (self.num_covers % self.num_columns)
|
|
||||||
else:
|
|
||||||
new_y = self.covers_group.get_y() + self.cover_size
|
|
||||||
self.max_visible_rows = self.max_visible_rows - 1
|
|
||||||
self.min_visible_rows = self.min_visible_rows - 1
|
|
||||||
|
|
||||||
#Define the row of covers that now needs to disapear / appear
|
|
||||||
min_incoming = (self.min_visible_rows) * self.num_columns
|
|
||||||
max_incoming = min_incoming + self.num_columns
|
|
||||||
min_outgoing = (self.max_visible_rows) * self.num_columns
|
|
||||||
max_outgoing = min_outgoing + self.num_columns
|
|
||||||
|
|
||||||
#Quick check to make sure that max_outgoing isn't greater than the max number of images (This occurs when the final row is incomplete)
|
|
||||||
if max_outgoing > self.num_covers:
|
|
||||||
max_outgoing = min_outgoing + (self.num_covers % self.num_columns)
|
|
||||||
|
|
||||||
#Need to add the new row to the group
|
|
||||||
self.addIncomingRow(min_incoming, max_incoming)
|
|
||||||
#And set the outgoing row to remove after the timeline finishes
|
|
||||||
self.timeline.connect('completed', self.removeOutgoingRow, min_outgoing, max_outgoing)
|
|
||||||
|
|
||||||
|
|
||||||
knots = (\
|
|
||||||
(self.covers_group.get_x(), self.covers_group.get_y()),\
|
|
||||||
(self.covers_group.get_x(), new_y) \
|
|
||||||
)
|
|
||||||
|
|
||||||
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
|
||||||
self.behaviour_path = clutter.BehaviourPath(alpha, knots)
|
|
||||||
self.behaviour_incoming = clutter.BehaviourOpacity(opacity_start=0, opacity_end=self.inactiveOpacity, alpha=alpha)
|
|
||||||
self.behaviour_outgoing = clutter.BehaviourOpacity(opacity_start=self.inactiveOpacity, opacity_end=0, alpha=alpha)
|
|
||||||
|
|
||||||
self.behaviour_path.apply(self.covers_group)
|
|
||||||
#Also need to change a few opacities - This is really messy, but works
|
|
||||||
for i in range(min_outgoing, max_outgoing):
|
|
||||||
self.behaviour_outgoing.apply(self.textureLibrary[i])
|
|
||||||
for i in range(min_incoming, max_incoming):
|
|
||||||
self.behaviour_incoming.apply(self.textureLibrary[i])
|
|
||||||
|
|
||||||
#These next two functions add and remove visible rows when the viewer rolls
|
|
||||||
def removeOutgoingRow(self, timeline, min, max):
|
|
||||||
for i in range(min, max):
|
|
||||||
self.covers_group.remove(self.textureLibrary[i])
|
|
||||||
|
|
||||||
def addIncomingRow(self, min, max):
|
|
||||||
for i in range(min, max):
|
|
||||||
self.covers_group.add(self.textureLibrary[i])
|
|
||||||
self.textureLibrary[i].set_opacity(0)
|
|
||||||
self.textureLibrary[i].show()
|
|
||||||
|
|
||||||
def get_current_item(self):
|
|
||||||
return self.textureLibrary[self.currentSelection]
|
|
||||||
|
|
||||||
def get_current_video(self):
|
def get_current_video(self):
|
||||||
if self.textureLibrary[self.currentSelection].isFolder:
|
if self.textureLibrary[self.currentSelection].isFolder:
|
||||||
return None #self.folderLibrary[(self.currentSelection-len(self.folderLibrary))]
|
return None #self.folderLibrary[(self.currentSelection-len(self.folderLibrary))]
|
||||||
|
@ -295,6 +54,12 @@ class coverViewer(clutter.Group):
|
||||||
def get_item_library(self):
|
def get_item_library(self):
|
||||||
return self.textureLibrary
|
return self.textureLibrary
|
||||||
|
|
||||||
|
def get_current_item(self):
|
||||||
|
if self.textureLibrary[self.currentSelection].isFolder:
|
||||||
|
return None #self.folderLibrary[(self.currentSelection-len(self.folderLibrary))]
|
||||||
|
else:
|
||||||
|
return self.textureLibrary[(self.currentSelection-len(self.folderLibrary))]
|
||||||
|
|
||||||
def set_details_update(self, on_off, details):
|
def set_details_update(self, on_off, details):
|
||||||
self.update_details = on_off
|
self.update_details = on_off
|
||||||
self.details_group = details
|
self.details_group = details
|
||||||
|
@ -304,36 +69,8 @@ class coverViewer(clutter.Group):
|
||||||
return self.timeline
|
return self.timeline
|
||||||
|
|
||||||
|
|
||||||
#These are the basic movement functions
|
|
||||||
def move_left(self):
|
|
||||||
#Make sure we're not already on the first cover
|
|
||||||
if not self.currentSelection == 0:
|
|
||||||
newItem = self.currentSelection - 1
|
|
||||||
self.move_common(newItem)
|
|
||||||
def move_right(self):
|
|
||||||
#This check makes sure that we're not on the last cover already
|
|
||||||
if not self.currentSelection == (self.num_covers-1):
|
|
||||||
newItem = self.currentSelection + 1
|
|
||||||
self.move_common(newItem)
|
|
||||||
def move_up(self):
|
|
||||||
#Check if we're already on the top row
|
|
||||||
if not (self.currentSelection < self.num_columns):
|
|
||||||
newItem = self.currentSelection - self.num_columns
|
|
||||||
self.move_common(newItem)
|
|
||||||
def move_down(self):
|
|
||||||
#Check if we're already on the bottom row
|
|
||||||
if not (self.currentSelection > (len(self.textureLibrary)-1 - self.num_columns)):
|
|
||||||
newItem = self.currentSelection + self.num_columns
|
|
||||||
self.move_common(newItem)
|
|
||||||
def move_common(self, newItem):
|
def move_common(self, newItem):
|
||||||
#Final sanity check
|
ImageGrid.move_common(self, newItem)
|
||||||
if (newItem < 0) and (not newItem == None):
|
|
||||||
newItem = self.currentSelection
|
|
||||||
|
|
||||||
#If there is movement, make the scale happen
|
|
||||||
if not newItem == None:
|
|
||||||
self.select_item(newItem, self.currentSelection)
|
|
||||||
|
|
||||||
|
|
||||||
if self.update_details:
|
if self.update_details:
|
||||||
if not self.textureLibrary[self.currentSelection].isFolder:
|
if not self.textureLibrary[self.currentSelection].isFolder:
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import pygtk
|
|
||||||
import gtk
|
|
||||||
import pygst
|
import pygst
|
||||||
import gst
|
import gst
|
||||||
import gobject
|
import gobject
|
||||||
|
|
|
@ -13,8 +13,6 @@ class ImageGrid(clutter.Group):
|
||||||
scaleFactor = 1.4
|
scaleFactor = 1.4
|
||||||
inactiveOpacity = 150
|
inactiveOpacity = 150
|
||||||
images_size_percent = 0.90 #This is the percentage of the total group size that the covers will take
|
images_size_percent = 0.90 #This is the percentage of the total group size that the covers will take
|
||||||
detailBox_height = 160 #Needs a percent
|
|
||||||
update_details = False
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, glossMgr, width, height, rows, columns):
|
def __init__(self, glossMgr, width, height, rows, columns):
|
||||||
|
@ -23,11 +21,10 @@ class ImageGrid(clutter.Group):
|
||||||
self.stage = glossMgr.stage
|
self.stage = glossMgr.stage
|
||||||
self.itemLibrary = []
|
self.itemLibrary = []
|
||||||
self.textureLibrary = []
|
self.textureLibrary = []
|
||||||
self.folderLibrary = []
|
|
||||||
|
|
||||||
self.images_group = clutter.Group()
|
self.images_group = clutter.Group()
|
||||||
self.images_width = int(width * self.imagess_size_percent)
|
self.images_width = int(width * self.images_size_percent)
|
||||||
self.images_height = int(height * self.imagess_size_percent)
|
self.images_height = int(height * self.images_size_percent)
|
||||||
|
|
||||||
self.num_visible_rows = rows
|
self.num_visible_rows = rows
|
||||||
self.num_columns = columns
|
self.num_columns = columns
|
||||||
|
@ -38,11 +35,11 @@ class ImageGrid(clutter.Group):
|
||||||
self.images_group_clip = clutter.Group()
|
self.images_group_clip = clutter.Group()
|
||||||
self.images_group_clip.add(self.images_group)
|
self.images_group_clip.add(self.images_group)
|
||||||
#Nasty hack to get around centering problem
|
#Nasty hack to get around centering problem
|
||||||
self.images_group.set_position(int(self.cover_size/2), int(self.cover_size/2))
|
self.images_group.set_position(int(self.image_size/2), int(self.image_size/2))
|
||||||
#And setup the clip size and position
|
#And setup the clip size and position
|
||||||
scale_amount = int(self.cover_size * self.scaleFactor - self.cover_size)
|
scale_amount = int(self.image_size * self.scaleFactor - self.image_size)
|
||||||
clip_width = (self.cover_size*columns) + scale_amount #Width is the cover size by the number of colums, plus the additional amount required for scaling
|
clip_width = (self.image_size*columns) + scale_amount #Width is the cover size by the number of colums, plus the additional amount required for scaling
|
||||||
clip_height = (self.cover_size*rows) + scale_amount
|
clip_height = (self.image_size*rows) + scale_amount
|
||||||
self.images_group_clip.set_clip(-(scale_amount/2), -(scale_amount/2), clip_width, clip_height)
|
self.images_group_clip.set_clip(-(scale_amount/2), -(scale_amount/2), clip_width, clip_height)
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,33 +66,24 @@ class ImageGrid(clutter.Group):
|
||||||
covers_x = int(width * (1-self.covers_size_percent)/2)
|
covers_x = int(width * (1-self.covers_size_percent)/2)
|
||||||
covers_y = int(height * (1-self.covers_size_percent)/2)
|
covers_y = int(height * (1-self.covers_size_percent)/2)
|
||||||
#self.images_group.set_position(covers_x, covers_y)
|
#self.images_group.set_position(covers_x, covers_y)
|
||||||
#self.images_group.set_depth(1) #self.cover_size)
|
#self.images_group.set_depth(1) #self.image_size)
|
||||||
self.images_group.show()
|
self.images_group.show()
|
||||||
self.images_group_clip.show()
|
self.images_group_clip.show()
|
||||||
|
|
||||||
def add_video(self, video):
|
|
||||||
self.videoLibrary.append(video)
|
|
||||||
tempTexture = cover_item(self.glossMgr, video, None, self.cover_size)
|
|
||||||
self.add_texture_group(tempTexture)
|
|
||||||
|
|
||||||
def add_folder(self, folder_name):
|
|
||||||
tempTexture = cover_item(self.glossMgr, None, folder_name, self.cover_size)
|
|
||||||
self.folderLibrary.append(folder_name)
|
|
||||||
self.add_texture_group(tempTexture)
|
|
||||||
|
|
||||||
def add_texture_group(self, tempGroup):
|
def add_texture_group(self, tempGroup):
|
||||||
tempGroup.set_opacity(self.inactiveOpacity)
|
tempGroup.set_opacity(self.inactiveOpacity)
|
||||||
|
|
||||||
#tempGroup.set_position( (self.num_covers * self.cover_size), 0)
|
#tempGroup.set_position( (self.num_covers * self.image_size), 0)
|
||||||
tempGroup.set_depth(1)
|
tempGroup.set_depth(1)
|
||||||
|
|
||||||
self.textureLibrary.append(tempGroup)
|
self.textureLibrary.append(tempGroup)
|
||||||
|
|
||||||
x = (self.num_covers % self.num_columns) * self.cover_size + ( (self.num_covers % self.num_columns) * self.cover_gap)
|
x = (self.num_covers % self.num_columns) * self.image_size + ( (self.num_covers % self.num_columns) * self.cover_gap)
|
||||||
y = (self.cover_gap + self.cover_size) * (self.num_covers/self.num_columns)
|
y = (self.cover_gap + self.image_size) * (self.num_covers/self.num_columns)
|
||||||
|
|
||||||
#x = (self.num_covers % self.num_columns) * (self.cover_size * 1.5) + ( (self.num_covers % self.num_columns) * self.cover_gap)
|
#x = (self.num_covers % self.num_columns) * (self.image_size * 1.5) + ( (self.num_covers % self.num_columns) * self.cover_gap)
|
||||||
#y = (self.cover_gap + (self.cover_size*1.5)) * (self.num_covers/self.num_columns)
|
#y = (self.cover_gap + (self.image_size*1.5)) * (self.num_covers/self.num_columns)
|
||||||
|
|
||||||
tempGroup.set_position(x, y)
|
tempGroup.set_position(x, y)
|
||||||
|
|
||||||
|
@ -112,9 +100,6 @@ class ImageGrid(clutter.Group):
|
||||||
def select_item(self, incomingItem, outgoingItem):
|
def select_item(self, incomingItem, outgoingItem):
|
||||||
self.timeline = clutter.Timeline(10,35)
|
self.timeline = clutter.Timeline(10,35)
|
||||||
self.input_queue.set_timeline(self.timeline)
|
self.input_queue.set_timeline(self.timeline)
|
||||||
numFolders = len(self.folderLibrary)
|
|
||||||
if incomingItem >= numFolders:
|
|
||||||
incomingItemVideo = incomingItem - numFolders
|
|
||||||
|
|
||||||
#Check if the cover is currently not visible
|
#Check if the cover is currently not visible
|
||||||
rolling = False
|
rolling = False
|
||||||
|
@ -218,7 +203,7 @@ class ImageGrid(clutter.Group):
|
||||||
# moveUp: True if the covers are to come up, false if they're to go down
|
# moveUp: True if the covers are to come up, false if they're to go down
|
||||||
def rollViewer(self, moveUp, timeline):
|
def rollViewer(self, moveUp, timeline):
|
||||||
if moveUp:
|
if moveUp:
|
||||||
new_y = self.images_group.get_y() - self.cover_size
|
new_y = self.images_group.get_y() - self.image_size
|
||||||
self.max_visible_rows = self.max_visible_rows + 1
|
self.max_visible_rows = self.max_visible_rows + 1
|
||||||
self.min_visible_rows = self.min_visible_rows + 1
|
self.min_visible_rows = self.min_visible_rows + 1
|
||||||
|
|
||||||
|
@ -232,7 +217,7 @@ class ImageGrid(clutter.Group):
|
||||||
if max_incoming > self.num_covers:
|
if max_incoming > self.num_covers:
|
||||||
max_incoming = min_incoming + (self.num_covers % self.num_columns)
|
max_incoming = min_incoming + (self.num_covers % self.num_columns)
|
||||||
else:
|
else:
|
||||||
new_y = self.images_group.get_y() + self.cover_size
|
new_y = self.images_group.get_y() + self.image_size
|
||||||
self.max_visible_rows = self.max_visible_rows - 1
|
self.max_visible_rows = self.max_visible_rows - 1
|
||||||
self.min_visible_rows = self.min_visible_rows - 1
|
self.min_visible_rows = self.min_visible_rows - 1
|
||||||
|
|
||||||
|
@ -284,10 +269,7 @@ class ImageGrid(clutter.Group):
|
||||||
return self.textureLibrary[self.currentSelection]
|
return self.textureLibrary[self.currentSelection]
|
||||||
|
|
||||||
def get_current_item(self):
|
def get_current_item(self):
|
||||||
if self.textureLibrary[self.currentSelection].isFolder:
|
return self.itemLibrary[(self.currentSelection-len(self.folderLibrary))]
|
||||||
return None #self.folderLibrary[(self.currentSelection-len(self.folderLibrary))]
|
|
||||||
else:
|
|
||||||
return self.itemLibrary[(self.currentSelection-len(self.folderLibrary))]
|
|
||||||
|
|
||||||
#Was get_item_x()
|
#Was get_item_x()
|
||||||
def get_texture_x(self, itemNo):
|
def get_texture_x(self, itemNo):
|
||||||
|
|
|
@ -0,0 +1,290 @@
|
||||||
|
import pygtk
|
||||||
|
import gtk
|
||||||
|
import pygst
|
||||||
|
import gst
|
||||||
|
import gobject
|
||||||
|
import pango
|
||||||
|
import clutter
|
||||||
|
import os
|
||||||
|
from modules.video_player.elements.CoverItem import cover_item
|
||||||
|
from InputQueue import InputQueue
|
||||||
|
|
||||||
|
class ImageRow(clutter.Group):
|
||||||
|
DIRECTION_LEFT, DIRECTION_RIGHT = range(2)
|
||||||
|
|
||||||
|
scaleFactor = 1.4
|
||||||
|
inactiveOpacity = 150
|
||||||
|
images_size_percent = 0.90 #This is the percentage of the total group size that the covers will take
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, glossMgr, width, height, columns):
|
||||||
|
clutter.Group.__init__(self)
|
||||||
|
self.glossMgr = glossMgr
|
||||||
|
self.stage = glossMgr.stage
|
||||||
|
self.textureLibrary = []
|
||||||
|
|
||||||
|
self.images_group = clutter.Group()
|
||||||
|
self.images_width = int(width * self.images_size_percent)
|
||||||
|
self.images_height = int(height * self.images_size_percent)
|
||||||
|
|
||||||
|
self.num_visible_rows = rows
|
||||||
|
self.num_columns = columns
|
||||||
|
self.image_size = int(self.images_width / self.num_columns) #A cover will be cover_size * cover_size (X * Y)
|
||||||
|
|
||||||
|
|
||||||
|
#The viewer actually sits within another group that clips its size
|
||||||
|
self.images_group_clip = clutter.Group()
|
||||||
|
self.images_group_clip.add(self.images_group)
|
||||||
|
#Nasty hack to get around centering problem
|
||||||
|
self.images_group.set_position(int(self.image_size/2), int(self.image_size/2))
|
||||||
|
#And setup the clip size and position
|
||||||
|
scale_amount = int(self.image_size * self.scaleFactor - self.image_size)
|
||||||
|
clip_width = (self.image_size*columns) + scale_amount #Width is the cover size by the number of colums, plus the additional amount required for scaling
|
||||||
|
clip_height = (self.image_size*rows) + scale_amount
|
||||||
|
self.images_group_clip.set_clip(-(scale_amount/2), -(scale_amount/2), clip_width, clip_height)
|
||||||
|
|
||||||
|
|
||||||
|
#self.current_video_details = video_details_group(self.covers_width)
|
||||||
|
self.num_images = 0
|
||||||
|
self.image_gap = 1
|
||||||
|
|
||||||
|
|
||||||
|
#Setup input queue controller
|
||||||
|
self.input_queue = InputQueue()
|
||||||
|
self.input_queue.set_action(InputQueue.EAST, self.move_right)
|
||||||
|
self.input_queue.set_action(InputQueue.WEST, self.move_left)
|
||||||
|
|
||||||
|
|
||||||
|
#Setup the current min and max viewable rows
|
||||||
|
self.min_visible_columns = 0
|
||||||
|
self.max_visible_columns = self.num_visible_columns
|
||||||
|
|
||||||
|
self.currentSelection = 0
|
||||||
|
|
||||||
|
self.add(self.images_group_clip)
|
||||||
|
covers_x = int(width * (1-self.covers_size_percent)/2)
|
||||||
|
covers_y = int(height * (1-self.covers_size_percent)/2)
|
||||||
|
#self.images_group.set_position(covers_x, covers_y)
|
||||||
|
#self.images_group.set_depth(1) #self.image_size)
|
||||||
|
self.images_group.show()
|
||||||
|
self.images_group_clip.show()
|
||||||
|
|
||||||
|
|
||||||
|
def add_texture_group(self, tempGroup):
|
||||||
|
tempGroup.set_opacity(self.inactiveOpacity)
|
||||||
|
|
||||||
|
#tempGroup.set_position( (self.num_covers * self.image_size), 0)
|
||||||
|
tempGroup.set_depth(1)
|
||||||
|
|
||||||
|
self.textureLibrary.append(tempGroup)
|
||||||
|
|
||||||
|
x = self.num_covers * self.image_size + ( self.num_covers * self.cover_gap)
|
||||||
|
y = 0#(self.cover_gap + self.image_size) * (self.num_covers/self.num_columns)
|
||||||
|
|
||||||
|
tempGroup.set_position(x, y)
|
||||||
|
|
||||||
|
#If we're past the maximum rows, make the pics invistible
|
||||||
|
if self.num_covers > (self.num_columns * self.num_visible_rows)-1:
|
||||||
|
tempGroup.set_opacity(0)
|
||||||
|
else:
|
||||||
|
self.images_group.add(tempGroup)
|
||||||
|
|
||||||
|
tempGroup.show()
|
||||||
|
self.num_covers = self.num_covers +1
|
||||||
|
|
||||||
|
|
||||||
|
def select_item(self, incomingItem, outgoingItem):
|
||||||
|
self.timeline = clutter.Timeline(10,35)
|
||||||
|
self.input_queue.set_timeline(self.timeline)
|
||||||
|
|
||||||
|
#Check if the cover is currently not visible
|
||||||
|
rolling = False
|
||||||
|
if incomingItem > (self.max_visible_columns-1):
|
||||||
|
self.rollViewer(self.DIRECTION_LEFT, self.timeline)
|
||||||
|
rolling = True
|
||||||
|
if incomingItem < (self.min_visible_columns):
|
||||||
|
self.rollViewer(self.DIRECTION_RIGHT, self.timeline)
|
||||||
|
rolling = True
|
||||||
|
|
||||||
|
outgoingTexture = self.textureLibrary[outgoingItem]
|
||||||
|
incomingTexture = self.textureLibrary[incomingItem]
|
||||||
|
|
||||||
|
alpha = clutter.Alpha(self.timeline, clutter.smoothstep_inc_func)# clutter.ramp_inc_func)
|
||||||
|
self.behaviourNew_scale = clutter.BehaviourScale(x_scale_start=1, y_scale_start=1, x_scale_end=self.scaleFactor, y_scale_end=self.scaleFactor, alpha=alpha) #clutter.GRAVITY_CENTER)
|
||||||
|
self.behaviourNew_z = clutter.BehaviourDepth(depth_start=1, depth_end=2, alpha=alpha)
|
||||||
|
#If we're performing a roll (See above) then the incoming opacity should start at 0 rather than the normal inactive opacity
|
||||||
|
if rolling:
|
||||||
|
self.behaviourNew_opacity = clutter.BehaviourOpacity(opacity_start=0, opacity_end=255, alpha=alpha)
|
||||||
|
else:
|
||||||
|
self.behaviourNew_opacity = clutter.BehaviourOpacity(opacity_start=self.inactiveOpacity, opacity_end=255, alpha=alpha)
|
||||||
|
|
||||||
|
self.behaviourOld_scale = clutter.BehaviourScale(x_scale_start=self.scaleFactor, y_scale_start=self.scaleFactor, x_scale_end=1, y_scale_end=1, alpha=alpha)
|
||||||
|
self.behaviourOld_z = clutter.BehaviourDepth(depth_start=2, depth_end=1, alpha=alpha)
|
||||||
|
self.behaviourOld_opacity = clutter.BehaviourOpacity(opacity_start=255, opacity_end=self.inactiveOpacity, alpha=alpha)
|
||||||
|
|
||||||
|
(x, y) = incomingTexture.get_position()
|
||||||
|
(x, y) = self.images_group.get_position()
|
||||||
|
anchor_x = incomingTexture.get_width()/2
|
||||||
|
anchor_y = incomingTexture.get_height()/2
|
||||||
|
#self.images_group.set_anchor_point(anchor_x, anchor_y)
|
||||||
|
#incomingTexture.set_anchor_point(anchor_x, anchor_y)
|
||||||
|
|
||||||
|
self.behaviourNew_scale.apply(incomingTexture)
|
||||||
|
self.behaviourNew_z.apply(incomingTexture)
|
||||||
|
self.behaviourNew_opacity.apply(incomingTexture)
|
||||||
|
self.behaviourOld_scale.apply(outgoingTexture)
|
||||||
|
self.behaviourOld_z.apply(outgoingTexture)
|
||||||
|
self.behaviourOld_opacity.apply(outgoingTexture)
|
||||||
|
|
||||||
|
#Set gravities
|
||||||
|
|
||||||
|
|
||||||
|
(x, y) = outgoingTexture.get_position()
|
||||||
|
anchor_x = outgoingTexture.get_width()/2
|
||||||
|
anchor_y = outgoingTexture.get_height()/2
|
||||||
|
#outgoingTexture.set_anchor_point(anchor_x, anchor_y)
|
||||||
|
#incomingTexture.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
|
||||||
|
#outgoingTexture.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
|
||||||
|
|
||||||
|
|
||||||
|
self.currentSelection = incomingItem
|
||||||
|
|
||||||
|
self.timeline.start()
|
||||||
|
|
||||||
|
def select_first(self):
|
||||||
|
self.timeline = clutter.Timeline(20,80)
|
||||||
|
self.input_queue.set_timeline(self.timeline)
|
||||||
|
"""
|
||||||
|
if not len(self.folderLibrary) == 0:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.current_video_details.set_video(self.videoLibrary[0], self.timeline)
|
||||||
|
"""
|
||||||
|
|
||||||
|
incomingItem = 0
|
||||||
|
incomingTexture = self.textureLibrary[incomingItem]
|
||||||
|
|
||||||
|
alpha = clutter.Alpha(self.timeline, clutter.ramp_inc_func)
|
||||||
|
#self.behaviourNew_scale = clutter.BehaviourScale(scale_start=1, scale_end=self.scaleFactor, alpha=alpha)
|
||||||
|
self.behaviourNew_scale = clutter.BehaviourScale(x_scale_start=1, y_scale_start=1, x_scale_end=self.scaleFactor, y_scale_end=self.scaleFactor, alpha=alpha)
|
||||||
|
self.behaviourNew_z = clutter.BehaviourDepth(depth_start=1, depth_end=2, alpha=alpha)
|
||||||
|
self.behaviourNew_opacity = clutter.BehaviourOpacity(opacity_start=self.inactiveOpacity, opacity_end=255, alpha=alpha)
|
||||||
|
|
||||||
|
self.behaviourNew_scale.apply(incomingTexture)
|
||||||
|
self.behaviourNew_z.apply(incomingTexture)
|
||||||
|
self.behaviourNew_opacity.apply(incomingTexture)
|
||||||
|
|
||||||
|
self.currentSelection = incomingItem
|
||||||
|
self.timeline.start()
|
||||||
|
|
||||||
|
def select_none(self):
|
||||||
|
if self.currentSelection is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.timeline = clutter.Timeline(10,35)
|
||||||
|
alpha = clutter.Alpha(self.timeline, clutter.smoothstep_inc_func)
|
||||||
|
|
||||||
|
self.behaviourOld_scale = clutter.BehaviourScale(x_scale_start=self.scaleFactor, y_scale_start=self.scaleFactor, x_scale_end=1, y_scale_end=1, alpha=alpha)
|
||||||
|
self.behaviourOld_z = clutter.BehaviourDepth(depth_start=2, depth_end=1, alpha=alpha)
|
||||||
|
self.behaviourOld_opacity = clutter.BehaviourOpacity(opacity_start=255, opacity_end=self.inactiveOpacity, alpha=alpha)
|
||||||
|
|
||||||
|
current_cover = self.textureLibrary[self.currentSelection]
|
||||||
|
self.behaviourOld_scale.apply(current_cover)
|
||||||
|
self.behaviourOld_z.apply(current_cover)
|
||||||
|
self.behaviourOld_opacity.apply(current_cover)
|
||||||
|
|
||||||
|
self.timeline.start()
|
||||||
|
|
||||||
|
#This moves the visible row of covers up and down
|
||||||
|
# moveUp: True if the covers are to come up, false if they're to go down
|
||||||
|
def rollViewer(self, direction, timeline):
|
||||||
|
if direction == self.DIRECTION_LEFT:
|
||||||
|
new_y = self.images_group.get_y() - self.image_size
|
||||||
|
self.max_visible_column += 1
|
||||||
|
self.min_visible_column += 1
|
||||||
|
|
||||||
|
#Define the row of image that now needs to disapear / appear
|
||||||
|
outgoing = self.min_visible_column - 1
|
||||||
|
incoming = self.max_visible_column - 1
|
||||||
|
|
||||||
|
#Quick check to make sure that max_incoming isn't greater than the max number of images (This occurs when the final row is incomplete)
|
||||||
|
if incoming > self.num_covers:
|
||||||
|
return None
|
||||||
|
elif direction == self.DIRECTION_RIGHT:
|
||||||
|
new_y = self.images_group.get_y() + self.image_size
|
||||||
|
self.max_visible_column -= 1
|
||||||
|
self.min_visible_column -= 1
|
||||||
|
|
||||||
|
#Define the row of covers that now needs to disapear / appear
|
||||||
|
outgoing = self.min_visible_column + 1
|
||||||
|
incoming = self.max_visible_column + 1
|
||||||
|
|
||||||
|
#Quick check to make sure that max_outgoing isn't greater than the max number of images (This occurs when the final row is incomplete)
|
||||||
|
if outgoing > self.num_images:
|
||||||
|
return None
|
||||||
|
|
||||||
|
#Need to add the new row to the group
|
||||||
|
self.images_group.add(self.textureLibrary[incoming])
|
||||||
|
#And set the outgoing row to remove after the timeline finishes
|
||||||
|
self.timeline.connect('completed', self.removeItem, outgoing)
|
||||||
|
|
||||||
|
|
||||||
|
knots = (\
|
||||||
|
(self.images_group.get_x(), self.images_group.get_y()),\
|
||||||
|
(self.images_group.get_x(), new_y) \
|
||||||
|
)
|
||||||
|
|
||||||
|
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
|
||||||
|
self.behaviour_path = clutter.BehaviourPath(alpha, knots)
|
||||||
|
self.behaviour_incoming = clutter.BehaviourOpacity(opacity_start=0, opacity_end=self.inactiveOpacity, alpha=alpha)
|
||||||
|
self.behaviour_outgoing = clutter.BehaviourOpacity(opacity_start=self.inactiveOpacity, opacity_end=0, alpha=alpha)
|
||||||
|
|
||||||
|
self.behaviour_path.apply(self.images_group)
|
||||||
|
self.behaviour_outgoing.apply(self.textureLibrary[incoming])
|
||||||
|
self.behaviour_incoming.apply(self.textureLibrary[outgoing])
|
||||||
|
|
||||||
|
def remove_item(self, itemNo):
|
||||||
|
self.images_group.remove(self.textureLibrary[itemNo])
|
||||||
|
|
||||||
|
|
||||||
|
def get_current_texture(self):
|
||||||
|
return self.textureLibrary[self.currentSelection]
|
||||||
|
|
||||||
|
def get_current_item(self):
|
||||||
|
return self.itemLibrary[(self.currentSelection-len(self.folderLibrary))]
|
||||||
|
|
||||||
|
#Was get_item_x()
|
||||||
|
def get_texture_x(self, itemNo):
|
||||||
|
return self.textureLibrary[itemNo]
|
||||||
|
|
||||||
|
def get_item_library(self):
|
||||||
|
return self.textureLibrary
|
||||||
|
|
||||||
|
def set_details_update(self, on_off, details):
|
||||||
|
self.update_details = on_off
|
||||||
|
self.details_group = details
|
||||||
|
|
||||||
|
def on_key_press_event(self, event):
|
||||||
|
self.input_queue.input(event)
|
||||||
|
return self.timeline
|
||||||
|
|
||||||
|
|
||||||
|
#These are the basic movement functions
|
||||||
|
def move_left(self):
|
||||||
|
#Make sure we're not already on the first cover
|
||||||
|
if not self.currentSelection == 0:
|
||||||
|
newItem = self.currentSelection - 1
|
||||||
|
self.move_common(newItem)
|
||||||
|
def move_right(self):
|
||||||
|
#This check makes sure that we're not on the last cover already
|
||||||
|
if not self.currentSelection == (self.num_covers-1):
|
||||||
|
newItem = self.currentSelection + 1
|
||||||
|
self.move_common(newItem)
|
||||||
|
def move_common(self, newItem):
|
||||||
|
#Final sanity check
|
||||||
|
if (newItem < 0) and (not newItem == None):
|
||||||
|
newItem = self.currentSelection
|
||||||
|
|
||||||
|
#If there is movement, make the scale happen
|
||||||
|
if not newItem == None:
|
||||||
|
self.select_item(newItem, self.currentSelection)
|
Loading…
Reference in New Issue