- Colour included in themeMgr now working

- Further updates to music play screen
- Group added to themeMgr
This commit is contained in:
noisymime 2008-05-28 22:37:55 +00:00
parent dda1f46409
commit 137a0ed866
3 changed files with 107 additions and 20 deletions

View File

@ -136,11 +136,15 @@ class SongDetails(clutter.Group):
self.themeMgr = playScreen.glossMgr.themeMgr
self.backend = playScreen.musicPlayer.backend
self.stage = self.themeMgr.stage
self.setup()
self.show_all()
def setup(self):
#Setup size / position properties of group
tmpGroup = self.themeMgr.get_group("music_play_screen_song_details", group = self)
#Create all the various labels
self.artist_heading = self.themeMgr.get_label("music_play_screen_artist_heading", parent = self)
self.album_heading = self.themeMgr.get_label("music_play_screen_album_heading", parent = self)
@ -149,7 +153,11 @@ class SongDetails(clutter.Group):
self.artist = self.themeMgr.get_label("music_play_screen_artist", parent = self)
self.album = self.themeMgr.get_label("music_play_screen_album", parent = self)
self.song = self.themeMgr.get_label("music_play_screen_song", parent = self)
self.song.set_color(clutter.Color(0xff, 0xff, 0xff, 0xdd))
#self.song.set_color(clutter.Color(0xff, 0xff, 0xff, 0xdd))
self.artist_heading.set_text("artist: ")
self.song_heading.set_text("song: ")
self.album_heading.set_text("album: ")
self.add(self.artist_heading)
self.add(self.album_heading)

View File

@ -230,15 +230,18 @@ class ThemeMgr:
if parent is None:
print "Theme error (get_position x): type must be specified when using percentage values"
return None
x = (float(x[:-1]) / 100.0) * parent.get_width()
#this is a hack to get around the cases where the parent is a group (And hence has no valid wdith value)
if parent.get_width() == 0: x = (float(x[:-1]) / 100.0) * parent.width
else: x = (float(x[:-1]) / 100.0) * parent.get_width()
#print "width: " + str(width)
elif x == "center":
#Quick check on parent
if parent is None:
print "Theme error: type must be specified when using 'center' values"
return None
x = (parent.get_width() - actor.get_width)/2
#this is a hack to get around the cases where the parent is a group (And hence has no valid wdith value)
if parent.get_width() == 0: x = (parent.width - actor.get_width())/2
else: x = (parent.get_width() - actor.get_width())/2
else:
x = 0
@ -250,30 +253,40 @@ class ThemeMgr:
if parent is None:
print "Theme error (get_position y): type must be specified when using percentage values"
return None
y = (float(y[:-1]) / 100.0) * parent.get_height()
#this is a hack to get around the cases where the parent is a group (And hence has no valid wdith value)
if parent.get_height() == 0: y = (float(y[:-1]) / 100.0) * parent.height
else: y = (float(y[:-1]) / 100.0) * parent.get_height()
#print "width: " + str(width)
elif y == "center":
#Quick check on parent
if parent is None:
print "Theme error: type must be specified when using 'center' values"
return None
y = (parent.get_height() - actor.get_height)/2
#this is a hack to get around the cases where the parent is a group (And hence has no valid wdith value)
if parent.get_height() == 0: y = (parent.height - actor.get_height)/2
else: y = (parent.get_height() - actor.get_height())/2
else:
y = 0
return (int(x), int(y))
def get_colour(self, element, name):
def get_colour(self, element, name, subnode = False):
if element is None:
element = self.search_docs("colour", name).childNodes
#Quick check to make sure we found something
if element is None:
return None
r = int(self.find_child_value(element, "r"))
g = int(self.find_child_value(element, "g"))
b = int(self.find_child_value(element, "b"))
if subnode:
if self.find_child_value(element, "colour") is None: return None
r = int(self.find_child_value(element, "colour.r"))
g = int(self.find_child_value(element, "colour.g"))
b = int(self.find_child_value(element, "colour.b"))
else:
if self.find_child_value(element, "r") is None: return None
r = int(self.find_child_value(element, "r"))
g = int(self.find_child_value(element, "g"))
b = int(self.find_child_value(element, "b"))
colour = clutter.Color(r, g, b)
return colour
@ -307,7 +320,7 @@ class ThemeMgr:
return texture
def get_font(self, name, element):
def get_font(self, name, element, subnode = False):
if element is None:
element = self.search_docs("font", name).childNodes
#Quick check to make sure we found something
@ -408,9 +421,30 @@ class ThemeMgr:
if parent is None: parent = self.stage
font_string = self.get_font("font", element)
colour = self.get_colour(element, "colour", subnode = True)
label.set_font_name(font_string)
self.setup_actor(label, element, parent)
if not colour is None: label.set_color(colour)
return label
def get_group(self, id, parent = None, element = None, group = None):
if element is None:
element = self.search_docs("group", id).childNodes
#Quick check to make sure we found something
if element is None:
return None
if group is None:
group = clutter.Group()
if parent is None:
parent = self.stage
print self.find_child_value(element, "dimensions.width")
print self.get_dimensions(element, parent)
self.setup_actor(group, element, parent)
(group.width, group.height) = self.get_dimensions(element, parent)
print group.width
return group

View File

@ -115,6 +115,16 @@
</progress_bar>
<!-- These labels make up the currently playing song details -->
<group id="music_play_screen_song_details">
<dimensions type="relativeToStage">
<width>25%</width>
<height>20%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
</position>
</group>
<label id="music_play_screen_song_heading">
<font id="font">
<face>Tahoma</face>
@ -132,6 +142,11 @@
<x>0</x>
<y>0</y>
</position>
<colour id="colour">
<r>100</r>
<g>100</g>
<b>100</b>
</colour>
</label>
<label id="music_play_screen_album_heading">
<font id="font">
@ -148,8 +163,14 @@
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
<y>40%</y>
</position>
<colour id="colour">
<r>100</r>
<g>100</g>
<b>100</b>
</colour>
</label>
<label id="music_play_screen_artist_heading">
<font id="font">
@ -166,9 +187,15 @@
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
<y>20%</y>
</position>
<colour id="colour">
<r>100</r>
<g>100</g>
<b>100</b>
</colour>
</label>
<label id="music_play_screen_song">
<font id="font">
<face>Tahoma</face>
@ -183,9 +210,15 @@
<height>15%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<x>50%</x>
<y>0</y>
</position>
<colour id="colour">
<r>100</r>
<g>100</g>
<b>100</b>
</colour>
</label>
<label id="music_play_screen_artist">
<font id="font">
@ -201,9 +234,15 @@
<height>15%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
<x>50%</x>
<y>20%</y>
</position>
<colour id="colour">
<r>100</r>
<g>100</g>
<b>100</b>
</colour>
</label>
<label id="music_play_screen_album">
<font id="font">
@ -219,9 +258,15 @@
<height>15%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
<x>50%</x>
<y>40%</y>
</position>
<colour id="colour">
<r>100</r>
<g>100</g>
<b>100</b>
</colour>
</label>
</gloss-theme>