- Label_list item fixes

This commit is contained in:
noisymime 2008-05-11 01:55:35 +00:00
parent 3737724905
commit 3a5822db37
3 changed files with 16 additions and 6 deletions

View File

@ -172,7 +172,8 @@ class ThemeMgr:
xy_ratio = float(actor.get_height()) / float(actor.get_width()) xy_ratio = float(actor.get_height()) / float(actor.get_width())
height = int(width * xy_ratio) height = int(width * xy_ratio)
actor.set_height(height) actor.set_height(height)
if (not width is None) and (not width == "default"): actor.set_width(width) if (not width is None) and (not width == "default"):
actor.set_width(width)
#Set the position of the actor #Set the position of the actor
(x,y) = (0,0) (x,y) = (0,0)

View File

@ -15,7 +15,7 @@
</dimensions> </dimensions>
<position type="relativeToStage"> <position type="relativeToStage">
<x>40%</x> <x>40%</x>
<y>50%</y> <y>20%</y>
</position> </position>
<item_gap>0</item_gap> <item_gap>0</item_gap>

View File

@ -13,6 +13,7 @@ class LabelList(clutter.Group):
#Default font #Default font
font_string = "Tahoma 30" font_string = "Tahoma 30"
item_gap = 0 item_gap = 0
width = 0
def __init__(self, length): def __init__(self, length):
clutter.Group.__init__(self) clutter.Group.__init__(self)
@ -48,7 +49,7 @@ class LabelList(clutter.Group):
#Grab the font #Grab the font
font_node = themeMgr.get_subnode(element, "font") font_node = themeMgr.get_subnode(element, "font")
fontString = themeMgr.get_font("main", font_node) fontString = themeMgr.get_font("main", font_node)
self.font = fontString self.font_string = fontString
#Set the selection effect steps #Set the selection effect steps
self.zoomStep0 = float(themeMgr.find_child_value(element, "scale_step0")) self.zoomStep0 = float(themeMgr.find_child_value(element, "scale_step0"))
@ -64,6 +65,9 @@ class LabelList(clutter.Group):
themeMgr.setup_actor(self, element, themeMgr.stage) themeMgr.setup_actor(self, element, themeMgr.stage)
(self.width, self.height) = themeMgr.get_dimensions(element, themeMgr.stage)
print "Label List width: %s" % self.get_width()
img_element = themeMgr.search_docs("label_list", id).getElementsByTagName("texture") img_element = themeMgr.search_docs("label_list", id).getElementsByTagName("texture")
img_element = themeMgr.find_element(img_element, "id", "inactive_background") img_element = themeMgr.find_element(img_element, "id", "inactive_background")
@ -91,13 +95,13 @@ class LabelList(clutter.Group):
if not self.inactive_item_background is None: if not self.inactive_item_background is None:
bg_img = clutter.CloneTexture(self.inactive_item_background) bg_img = clutter.CloneTexture(self.inactive_item_background)
bg_img.set_height(self.label_height) bg_img.set_height(self.label_height)
bg_img.set_width(self.get_width()) bg_img.set_width(self.width)
bg_img.set_position(0, label_y) bg_img.set_position(0, label_y)
bg_img.show() bg_img.show()
self.background_group.add(bg_img) self.background_group.add(bg_img)
newItem = ListItem(self.font_string, itemLabel, label_list = self) newItem = ListItem(self.font_string, itemLabel, label_list = self, max_width = self.width)
newItem.set_position(0, label_y) newItem.set_position(0, label_y)
newItem.show() newItem.show()
self.items.append(newItem) self.items.append(newItem)
@ -274,7 +278,7 @@ class ListItem(clutter.Group):
scale_step_medium = 0.5 scale_step_medium = 0.5
scale_step_none = 0.4 scale_step_none = 0.4
def __init__ (self, font, label_left = "", label_right = "", label_list = None): def __init__ (self, font, label_left = "", label_right = "", label_list = None, max_width = None):
clutter.Group.__init__ (self) #, menu, itemLabel, y) clutter.Group.__init__ (self) #, menu, itemLabel, y)
self.set_anchor_point_from_gravity(clutter.GRAVITY_WEST) self.set_anchor_point_from_gravity(clutter.GRAVITY_WEST)
@ -314,6 +318,11 @@ class ListItem(clutter.Group):
self.currentOpacity = self.opacity_step_medium self.currentOpacity = self.opacity_step_medium
self.set_scale(self.currentZoom, self.currentZoom) self.set_scale(self.currentZoom, self.currentZoom)
self.set_opacity(self.currentOpacity) self.set_opacity(self.currentOpacity)
#Set ellipses
if not max_width is None:
self.label_left.set_width( max_width - self.label_right.get_width() )
self.label_left.set_ellipsize(pango.ELLIPSIZE_END)
""" """
#(label_width, label_height) = self.label.get_size() #(label_width, label_height) = self.label.get_size()
label_x = 0 #x #self.stage.get_width() - label_width - 50 label_x = 0 #x #self.stage.get_width() - label_width - 50