- Addition of the 'Pear' theme

- Addition of the initial 'ring' menu_item switcher
This commit is contained in:
noisymime 2008-01-10 02:51:37 +00:00
parent 8a0e64b03f
commit de1124e9e4
14 changed files with 151 additions and 28 deletions

View File

@ -23,7 +23,7 @@ class GlossMgr:
self.transition = __import__(transition_path).Transition(self)
background = self.themeMgr.get_texture("background", None, None)
#background.set_depth(-500)
background.set_depth(-self.stage.get_width())
#background.set_scale(1, 1)
background.set_width(stage.get_width())
background.set_height(stage.get_height())

20
Menu.py
View File

@ -394,26 +394,24 @@ class ListItem (clutter.Label):
if texture is None:
print "NO TEXTURE!"
"""
Removing as this is currently already handled in individual module files
#Set the image to the size in the theme
if not self.menu.menu_image_height is None:
texture.set_size(self.menu.menu_image_width, self.menu.menu_image_height)
texture.set_height(self.menu.menu_image_height)
if not self.menu.menu_image_width is None:
texture.set_width(self.menu.menu_image_width)
"""
#Rotate appropriately
rotation = self.menu.menu_image_rotation
x_rotation = (texture.get_width())
texture.set_rotation(clutter.Y_AXIS, rotation, x_rotation, 0, 0)
self.itemTexturesGroup.add(texture)
#texture.hide() #For some reason this line is occasionally removing the pixbuf from the texture.
#Set position
(abs_x, abs_y) = self.get_position()
#x = abs_x# - self.tempTexture.get_width()
#y = (self.menu.getStage().get_height()/2) - (self.tempTexture.get_height()/2)
#self.tempTexture.set_position(x, y)
self.itemTexturesGroup.add(texture)
#If reflection is turned on in the theme, add a reflection texture
if self.menu.useReflection:
print "reflection!!"
self.reflectionTexture = Texture_Reflection(texture)
self.itemTexturesGroup.add(self.reflectionTexture)

View File

@ -33,6 +33,7 @@ class cover_item(clutter.Group):
self.main_pic = clutter.Texture()
self.main_pic.set_pixbuf(pixbuf)
self.main_pic.show()
(x, y) = (0, 0)
if self.main_pic.get_height() > self.main_pic.get_width():
@ -41,15 +42,23 @@ class cover_item(clutter.Group):
width = int(cover_size * xy_ratio)
self.main_pic.set_width(width)
x = x + (cover_size - width)/2
#x = x + (cover_size - width)
else:
xy_ratio = float(self.main_pic.get_height()) / float(self.main_pic.get_width())
self.main_pic.set_width(cover_size)
height = int(cover_size * xy_ratio)
self.main_pic.set_height(height)
y = y + (cover_size - height)/2
#y = y + (cover_size - height)
anchor_x = self.main_pic.get_width()/2
anchor_y = self.main_pic.get_height()/2
#self.main_pic.set_anchor_point(anchor_x, anchor_y)
self.main_pic.set_position(x, y)
self.add(self.main_pic)
#If this is a folder, we also add a title

View File

@ -100,6 +100,9 @@ class coverViewer(clutter.Group):
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
@ -142,10 +145,17 @@ 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)
(x, y) = incomingTexture.get_position()
(x, y) = self.covers_group.get_position()
anchor_x = 1000#+incomingTexture.get_width()/2
anchor_y = 1000#+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)
@ -154,18 +164,15 @@ class coverViewer(clutter.Group):
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)
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

View File

@ -7,6 +7,7 @@ from xml.dom import minidom
class ThemeMgr:
defaultTheme = "default"
currentTheme = "default"
#currentTheme = "Pear"
def __init__(self, glossMgr):
self.stage = glossMgr.stage
@ -153,12 +154,18 @@ class ThemeMgr:
relativeTo = str(self.find_attribute_value(element, "dimensions", "type"))
if relativeTo == "relativeToStage":
parent = self.stage
elif not (relativeTo == "relativeToParent"):
parent = None
elif relativeTo == "relativeToParent":
parent = actor.get_parent()
elif relativeTo == "relativeToSelf":
parent = actor
(width, height) = self.get_dimensions(element, parent)
if (not width is None) and (not width == "default"): actor.set_width(width)
if (not height is None) and (not height == "default"): actor.set_height(height)
if (not height is None) and (not height == "default"):
if height == "relative":
xy_ratio = float(actor.get_height()) / float(actor.get_width())
height = int(width * xy_ratio)
actor.set_height(height)
#Set the position of the actor
(x,y) = (0,0)
@ -191,12 +198,18 @@ class ThemeMgr:
width = (float(width[:-1]) / 100.0) * parent.get_width()
#print "width: " + str(width)
width = int(width)
else:
width = None
height = self.find_child_value(element, "dimensions.height")
if (not height == "default") and (not height is None):
if (not height == "default") and (not height is None) and (not height == "relative"):
if height[-1] == "%":
height = (float(height[:-1]) / 100.0) * parent.get_height()
height = int(height)
elif height == "relative":
pass
else:
height = None
return (width, height)
#Given an element, returns (x, y) coords for it
@ -314,7 +327,7 @@ class ThemeMgr:
menu.opacityStep2 = int(self.find_child_value(element, "opacity_step2"))
#setup the menu_image properties
menu.useReflection = bool(self.find_child_value(element, "menu_item_texture.use_image_reflections"))
menu.useReflection = True == (self.find_child_value(element, "menu_item_texture.use_image_reflections"))
menu.menu_image_rotation = int(self.find_child_value(element, "menu_item_texture.image_y_rotation"))
menu_image_node = self.get_subnode(element, "menu_item_texture")
if not menu_image_node is None:
@ -323,14 +336,17 @@ class ThemeMgr:
menu.menu_image_x = int(x)
menu.menu_image_y = int(y)
"""
#Set the size
(width, height) = self.get_dimensions(menu_image_node, self.stage)
if width is None:
print "no size change"
menu.menu_image_width = None
menu.menu_image_height = None
else:
menu.menu_image_width = int(width)
menu.menu_image_height = int(height)
"""
#Setup the menu image transition
image_transition = self.find_child_value(element, "menu_item_texture.image_transition.name")

View File

@ -0,0 +1,93 @@
import clutter
class Transition:
def __init__(self, GlossMgr):
self.stage = GlossMgr.stage
self.glossMgr = GlossMgr
def forward(self, timeline, oldGroup, newGroup):
timeline.connect('completed', self.on_transition_complete, oldGroup)
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
newGroup.set_position( int(-newGroup.get_width()), int(oldGroup.get_y() * 0.8))
newGroup.show()
knots_incoming = (\
( int(-newGroup.get_width()), int(oldGroup.get_y() * 0.8) ),\
( int(oldGroup.get_x()/2) , int(oldGroup.get_y() * 0.9) ),\
( oldGroup.get_x(), oldGroup.get_y() )\
)
#self.behaviour_incoming_bspline = clutter.BehaviourBspline(knots=knots_incoming, alpha=alpha)
self.behaviour_incoming_bspline = clutter.BehaviourPath(knots=knots_incoming, alpha=alpha)
self.behaviour_incoming_bspline.apply(newGroup)
self.behaviour_incoming_depth = clutter.BehaviourDepth(depth_start=-1000, depth_end=oldGroup.get_depth(), alpha=alpha)
self.behaviour_incoming_depth.apply(newGroup)
self.behaviour_incoming_opacity = clutter.BehaviourOpacity(opacity_start=0, opacity_end=oldGroup.get_opacity(), alpha=alpha)
self.behaviour_incoming_opacity.apply(newGroup)
#*************************************************************************8
#Do the outgoing group
knots_outgoing = (\
( int(-newGroup.get_width()), int(oldGroup.get_y() * 0.8) ),\
( int(oldGroup.get_x()/2) , int(oldGroup.get_y() * 0.9) ),\
( oldGroup.get_x(), oldGroup.get_y() )\
)
self.behaviour_outgoing_depth = clutter.BehaviourDepth(depth_start=oldGroup.get_depth(), depth_end=1000, alpha=alpha)
self.behaviour_outgoing_depth.apply(oldGroup)
self.behaviour_outgoing_opacity = clutter.BehaviourOpacity(opacity_start=oldGroup.get_opacity(), opacity_end=0, alpha=alpha)
self.behaviour_outgoing_opacity.apply(oldGroup)
def backward(self, timeline, oldGroup, newGroup):
timeline.connect('completed', self.on_transition_complete, oldGroup)
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
newGroup.set_position( int(-newGroup.get_width()), int(oldGroup.get_y() * 0.8))
newGroup.show()
knots_incoming = (\
( int(-newGroup.get_width()), int(oldGroup.get_y() * 0.8) ),\
( int(oldGroup.get_x()/2) , int(oldGroup.get_y() * 0.9) ),\
( oldGroup.get_x(), oldGroup.get_y() )\
)
#self.behaviour_incoming_bspline = clutter.BehaviourBspline(knots=knots_incoming, alpha=alpha)
self.behaviour_incoming_bspline = clutter.BehaviourPath(knots=knots_incoming, alpha=alpha)
self.behaviour_incoming_bspline.apply(newGroup)
self.behaviour_incoming_depth = clutter.BehaviourDepth(depth_start=1000, depth_end=oldGroup.get_depth(), alpha=alpha)
self.behaviour_incoming_depth.apply(newGroup)
self.behaviour_incoming_opacity = clutter.BehaviourOpacity(opacity_start=0, opacity_end=oldGroup.get_opacity(), alpha=alpha)
self.behaviour_incoming_opacity.apply(newGroup)
#*****************************************************************
#Begin outgoing stuff
knots_outgoing = (\
( oldGroup.get_x(), oldGroup.get_y() ),\
( int(oldGroup.get_x()/2) , int(oldGroup.get_y() * 0.9) ),\
(( int(-oldGroup.get_width()), int(oldGroup.get_y() * 0.8) ))\
)
self.behaviour_outgoing_bspline = clutter.BehaviourPath(knots=knots_outgoing, alpha=alpha)
self.behaviour_outgoing_bspline.apply(oldGroup)
self.behaviour_outgoing_depth = clutter.BehaviourDepth(depth_start=oldGroup.get_depth(), depth_end=-1000, alpha=alpha)
self.behaviour_outgoing_depth.apply(oldGroup)
self.behaviour_outgoing_opacity = clutter.BehaviourOpacity(opacity_start=oldGroup.get_opacity(), opacity_end=0, alpha=alpha)
self.behaviour_outgoing_opacity.apply(oldGroup)
def on_transition_complete(self, data, oldGroup):
oldGroup.get_parent().remove(oldGroup)
pass
def set_options(self, options):
pass

BIN
ui/default/tv/tv.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB