- Further theme work (This time on the modeuls)

- Setup transition mechanism for menu_item_textures
This commit is contained in:
noisymime 2008-01-08 10:44:51 +00:00
parent 98f88f34d8
commit 9535006ac1
18 changed files with 155 additions and 11 deletions

View File

@ -15,12 +15,13 @@ class GlossMgr:
self.currentMenu = None
self.uiMsg = message(stage)
self.themeMgr = ThemeMgr(self)
#Setup the menu transition
self.transition = "slide"
transition_path = "transitions/menus/" + self.transition
self.transition = __import__(transition_path).Transition(self)
self.themeMgr = ThemeMgr(self.stage)
background = self.themeMgr.get_texture("background", None, None)
#background.set_depth(-500)
#background.set_scale(1, 1)
@ -33,7 +34,7 @@ class GlossMgr:
self.selector_bar = MenuSelector(self)
self.stage.add(self.selector_bar)#Load the theme manager
self.themeMgr = ThemeMgr(self.stage)
#self.themeMgr = ThemeMgr(self.stage)
self.selector_bar.show_all()
self.currentPlugin = None
@ -78,6 +79,7 @@ class GlossMgr:
if event.keyval == clutter.keysyms.Down: #Down button pressed
self.currentMenu.selectNext()
if event.keyval == clutter.keysyms.q:
self.stage.hide_cursor()
clutter.main_quit()
if event.keyval == clutter.keysyms.Return:
# Need to decide what action to take
@ -94,6 +96,10 @@ class GlossMgr:
if action is None:
self.display_msg("Error", "Could not start " + self.currentMenu.get_current_item().get_text())
else:
#hide any unnecesary actors
self.currentMenu.hide()
#And begin the plugin
action.begin( self )
# This is tres bodge
if event.keyval == clutter.keysyms.Escape:
@ -103,6 +109,7 @@ class GlossMgr:
if self.currentPlugin.on_key_press_event(stage, event):
self.currentPlugin.stop()
self.currentPlugin = None
self.currentMenu.show()
#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:

24
Menu.py
View File

@ -7,6 +7,7 @@ from ReflectionTexture import Texture_Reflection
class Menu(clutter.Group):
font = ""
menu_item_transition = None
zoomLevel = 0.5
opacityStep = 120
@ -134,6 +135,13 @@ class Menu(clutter.Group):
self.menuItems[i].scaleLabel(1, self.timeline)
else:
self.menuItems[i].scaleLabel(2, self.timeline)
#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:
self.menu_item_transition.forward(self.timeline, self.menuItems[self.selected-1].itemTexturesGroup, self.menuItems[self.selected].itemTexturesGroup)
else:
self.menuItems[self.selected].itemTexturesGroup.show()
#Check we're at the bottom of the viewable list
if self.selected >= (self.displayMax):
@ -182,6 +190,13 @@ class Menu(clutter.Group):
self.menuItems[i].scaleLabel(1, self.timeline)
else:
self.menuItems[i].scaleLabel(2, self.timeline)
#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:
self.menu_item_transition.backward(self.timeline, self.menuItems[self.selected+1].itemTexturesGroup, self.menuItems[self.selected].itemTexturesGroup)
else:
self.menuItems[self.selected].itemTexturesGroup.show()
#Check we're at the top of the viewable list
if self.selected < (self.displayMin):
@ -221,6 +236,9 @@ class Menu(clutter.Group):
else:
self.menuItems[i].scaleLabel(2, self.timeline)
#Show the current menu item's graphic
self.menuItems[self.selected].itemTexturesGroup.show()
if moveBar:
self.glossMgr.get_selector_bar().selectItem(self.menuItems[self.selected], self.timeline)
@ -320,9 +338,11 @@ class ListItem (clutter.Label):
#Determine the zooming level
zoomTo=0
opacityTo = 255
if level==0:
zoomTo = self.menu.zoomStep0 #self.zoomLevel * 1.5
opacityTo = self.menu.opacityStep0
self.itemTexturesGroup.hide()
self.menu.add(self.itemTexturesGroup)
self.onStage = True
#self.itemTexturesGroup.show_all()
@ -330,14 +350,14 @@ class ListItem (clutter.Label):
zoomTo = self.menu.zoomStep1
opacityTo = self.menu.opacityStep1
if self.onStage:
self.menu.remove(self.itemTexturesGroup)
#self.menu.remove(self.itemTexturesGroup)
self.onStage = False
#self.itemTexturesGroup.hide_all()
if level==2:
zoomTo = self.menu.zoomStep2
opacityTo = self.menu.opacityStep2
if self.onStage:
self.menu.remove(self.itemTexturesGroup)
#self.menu.remove(self.itemTexturesGroup)
self.onStage = False
#self.itemTexturesGroup.hide_all()

View File

@ -70,10 +70,10 @@ class MainApp:
#Update splash status msg
for mods in modules:
print "Loading mod..."
#print "Loading mod..."
tempMod = mods.Module(self.glossMgr, self.dbMgr)
title = tempMod.title
print title
#print title
self.splashScreen.set_msg("Loading "+title)
temp_menu_item = MainMenu.addItem(title)
temp_menu_item.add_image_from_texture(tempMod.menu_image)

View File

@ -40,6 +40,7 @@ class coverViewer(clutter.Group):
self.bgImg.set_pixbuf(pixbuf)
bgImg_height = height - ((height - (self.cover_size * rows)) / 2) + self.detailBox_height
self.bgImg.set_size(width, bgImg_height)
#self.bgImg.set_depth(1)
self.bgImg.show()
self.add(self.bgImg)
@ -54,6 +55,7 @@ class coverViewer(clutter.Group):
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.stage.add(self.current_video_description)
@ -140,7 +142,7 @@ class coverViewer(clutter.Group):
self.behaviourNew_opacity = clutter.BehaviourOpacity(opacity_start=self.inactiveOpacity, opacity_end=255, alpha=alpha)
self.behaviourOld_scale = clutter.BehaviourScale(scale_start=self.scaleFactor, scale_end=1, alpha=alpha)
self.behaviourOld_scale.set_property("scale=gravity", clutter.GRAVITY_CENTER)
#self.behaviourOld_scale.set_property("scale=gravity", clutter.GRAVITY_CENTER)
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)
@ -151,6 +153,20 @@ class coverViewer(clutter.Group):
self.behaviourOld_z.apply(outgoingTexture)
self.behaviourOld_opacity.apply(outgoingTexture)
#Set gravities
"""
(x, y) = incomingTexture.get_position()
anchor_x = x + incomingTexture.get_width()/2
anchor_y = y + incomingTexture.get_height()/2
incomingTexture.set_anchor_point(anchor_x, anchor_y)
(x, y) = outgoingTexture.get_position()
anchor_x = x + outgoingTexture.get_width()/2
anchor_y = 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()

View File

@ -102,8 +102,9 @@ class folderMenu(clutter.Group):
self.behaviour_opacity_outgoing.apply(current_viewer)
for cover in current_viewer.get_item_library():
#cover.set_depth(cover.get_height())
#cover.set_depth(cover.get_height()/2)
self.behaviour_rotate_outgoing.apply(cover)
#pass
#Apply the incoming behaviour

View File

@ -190,6 +190,8 @@ class Module():
#Create a backdrop for the player. In this case we just use the same background as the menus
self.backdrop = glossMgr.get_themeMgr().get_texture("background", None, None) #clutter.CloneTexture(glossMgr.get_skinMgr().get_Background())
#self.backdrop = clutter.Rectangle()
#self.backdrop.set_color(clutter.color_parse('Black'))
self.backdrop.set_size(self.stage.get_width(), self.stage.get_height())
self.backdrop.set_opacity(0)
self.backdrop.show()

View File

@ -8,8 +8,9 @@ class ThemeMgr:
defaultTheme = "default"
currentTheme = "default"
def __init__(self, stage):
self.stage = stage
def __init__(self, glossMgr):
self.stage = glossMgr.stage
self.glossMgr = glossMgr
self.docs = []
self.default_docs = []
@ -296,5 +297,14 @@ class ThemeMgr:
menu.opacityStep1 = int(self.find_child_value(element, "opacity_step1"))
menu.opacityStep2 = int(self.find_child_value(element, "opacity_step2"))
#Finally set general actor properties (position etc)
#Setup the menu transition
image_transition = "fade"
transition_path = "transitions/menu_items/" + image_transition
try:
menu.menu_item_transition = __import__(transition_path).Transition(self.glossMgr)
except ImportError:
print "Theme Error: No menu_item transition titled '" + str(image_transition) + "'"
menu.menu_item_transition = None
#Finally set general actor properties (position etc)
self.setup_actor(menu.getItemGroup(), element, self.stage)

View File

@ -0,0 +1,35 @@
import clutter
class Transition:
def __init__(self, GlossMgr):
self.stage = GlossMgr.stage
self.glossMgr = GlossMgr
def forward(self, timeline, oldGroup, newGroup):
self.do_transition(timeline, oldGroup, newGroup)
newGroup.show()
def backward(self, timeline, oldGroup, newGroup):
self.do_transition(timeline, oldGroup, newGroup)
newGroup.show()
def do_transition(self, timeline, oldGroup, newGroup):
timeline.connect('completed', self.on_transition_complete, oldGroup)
newGroup.set_opacity(0)
(x, y) = oldGroup.get_position()
newGroup.set_position(x, y)
#self.exit_behaviour_scale = clutter.BehaviourScale(self.alpha, 1, 0.5, clutter.GRAVITY_CENTER)
self.alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
self.new_behaviour_opacity = clutter.BehaviourOpacity(opacity_start=0, opacity_end=oldGroup.get_opacity(), alpha=self.alpha)
self.old_behaviour_opacity = clutter.BehaviourOpacity(opacity_start=oldGroup.get_opacity(), opacity_end=0, alpha=self.alpha)
#self.exit_behaviour_scale.apply(oldGroup)
self.new_behaviour_opacity.apply(newGroup)
self.old_behaviour_opacity.apply(oldGroup)
def on_transition_complete(self, data, oldGroup):
oldGroup.get_parent().remove(oldGroup)
pass

13
ui/default/dvd.xml Normal file
View File

@ -0,0 +1,13 @@
<gloss-theme>
<texture id="dvd_menu_image">
<image>dvd/dvd.png</image>
<dimensions type="relativeToStage">
<width>30%</width>
<height>30%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
</position>
</texture>
</gloss-theme>

BIN
ui/default/dvd/dvd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View File

@ -20,6 +20,7 @@
<item_gap>0</item_gap>
<num_visible_elements>6</num_visible_elements>
<use_image_reflections>True</use_image_reflections>
<image_transition>fade</image_transition>
<!-- These are the opacity and scale values for the 3 possible steps in the menu
Make all the values the same if you do not want these effects -->

13
ui/default/music.xml Normal file
View File

@ -0,0 +1,13 @@
<gloss-theme>
<texture id="music_menu_image">
<image>music/music.png</image>
<dimensions type="relativeToStage">
<width>30%</width>
<height>30%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
</position>
</texture>
</gloss-theme>

BIN
ui/default/music/music.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

13
ui/default/slideshow.xml Normal file
View File

@ -0,0 +1,13 @@
<gloss-theme>
<texture id="slideshow_menu_image">
<image>slideshow/gallery.png</image>
<dimensions type="relativeToStage">
<width>30%</width>
<height>30%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
</position>
</texture>
</gloss-theme>

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

13
ui/default/tv.xml Normal file
View File

@ -0,0 +1,13 @@
<gloss-theme>
<texture id="mythtv_menu_image">
<image>tv/gallery.png</image>
<dimensions type="relativeToStage">
<width>30%</width>
<height>30%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
</position>
</texture>
</gloss-theme>

BIN
ui/default/tv/gallery.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB