- New themeing within Music player
This commit is contained in:
parent
8e7c5c9d95
commit
3737724905
|
@ -8,7 +8,6 @@ from modules.music_player.lastFM_interface import lastFM_interface
|
|||
from modules.music_player.music_object_row import MusicObjectRow
|
||||
from modules.music_player.playlist import Playlist
|
||||
from modules.music_player.play_screen import PlayScreen
|
||||
from ui_elements.image_frame import ImageFrame
|
||||
from ui_elements.image_clone import ImageClone
|
||||
from ui_elements.label_list import LabelList
|
||||
|
||||
|
@ -55,6 +54,7 @@ class Module:
|
|||
self.menu_image = self.glossMgr.themeMgr.get_texture("music_menu_image", None, None)
|
||||
|
||||
self.default_artist_cover = self.glossMgr.themeMgr.get_texture("music_default_artist_image", None, None).get_pixbuf()
|
||||
self.main_img = self.glossMgr.themeMgr.get_imageFrame("music_main_image")
|
||||
|
||||
|
||||
#Get the images dir setting our of the DB
|
||||
|
@ -269,8 +269,8 @@ class Module:
|
|||
self.stage.add(self.list2)
|
||||
|
||||
#The preview img
|
||||
self.main_img = ImageFrame(None, 300, True) #clutter.Texture()
|
||||
self.main_img.set_position(50, 300)
|
||||
#self.main_img = ImageFrame(None, 300, True) #clutter.Texture()
|
||||
#self.main_img.set_position(50, 300)
|
||||
self.main_img.set_rotation(clutter.Y_AXIS, 45, self.main_img.get_width(), 0, 0)
|
||||
self.main_img.show()
|
||||
self.stage.add(self.main_img)
|
||||
|
|
|
@ -23,6 +23,8 @@ class PlayScreen(clutter.Group):
|
|||
|
||||
def setup(self):
|
||||
self.song_list.setup_from_theme_id(self.glossMgr.themeMgr, "music_play_screen_songs")
|
||||
self.main_img_theme = self.glossMgr.themeMgr.get_imageFrame("music_playing_image")
|
||||
self.img_size = self.main_img_theme.img_size
|
||||
|
||||
def append_playlist(self, playlist):
|
||||
self.playlist.add_songs(playlist.songs)
|
||||
|
@ -45,8 +47,8 @@ class PlayScreen(clutter.Group):
|
|||
self.main_img.show()
|
||||
self.add(self.main_img)
|
||||
|
||||
x = int( (self.stage.get_width() - self.main_img.get_width()) / 2 )
|
||||
y = int( (self.stage.get_height() - self.main_img.get_height()) / 2 )
|
||||
x = int( self.main_img_theme.get_x() )
|
||||
y = int( self.main_img_theme.get_y() )
|
||||
knots = (\
|
||||
(int(self.main_img.get_x()), int(self.main_img.get_y()) ),\
|
||||
(x, y)\
|
||||
|
@ -59,7 +61,6 @@ class PlayScreen(clutter.Group):
|
|||
(x_scale_start, y_scale_start) = self.main_img.get_scale()
|
||||
x_scale_end = float(self.img_size) / float(self.main_img.get_width())
|
||||
y_scale_end = float(self.img_size) / float(self.main_img.get_height())
|
||||
print "x_scale_end: %s" % x_scale_end
|
||||
self.scale_behaviour = clutter.BehaviourScale(x_scale_start = x_scale_start, x_scale_end = x_scale_end, y_scale_start = y_scale_start, y_scale_end = y_scale_end, alpha = self.alpha)
|
||||
self.scale_behaviour.apply(self.main_img)
|
||||
|
||||
|
|
66
themeMgr.py
66
themeMgr.py
|
@ -2,6 +2,7 @@ import os
|
|||
import clutter
|
||||
import pygtk
|
||||
import gtk
|
||||
from ui_elements.image_frame import ImageFrame
|
||||
from xml.dom import minidom
|
||||
|
||||
class ThemeMgr:
|
||||
|
@ -315,4 +316,67 @@ class ThemeMgr:
|
|||
size = defSize
|
||||
|
||||
fontString = str(face) + " " + str(size)
|
||||
return fontString
|
||||
return fontString
|
||||
|
||||
def get_imageFrame(self, id, element = None):
|
||||
if element is None:
|
||||
element = self.search_docs("image_frame", id).childNodes
|
||||
#Quick check to make sure we found something
|
||||
if element is None:
|
||||
return None
|
||||
|
||||
(width, height) = self.get_dimensions(element, self.stage)
|
||||
if (not width is None) and (not height is None):
|
||||
if width > height:
|
||||
size = width
|
||||
else:
|
||||
size = height
|
||||
else:
|
||||
size = 300
|
||||
|
||||
use_reflections = self.find_child_value(element, "use_reflections")
|
||||
if not use_reflections is None:
|
||||
use_reflections = (use_reflections.upper() == "TRUE")
|
||||
else:
|
||||
#Gotta have some default value. In reality if this is running, someone else has stuffed up by not providing the size in the theme
|
||||
use_reflections = True
|
||||
|
||||
quality = self.find_child_value(element, "quality")
|
||||
if not quality is None:
|
||||
if (quality.upper() == "FAST"):
|
||||
quality = ImageFrame.QUALITY_FAST
|
||||
elif (quality.upper() == "NORMAL"):
|
||||
quality = ImageFrame.QUALITY_NORMAL
|
||||
elif (quality.upper() == "SLOW"):
|
||||
quality = ImageFrame.QUALITY_SLOW
|
||||
else:
|
||||
#Default value
|
||||
quality = ImageFrame.QUALITY_NORMAL
|
||||
else:
|
||||
#Gotta have some default value. In reality if this is running, someone else has stuffed up by not providing the size in the theme
|
||||
quality = ImageFrame.QUALITY_NORMAL
|
||||
|
||||
#Setup the pixbuf
|
||||
src = self.find_child_value(element, "image")
|
||||
if src == "None":
|
||||
pixbuf = None
|
||||
elif src is None:
|
||||
pixbuf = None
|
||||
else:
|
||||
src = self.theme_dir + self.currentTheme + "/" + src
|
||||
pixbuf = gtk.gdk.pixbuf_new_from_file(src)
|
||||
|
||||
img_frame = ImageFrame(pixbuf, size, use_reflections, quality)
|
||||
|
||||
#Set the position of the Frame
|
||||
(x,y) = (0,0)
|
||||
#Get the parent
|
||||
relativeTo = str(self.find_attribute_value(element, "position", "type"))
|
||||
if relativeTo == "relativeToStage":
|
||||
parent = self.stage
|
||||
elif not (relativeTo == "relativeToParent"):
|
||||
parent = None
|
||||
(x, y) = self.get_position(element, parent)
|
||||
img_frame.set_position(int(x), int(y))
|
||||
|
||||
return img_frame
|
|
@ -85,4 +85,19 @@
|
|||
<texture id="music_default_artist_image">
|
||||
<image>music/default_cover.png</image>
|
||||
</texture>
|
||||
|
||||
<image_frame id="music_main_image">
|
||||
<image>None</image>
|
||||
<use_reflections>True</use_reflections>
|
||||
|
||||
|
||||
<dimensions type="relativeToStage">
|
||||
<width>25%</width>
|
||||
<height>25%</height>
|
||||
</dimensions>
|
||||
<position type="relativeToStage">
|
||||
<x>10%</x>
|
||||
<y>40%</y>
|
||||
</position>
|
||||
</image_frame>
|
||||
</gloss-theme>
|
||||
|
|
|
@ -48,4 +48,19 @@
|
|||
|
||||
</label_list>
|
||||
|
||||
<image_frame id="music_playing_image">
|
||||
<image>None</image>
|
||||
<use_reflections>True</use_reflections>
|
||||
|
||||
|
||||
<dimensions type="relativeToStage">
|
||||
<width>30%</width>
|
||||
<height>30%</height>
|
||||
</dimensions>
|
||||
<position type="relativeToStage">
|
||||
<x>10%</x>
|
||||
<y>40%</y>
|
||||
</position>
|
||||
</image_frame>
|
||||
|
||||
</gloss-theme>
|
||||
|
|
Loading…
Reference in New Issue