From 32e9765ff0b539f566bd092ab163a6fb1e3031e2 Mon Sep 17 00:00:00 2001 From: noisymime Date: Mon, 28 Jan 2008 19:36:43 +0000 Subject: [PATCH] Conf changes --- GlossMgr.py | 7 ++ Menu.py | 3 +- image_preview.py | 131 +++++++++++++++++++++++++++ modules/slideshow/slideshow.py | 30 ++++-- modules/video_player/video_player.py | 1 + themeMgr.py | 2 +- transitions/menu_items/fade.py | 4 +- transitions/menus/slide.py | 2 +- ui/Pear/main.xml | 5 +- ui/Pear/video.xml | 10 +- ui/default/main.xml | 3 +- 11 files changed, 178 insertions(+), 20 deletions(-) create mode 100644 image_preview.py diff --git a/GlossMgr.py b/GlossMgr.py index b8488a4..05e71f3 100644 --- a/GlossMgr.py +++ b/GlossMgr.py @@ -136,7 +136,14 @@ class GlossMgr: if self.currentPlugin.on_key_press_event(stage, event): self.currentPlugin.stop() self.currentPlugin = None + + timeline_stop = clutter.Timeline(10,30) + alpha = clutter.Alpha(timeline_stop, clutter.ramp_inc_func) + self.stop_behaviour = clutter.BehaviourOpacity(opacity_start=0, opacity_end=255, alpha=alpha) + self.currentMenu.set_opacity(0) self.currentMenu.show() + self.stop_behaviour.apply(self.currentMenu) + timeline_stop.start() #If there's no plugin running, go back one in the menu list (Providing we're not already at the first item. else: if len(self.menuHistory)>1: diff --git a/Menu.py b/Menu.py index dbf8809..3fa99b1 100644 --- a/Menu.py +++ b/Menu.py @@ -136,7 +136,8 @@ class Menu(clutter.Group): self.menuItems[i].scaleLabel(1, self.timeline) else: self.menuItems[i].scaleLabel(2, self.timeline) - + + #print self.menuItems[self.selected].data + " " + str(self.menuItems[self.selected].itemTexturesGroup.scale_start) #Do the transition of the menu graphic #If there's no transition set (Would have been set in the theme) then the item is simply show if not self.menu_item_transition is None: diff --git a/image_preview.py b/image_preview.py new file mode 100644 index 0000000..96443e1 --- /dev/null +++ b/image_preview.py @@ -0,0 +1,131 @@ +import clutter +import pygtk +import gtk +import random + +class image_previewer(clutter.Group): + tex1 = None + tex2 = None + tex3 = None + frontTex = None + behave1 = None + behave2 = None + behave3 = None + + scale_start = 0.6 + + def __init__(self, stage): + clutter.Group.__init__(self) + self.textures = [] + self.stage = stage + self.timeline = clutter.Timeline(200, 25) + self.timeline.set_loop(True) + self.timeline.connect('completed', self.next_image) + + self.connect('show', self.start) + + self.alpha = clutter.Alpha(self.timeline, clutter.ramp_inc_func) + + self.behaviour_scale = clutter.BehaviourScale(x_scale_start=self.scale_start, y_scale_start=self.scale_start, x_scale_end=1, y_scale_end=1, alpha=self.alpha) + self.behaviour_depth = clutter.BehaviourDepth(depth_start=-300, depth_end=200, alpha=self.alpha) + + + def add_texture(self, texture_src): + self.textures.append(texture_src) + + def start(self, data): + if len(self.textures) == 0: + return None + + self.tex1 = self.get_rand_tex() + self.tex2 = self.get_rand_tex() + self.tex3 = self.get_rand_tex() + + self.behave1 = clutter.BehaviourPath(self.alpha, self.get_texture_knots(self.tex1)) + self.behave2 = clutter.BehaviourPath(self.alpha, self.get_texture_knots(self.tex2)) + self.behave3 = clutter.BehaviourPath(self.alpha, self.get_texture_knots(self.tex3)) + + #self.tex1.set_scale(self.scale_start, self.scale_start) + self.behaviour_depth.apply(self.tex1) + self.behave1.apply(self.tex1) + + + self.add(self.tex1) + parent = self.get_parent() + if parent is None: + print "Parent is none!" + parent.show() + #self.set_depth(100) + #self.tex1.set_depth(100) + #self.set_opacity(255) + self.frontTex = self.tex1 + self.tex1.show() + self.show() + #parent.add(self) + self.timeline.start() + + def get_rand_tex(self): + rand = random.randint(0, len(self.textures)-1) + + texture = clutter.Texture() + pixbuf = gtk.gdk.pixbuf_new_from_file(self.textures[rand]) + texture.set_pixbuf(pixbuf) + xy_ratio = float(texture.get_width()) / texture.get_height() + #texture.set_height(self.get_height()) + width = int(texture.get_height() * xy_ratio) + #texture.set_width(width) + return texture + + def next_image(self, data): + texture = self.get_rand_tex() + self.add(texture) + + + #Remove the old texture + self.remove(self.frontTex) + + #Setup the path behaviour specific to this tex + knots = self.get_texture_knots(texture) + + #Set the appropriate tex + if self.frontTex == self.tex1: + self.tex1 = texture + self.behave1 = clutter.BehaviourPath(self.alpha, knots) + currentBehave = self.behave1 + self.frontTex = self.tex2 + + #texture.lower(self.tex2) + #texture.lower(self.tex3) + + elif self.frontTex == self.tex2: + self.tex2 = texture + self.behave2 = clutter.BehaviourPath(self.alpha, knots) + currentBehave = self.behave2 + self.frontTex = self.tex3 + + #texture.lower(self.tex1) + #texture.lower(self.tex3) + + elif self.frontTex == self.tex3: + self.tex3 = texture + self.behave3 = clutter.BehaviourPath(self.alpha, knots) + currentBehave = self.behave3 + self.frontTex = self.tex1 + + #texture.lower(self.tex1) + #texture.lower(self.tex2) + + currentBehave.apply(texture) + + texture.show() + + def get_texture_knots(self, texture): + knots = (\ + (0, 0),\ + #(int(self.get_width()*0.2), int(self.get_height()*0.2)),\ + #(int(self.stage.get_width()*0.1), int(self.stage.get_height()*0.1)),\ + (int(-texture.get_width()), int(self.get_height()*0.3))\ + ) + + return knots + \ No newline at end of file diff --git a/modules/slideshow/slideshow.py b/modules/slideshow/slideshow.py index 4966f0c..13128c7 100644 --- a/modules/slideshow/slideshow.py +++ b/modules/slideshow/slideshow.py @@ -2,6 +2,7 @@ import clutter from clutter import cluttergst #__import__("../../Menu", "Menu") from Menu import Menu +from image_preview import image_previewer import time import os.path import pygtk @@ -112,7 +113,7 @@ class Module: self.textures = [] self.music = [] #Then load them back up - slideName = self.baseDir + "/" + self.glossMgr.get_current_menu().get_current_item().get_data() + slideName = self.baseDir + "/" + self.menu.get_current_item().get_data() #self.glossMgr.get_current_menu().get_current_item().get_data() self.loadDir(slideName, True) #self.MenuMgr.get_selector_bar().set_spinner(False) @@ -130,7 +131,9 @@ class Module: timeline_backdrop = clutter.Timeline(10,30) alpha = clutter.Alpha(timeline_backdrop, clutter.ramp_inc_func) self.backdrop_behaviour = clutter.BehaviourOpacity(opacity_start=0, opacity_end=255, alpha=alpha) + self.menu_behaviour = clutter.BehaviourOpacity(opacity_start=255, opacity_end=0, alpha=alpha) self.backdrop_behaviour.apply(self.backdrop) + self.menu_behaviour.apply(self.menu.getItemGroup()) timeline_backdrop.start() @@ -202,7 +205,7 @@ class Module: (x_pos, y_pos)\ ) self.behaviour2 = clutter.BehaviourPath(self.alpha, knots) - + #Start and run the Ken Burns effect self.behaviour1.apply(self.currentTexture) @@ -329,9 +332,11 @@ class Module: timeline_stop = clutter.Timeline(10,30) alpha = clutter.Alpha(timeline_stop, clutter.ramp_inc_func) self.stop_behaviour = clutter.BehaviourOpacity(opacity_start=255, opacity_end=0, alpha=alpha) + self.menu_behaviour = clutter.BehaviourOpacity(opacity_start=0, opacity_end=255, alpha=alpha) self.stop_behaviour.apply(self.currentTexture) self.stop_behaviour.apply(self.backdrop) self.stop_behaviour.apply(self.overlay) + self.menu_behaviour.apply(self.menu.getItemGroup()) timeline_stop.connect('completed', self.destroySlideshow) timeline_stop.start() @@ -357,6 +362,7 @@ class Module: def generateMenu(self): tempMenu = Menu(self.glossMgr) + self.menu = tempMenu #print self.baseDir #This occurs when there are not slideshows or we could not connect to the db to establish baseDir if self.baseDir is None: @@ -373,12 +379,22 @@ class Module: for directoryEntry in file_list: subdir = self.baseDir + "/" + directoryEntry if os.path.isdir(subdir): - if not (len(os.listdir(subdir)) == 0): - imgPath = subdir + "/" + os.listdir(subdir)[0] - #print imgPath - tempItem = tempMenu.addItem(directoryEntry) - tempItem.setAction(self) + tempItem = tempMenu.addItem(directoryEntry) + + #Start experimental schtuff + img_list = os.listdir(subdir) + img_list = filter(self.filterImageFile, img_list) + img_previewer = image_previewer(self.glossMgr.stage) + for img in img_list: + imgPath = subdir + "/" + img #os.listdir(subdir)[0] + img_previewer.add_texture(imgPath) + #print imgPath + #new_file_list = os.listdir(dirPath) + #tempItem.itemTexturesGroup = img_previewer + img_previewer.set_position(tempItem.menu.menu_image_x, tempItem.menu.menu_image_y) + + tempItem.setAction(self) return tempMenu diff --git a/modules/video_player/video_player.py b/modules/video_player/video_player.py index 8c6334d..774cd6f 100644 --- a/modules/video_player/video_player.py +++ b/modules/video_player/video_player.py @@ -62,6 +62,7 @@ class Module(): #Set the current viewer self.currentViewer = self.base_folder_menu.get_current_viewer() + #self.currentViewer.set_depth(self.currentViewer.cover_size) #Create the details group self.video_details = video_details(self.coverDetailsWidth) diff --git a/themeMgr.py b/themeMgr.py index 980df65..4a144e4 100644 --- a/themeMgr.py +++ b/themeMgr.py @@ -7,7 +7,7 @@ from xml.dom import minidom class ThemeMgr: defaultTheme = "default" currentTheme = "default" - #currentTheme = "Pear" + currentTheme = "Pear" def __init__(self, glossMgr): self.stage = glossMgr.stage diff --git a/transitions/menu_items/fade.py b/transitions/menu_items/fade.py index 13ad1ae..bb27773 100644 --- a/transitions/menu_items/fade.py +++ b/transitions/menu_items/fade.py @@ -31,8 +31,8 @@ class Transition: self.old_behaviour_opacity.apply(oldGroup) def on_transition_complete(self, data, oldGroup): - oldGroup.get_parent().remove(oldGroup) - pass + if not oldGroup.get_parent is None: + oldGroup.get_parent().remove(oldGroup) def set_options(self, options): pass \ No newline at end of file diff --git a/transitions/menus/slide.py b/transitions/menus/slide.py index 69d19ef..d778e28 100644 --- a/transitions/menus/slide.py +++ b/transitions/menus/slide.py @@ -42,7 +42,7 @@ class Transition: self.entrance_behaviour_opacity = clutter.BehaviourOpacity(opacity_start=0, opacity_end=255, alpha=self.alpha) #Setup some knots - start_y = int(self.stage.get_height()/2 - newGroup.get_height()/2) + start_y = oldGroup.get_y()#int(self.stage.get_height()/2 - newGroup.get_height()/2) start_x = int(self.stage.get_width()) newGroup.set_position(start_x, start_y) #end_x = int(self.stage.get_width() - newGroup.get_width())/2 diff --git a/ui/Pear/main.xml b/ui/Pear/main.xml index 592c2c1..42a4d98 100644 --- a/ui/Pear/main.xml +++ b/ui/Pear/main.xml @@ -3,9 +3,10 @@ Tahoma - 38 + 30 38 30 + 25 @@ -18,7 +19,7 @@ 0 - 3 + 4 diff --git a/ui/Pear/video.xml b/ui/Pear/video.xml index 4e63045..b3500fe 100644 --- a/ui/Pear/video.xml +++ b/ui/Pear/video.xml @@ -2,12 +2,12 @@ video_player/cover_bg_long.png - 80% - 80% + 70% + 90% - 15% - 15% + 25% + 4% @@ -43,7 +43,7 @@ 30% - 70% + 65% diff --git a/ui/default/main.xml b/ui/default/main.xml index 36cf4dd..6371060 100644 --- a/ui/default/main.xml +++ b/ui/default/main.xml @@ -3,9 +3,10 @@ Tahoma - 40 + 30 40 30 + 25