Package elisa :: Package plugins :: Package bad :: Package raval_frontend :: Module detailed_shaded_list_view
[hide private]
[frames] | no frames]

Source Code for Module elisa.plugins.bad.raval_frontend.detailed_shaded_list_view

 1  # -*- coding: utf-8 -*- 
 2  # Elisa - Home multimedia server 
 3  # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 
 4  # All rights reserved. 
 5  # 
 6  # This file is available under one of two license agreements. 
 7  # 
 8  # This file is licensed under the GPL version 3. 
 9  # See "LICENSE.GPL" in the root of this distribution including a special 
10  # exception to use Elisa with Fluendo's plugins. 
11  # 
12  # The GPL part of Elisa is also available under a commercial licensing 
13  # agreement from Fluendo. 
14  # See "LICENSE.Elisa" in the root directory of this distribution package 
15  # for details on that license. 
16   
17  from shaded_list_view import ListItem 
18  from elisa.core import common 
19   
20 -class DetailedListItem(ListItem):
21
22 - def load(self):
23 super(DetailedListItem, self).load() 24 25 self._sub_description = self._create_text() 26 self.add(self._sub_description) 27 self._sub_description.fg_color = (150, 150, 150, 255) 28 # self._sub_description.bg_color = (0, 0, 255, 255) 29 self._sub_description.visible = True 30 self._sub_description.font_height = 0.10 31 32 text_x = self.description.x 33 text_y = 0.21 34 text_width = self.description.width 35 text_height = 0.25 36 37 self._description.y = -0.01 38 self._description.font_height = 0.11 39 40 self._sub_description.position = (text_x, text_y, 0) 41 self._sub_description.size = (text_width, text_height)
42
43 - def unload(self):
44 super(DetailedListItem, self).unload() 45 self.remove(self._sub_description)
46
47 - def sub_description__set(self, text):
48 self._sub_description.label = text
49
50 - def sub_description__get(self):
51 return self._sub_description
52 53 plugin_registry = common.application.plugin_registry 54 ShadedListView = plugin_registry.get_component_class('raval:shaded_list_view') 55
56 -class DetailedShadedListView(ShadedListView):
57
58 - def create_item(self, model):
59 widget = DetailedListItem() 60 return widget
61
62 - def load_item(self, index):
63 model = self.controller.model[index] 64 widget = self[index] 65 66 widget.load() 67 68 self.load_from_theme(model.theme_icon, widget.thumbnail) 69 70 text = self.frontend.translate_text(model.text) 71 sub_text = self.frontend.translate_text(model.sub_text) 72 widget.description = text 73 widget.sub_description = sub_text 74 75 uri = model.thumbnail_source 76 if uri != None: 77 self._thumbnail_source_to_image(uri, widget.thumbnail)
78
79 - def unload_item(self, widget):
80 widget.unload()
81
82 - def element_attribute_set(self, position, key, old_value, new_value):
83 super(DetailedShadedListView, self).element_attribute_set(position, key, 84 old_value, 85 new_value) 86 if key == "sub_text": 87 subtext = self.frontend.translate_text(new_value) 88 self[position].sub_description = subtext
89