- Initial theming work in music player

- Fixed song ID3 picture lookup (Regression from myth 0.21 db restructure)
- Much more work on music stuff
This commit is contained in:
noisymime 2008-04-27 11:33:08 +00:00
parent 52847ef532
commit 7b9c77ffbf
5 changed files with 111 additions and 8 deletions

View File

@ -53,7 +53,7 @@ class song:
return None
tag = eyeD3.Tag()
filename = self.base_dir + "/" + self.filename
filename = self.base_dir + "/" + self.directory + "/" + self.filename
#print filename
#Make sure the file exists and we can read it

View File

@ -166,8 +166,10 @@ class Module:
pixbuf = albums[0].get_image()
if not pixbuf is None:
self.main_img.set_pixbuf(pixbuf)
self.main_img.show()
else:
self.main_img.set_pixbuf(None)
self.main_img.hide()
clutter.threads_leave()
def begin(self, glossMgr):
@ -224,11 +226,13 @@ class Module:
#Just a nasty temp label for outputting stuff
self.list1 = LabelList(5)
self.list1.set_position(self.stage.get_width()/3, 350)
self.list1.setup_from_theme_id(self.glossMgr.themeMgr, "music_albums")
#self.list1.set_position(self.stage.get_width()/3, 350)
self.stage.add(self.list1)
self.list2 = LabelList(5)
self.list2.set_position( (600), 350)
self.list2.setup_from_theme_id(self.glossMgr.themeMgr, "music_songs")
#self.list2.set_position( (600), 350)
self.stage.add(self.list2)
#The preview img

View File

@ -10,6 +10,76 @@
<y>0</y>
</position>
</texture>
<label_list id="music_albums">
<font id="main">
<face>Tahoma</face>
<size id="default">30</size>
<size id="1024x768">38</size>
<size id="800x600">30</size>
<size id="1920x1080">25</size>
</font>
<dimensions type="relativeToStage">
<width>40%</width>
<height>40%</height>
</dimensions>
<position type="relativeToStage">
<x>40%</x>
<y>50%</y>
</position>
<item_gap>0</item_gap>
<num_visible_elements>4</num_visible_elements>
<!-- 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 -->
<opacity_step0>255</opacity_step0>
<opacity_step1>135</opacity_step1>
<opacity_step2>135</opacity_step2>
<scale_step0>0.9</scale_step0>
<scale_step1>0.8</scale_step1>
<scale_step2>0.8</scale_step2>
<transition_fps>30</transition_fps>
<transition_frames>10</transition_frames>
</label_list>
<label_list id="music_songs">
<font id="main">
<face>Tahoma</face>
<size id="default">30</size>
<size id="1024x768">38</size>
<size id="800x600">30</size>
<size id="1920x1080">25</size>
</font>
<dimensions type="relativeToStage">
<width>40%</width>
<height>40%</height>
</dimensions>
<position type="relativeToStage">
<x>70%</x>
<y>50%</y>
</position>
<item_gap>0</item_gap>
<num_visible_elements>8</num_visible_elements>
<!-- 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 -->
<opacity_step0>255</opacity_step0>
<opacity_step1>135</opacity_step1>
<opacity_step2>135</opacity_step2>
<scale_step0>0.9</scale_step0>
<scale_step1>0.8</scale_step1>
<scale_step2>0.8</scale_step2>
<transition_fps>30</transition_fps>
<transition_frames>10</transition_frames>
</label_list>
<texture id="music_default_artist_image">
<image>music/default_cover.png</image>

View File

@ -87,9 +87,11 @@ class ImageFrame(clutter.Group):
#For the most part the Reflection texture automatically takes car of pixbuf changes
#So we only need to set the flection the first time arouns (ie self.reflection is None)
if self.use_reflection:
if self.reflection is None:
self.reflection = Texture_Reflection(self.main_pic)
self.add(self.reflection)
self.reflection.show()
if not self.reflection is None:
self.remove(self.reflection)
self.reflection = None
self.reflection = Texture_Reflection(self.main_pic)
self.add(self.reflection)
self.reflection.show()
else:
self.reflection = None

View File

@ -28,6 +28,33 @@ class LabelList(clutter.Group):
#Selector bar image, moves with selections to show current item
self.selector_bar = None
def setup_from_theme_id(self, themeMgr, id):
element = themeMgr.search_docs("label_list", id).childNodes
#Quick check to make sure we found something
if element is None:
return None
self.item_gap = int(themeMgr.find_child_value(element, "item_gap"))
self.displayMax = int(themeMgr.find_child_value(element, "num_visible_elements"))
#Grab the font
font_node = themeMgr.get_subnode(element, "font")
fontString = themeMgr.get_font("main", font_node)
self.font = fontString
#Set the selection effect steps
self.zoomStep0 = float(themeMgr.find_child_value(element, "scale_step0"))
self.zoomStep1 = float(themeMgr.find_child_value(element, "scale_step1"))
self.zoomStep2 = float(themeMgr.find_child_value(element, "scale_step2"))
self.opacityStep0 = int(themeMgr.find_child_value(element, "opacity_step0"))
self.opacityStep1 = int(themeMgr.find_child_value(element, "opacity_step1"))
self.opacityStep2 = int(themeMgr.find_child_value(element, "opacity_step2"))
self.fps = int(themeMgr.find_child_value(element, "transition_fps"))
self.frames = int(themeMgr.find_child_value(element, "transition_frames"))
themeMgr.setup_actor(self, element, themeMgr.stage)
def on_key_press_event (self, event):
self.input_queue.input(event)
@ -222,6 +249,7 @@ class ListItem(clutter.Group):
def __init__ (self, font, label_left = "", label_right = ""):
clutter.Group.__init__ (self) #, menu, itemLabel, y)
self.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
self.label_left = clutter.Label()
self.label_right = clutter.Label()
@ -280,7 +308,6 @@ class ListItem(clutter.Group):
alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)
self.behaviourScale = clutter.BehaviourScale(x_scale_start=self.currentZoom, y_scale_start=self.currentZoom, x_scale_end=zoomTo, y_scale_end=zoomTo, alpha=alpha) #scale_gravity=clutter.GRAVITY_WEST,
self.set_anchor_point_from_gravity(clutter.GRAVITY_WEST)
self.behaviourOpacity = clutter.BehaviourOpacity(opacity_start=self.currentOpacity, opacity_end=opacityTo, alpha=alpha)
self.behaviourScale.apply(self)
self.behaviourOpacity.apply(self)