From 54e693d7a3cbee027b3abf5013c463bb8d94c0ee Mon Sep 17 00:00:00 2001 From: noisymime Date: Mon, 5 May 2008 14:09:45 +0000 Subject: [PATCH] - Small fixes --- themeMgr.py | 21 ++++++++++++--------- themes/Pear/music.xml | 1 + themes/Pear/music_play_screen.xml | 13 +++++++++++++ ui_elements/label_list.py | 24 ++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/themeMgr.py b/themeMgr.py index bddb2c1..dda6fa1 100644 --- a/themeMgr.py +++ b/themeMgr.py @@ -160,7 +160,7 @@ class ThemeMgr: if relativeTo == "relativeToStage": parent = self.stage elif relativeTo == "relativeToParent": - parent = actor.get_parent() + if parent is None: parent = actor.get_parent() elif relativeTo == "relativeToSelf": parent = actor @@ -198,8 +198,8 @@ class ThemeMgr: if width[-1] == "%": #Quick check on parent if parent is None: - print "Theme error: type must be specified when using percentage values" - return None + print "Theme error (get_dimensions width): parent must be specified when using percentage values" + return (None, None) width = (float(width[:-1]) / 100.0) * parent.get_width() #print "width: " + str(width) @@ -226,7 +226,7 @@ class ThemeMgr: if x[-1] == "%": #Quick check on parent if parent is None: - print "Theme error: type must be specified when using percentage values" + 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() @@ -246,7 +246,7 @@ class ThemeMgr: if y[-1] == "%": #Quick check on parent if parent is None: - print "Theme error: type must be specified when using percentage values" + 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() @@ -262,13 +262,14 @@ class ThemeMgr: return (int(x), int(y)) - def get_texture(self, name, parent, texture): + def get_texture(self, name, parent, texture = None, element = None): texture_src = None if texture is None: texture = clutter.Texture() - element = self.search_docs("texture", name).childNodes - #Quick check to make sure we found something + #Element can be supplied but if not, we search through everything + if element is None: element = self.search_docs("texture", name).childNodes + #Quick check to make sure we've got something if element is None: return None @@ -277,13 +278,15 @@ class ThemeMgr: #Special case to handle no image if src == "None": return texture + if src is None: + return None src = self.theme_dir + self.currentTheme + "/" + src pixbuf = gtk.gdk.pixbuf_new_from_file(src) texture.set_pixbuf(pixbuf) #Setup general actor properties - self.setup_actor(texture, element, None) + self.setup_actor(texture, element, parent) return texture diff --git a/themes/Pear/music.xml b/themes/Pear/music.xml index fca4646..4fd8f40 100644 --- a/themes/Pear/music.xml +++ b/themes/Pear/music.xml @@ -44,6 +44,7 @@ 30 10 + diff --git a/themes/Pear/music_play_screen.xml b/themes/Pear/music_play_screen.xml index 7201472..4205a2a 100644 --- a/themes/Pear/music_play_screen.xml +++ b/themes/Pear/music_play_screen.xml @@ -33,6 +33,19 @@ 30 10 + + music/songlist_off.png + + 100% + 100% + + + 0 + 0 + + + music/songlist_off.png + diff --git a/ui_elements/label_list.py b/ui_elements/label_list.py index 8bf9929..e7f4645 100644 --- a/ui_elements/label_list.py +++ b/ui_elements/label_list.py @@ -1,5 +1,7 @@ import clutter import pango +import pygtk +import gtk from InputQueue import InputQueue class LabelList(clutter.Group): @@ -26,6 +28,11 @@ class LabelList(clutter.Group): self.displayMax = length self.displaySize = self.displayMax - self.displayMin + self.inactive_item_background = None + self.background_group = clutter.Group() + self.background_group.show() + self.add(self.background_group) + #Selector bar image, moves with selections to show current item self.selector_bar = None @@ -54,8 +61,15 @@ class LabelList(clutter.Group): 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) + img_element = themeMgr.search_docs("label_list", id).getElementsByTagName("texture") + if len(img_element) > 0: img_element = img_element[0].childNodes + #img_element = themeMgr.find_element(element, "id", "inactive_background") + self.inactive_item_background = themeMgr.get_texture("inactive_background", self, element = img_element) + def on_key_press_event (self, event): self.input_queue.input(event) return self.timeline @@ -72,6 +86,16 @@ class LabelList(clutter.Group): label_y = len(self.items) * (self.label_height + self.item_gap) + #If a background pic is specified in the theme, clone it and add + if not self.inactive_item_background is None: + bg_img = clutter.CloneTexture(self.inactive_item_background) + bg_img.set_height(self.label_height) + bg_img.set_width(self.get_width()) + bg_img.set_position(0, label_y) + bg_img.show() + self.background_group.add(bg_img) + + newItem = ListItem(self.font_string, itemLabel, label_list = self) newItem.set_position(0, label_y) newItem.show()