- Colour included in themeMgr now working
- Further updates to music play screen - Group added to themeMgr
This commit is contained in:
parent
dda1f46409
commit
137a0ed866
|
@ -136,11 +136,15 @@ class SongDetails(clutter.Group):
|
||||||
|
|
||||||
self.themeMgr = playScreen.glossMgr.themeMgr
|
self.themeMgr = playScreen.glossMgr.themeMgr
|
||||||
self.backend = playScreen.musicPlayer.backend
|
self.backend = playScreen.musicPlayer.backend
|
||||||
|
self.stage = self.themeMgr.stage
|
||||||
|
|
||||||
self.setup()
|
self.setup()
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
def setup(self):
|
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
|
#Create all the various labels
|
||||||
self.artist_heading = self.themeMgr.get_label("music_play_screen_artist_heading", parent = self)
|
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)
|
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.artist = self.themeMgr.get_label("music_play_screen_artist", parent = self)
|
||||||
self.album = self.themeMgr.get_label("music_play_screen_album", 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 = 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.artist_heading)
|
||||||
self.add(self.album_heading)
|
self.add(self.album_heading)
|
||||||
|
|
58
themeMgr.py
58
themeMgr.py
|
@ -230,15 +230,18 @@ class ThemeMgr:
|
||||||
if parent is None:
|
if parent is None:
|
||||||
print "Theme error (get_position x): type must be specified when using percentage values"
|
print "Theme error (get_position x): type must be specified when using percentage values"
|
||||||
return None
|
return None
|
||||||
|
#this is a hack to get around the cases where the parent is a group (And hence has no valid wdith value)
|
||||||
x = (float(x[:-1]) / 100.0) * parent.get_width()
|
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)
|
#print "width: " + str(width)
|
||||||
elif x == "center":
|
elif x == "center":
|
||||||
#Quick check on parent
|
#Quick check on parent
|
||||||
if parent is None:
|
if parent is None:
|
||||||
print "Theme error: type must be specified when using 'center' values"
|
print "Theme error: type must be specified when using 'center' values"
|
||||||
return None
|
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:
|
else:
|
||||||
x = 0
|
x = 0
|
||||||
|
|
||||||
|
@ -250,30 +253,40 @@ class ThemeMgr:
|
||||||
if parent is None:
|
if parent is None:
|
||||||
print "Theme error (get_position y): type must be specified when using percentage values"
|
print "Theme error (get_position y): type must be specified when using percentage values"
|
||||||
return None
|
return None
|
||||||
|
#this is a hack to get around the cases where the parent is a group (And hence has no valid wdith value)
|
||||||
y = (float(y[:-1]) / 100.0) * parent.get_height()
|
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)
|
#print "width: " + str(width)
|
||||||
elif y == "center":
|
elif y == "center":
|
||||||
#Quick check on parent
|
#Quick check on parent
|
||||||
if parent is None:
|
if parent is None:
|
||||||
print "Theme error: type must be specified when using 'center' values"
|
print "Theme error: type must be specified when using 'center' values"
|
||||||
return None
|
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:
|
else:
|
||||||
y = 0
|
y = 0
|
||||||
|
|
||||||
return (int(x), int(y))
|
return (int(x), int(y))
|
||||||
|
|
||||||
def get_colour(self, element, name):
|
def get_colour(self, element, name, subnode = False):
|
||||||
if element is None:
|
if element is None:
|
||||||
element = self.search_docs("colour", name).childNodes
|
element = self.search_docs("colour", name).childNodes
|
||||||
#Quick check to make sure we found something
|
#Quick check to make sure we found something
|
||||||
if element is None:
|
if element is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
r = int(self.find_child_value(element, "r"))
|
if subnode:
|
||||||
g = int(self.find_child_value(element, "g"))
|
if self.find_child_value(element, "colour") is None: return None
|
||||||
b = int(self.find_child_value(element, "b"))
|
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)
|
colour = clutter.Color(r, g, b)
|
||||||
return colour
|
return colour
|
||||||
|
@ -307,7 +320,7 @@ class ThemeMgr:
|
||||||
return texture
|
return texture
|
||||||
|
|
||||||
|
|
||||||
def get_font(self, name, element):
|
def get_font(self, name, element, subnode = False):
|
||||||
if element is None:
|
if element is None:
|
||||||
element = self.search_docs("font", name).childNodes
|
element = self.search_docs("font", name).childNodes
|
||||||
#Quick check to make sure we found something
|
#Quick check to make sure we found something
|
||||||
|
@ -408,9 +421,30 @@ class ThemeMgr:
|
||||||
if parent is None: parent = self.stage
|
if parent is None: parent = self.stage
|
||||||
|
|
||||||
font_string = self.get_font("font", element)
|
font_string = self.get_font("font", element)
|
||||||
|
colour = self.get_colour(element, "colour", subnode = True)
|
||||||
label.set_font_name(font_string)
|
label.set_font_name(font_string)
|
||||||
|
|
||||||
self.setup_actor(label, element, parent)
|
self.setup_actor(label, element, parent)
|
||||||
|
if not colour is None: label.set_color(colour)
|
||||||
|
|
||||||
return label
|
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
|
|
@ -115,6 +115,16 @@
|
||||||
</progress_bar>
|
</progress_bar>
|
||||||
|
|
||||||
<!-- These labels make up the currently playing song details -->
|
<!-- 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">
|
<label id="music_play_screen_song_heading">
|
||||||
<font id="font">
|
<font id="font">
|
||||||
<face>Tahoma</face>
|
<face>Tahoma</face>
|
||||||
|
@ -132,6 +142,11 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
</position>
|
</position>
|
||||||
|
<colour id="colour">
|
||||||
|
<r>100</r>
|
||||||
|
<g>100</g>
|
||||||
|
<b>100</b>
|
||||||
|
</colour>
|
||||||
</label>
|
</label>
|
||||||
<label id="music_play_screen_album_heading">
|
<label id="music_play_screen_album_heading">
|
||||||
<font id="font">
|
<font id="font">
|
||||||
|
@ -148,8 +163,14 @@
|
||||||
</dimensions>
|
</dimensions>
|
||||||
<position type="relativeToParent">
|
<position type="relativeToParent">
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>40%</y>
|
||||||
</position>
|
</position>
|
||||||
|
|
||||||
|
<colour id="colour">
|
||||||
|
<r>100</r>
|
||||||
|
<g>100</g>
|
||||||
|
<b>100</b>
|
||||||
|
</colour>
|
||||||
</label>
|
</label>
|
||||||
<label id="music_play_screen_artist_heading">
|
<label id="music_play_screen_artist_heading">
|
||||||
<font id="font">
|
<font id="font">
|
||||||
|
@ -166,9 +187,15 @@
|
||||||
</dimensions>
|
</dimensions>
|
||||||
<position type="relativeToParent">
|
<position type="relativeToParent">
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>20%</y>
|
||||||
</position>
|
</position>
|
||||||
|
<colour id="colour">
|
||||||
|
<r>100</r>
|
||||||
|
<g>100</g>
|
||||||
|
<b>100</b>
|
||||||
|
</colour>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label id="music_play_screen_song">
|
<label id="music_play_screen_song">
|
||||||
<font id="font">
|
<font id="font">
|
||||||
<face>Tahoma</face>
|
<face>Tahoma</face>
|
||||||
|
@ -183,9 +210,15 @@
|
||||||
<height>15%</height>
|
<height>15%</height>
|
||||||
</dimensions>
|
</dimensions>
|
||||||
<position type="relativeToParent">
|
<position type="relativeToParent">
|
||||||
<x>0</x>
|
<x>50%</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
</position>
|
</position>
|
||||||
|
|
||||||
|
<colour id="colour">
|
||||||
|
<r>100</r>
|
||||||
|
<g>100</g>
|
||||||
|
<b>100</b>
|
||||||
|
</colour>
|
||||||
</label>
|
</label>
|
||||||
<label id="music_play_screen_artist">
|
<label id="music_play_screen_artist">
|
||||||
<font id="font">
|
<font id="font">
|
||||||
|
@ -201,9 +234,15 @@
|
||||||
<height>15%</height>
|
<height>15%</height>
|
||||||
</dimensions>
|
</dimensions>
|
||||||
<position type="relativeToParent">
|
<position type="relativeToParent">
|
||||||
<x>0</x>
|
<x>50%</x>
|
||||||
<y>0</y>
|
<y>20%</y>
|
||||||
</position>
|
</position>
|
||||||
|
|
||||||
|
<colour id="colour">
|
||||||
|
<r>100</r>
|
||||||
|
<g>100</g>
|
||||||
|
<b>100</b>
|
||||||
|
</colour>
|
||||||
</label>
|
</label>
|
||||||
<label id="music_play_screen_album">
|
<label id="music_play_screen_album">
|
||||||
<font id="font">
|
<font id="font">
|
||||||
|
@ -219,9 +258,15 @@
|
||||||
<height>15%</height>
|
<height>15%</height>
|
||||||
</dimensions>
|
</dimensions>
|
||||||
<position type="relativeToParent">
|
<position type="relativeToParent">
|
||||||
<x>0</x>
|
<x>50%</x>
|
||||||
<y>0</y>
|
<y>40%</y>
|
||||||
</position>
|
</position>
|
||||||
|
|
||||||
|
<colour id="colour">
|
||||||
|
<r>100</r>
|
||||||
|
<g>100</g>
|
||||||
|
<b>100</b>
|
||||||
|
</colour>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</gloss-theme>
|
</gloss-theme>
|
||||||
|
|
Loading…
Reference in New Issue