Home | Trees | Indices | Help |
---|
|
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 18 __maintainer__ = 'Lionel Martin <lionel@fluendo.com>' 19 20 21 from elisa.core import common 22 from elisa.core.plugin_registry import PluginNotFound, ComponentNotFound 23 from elisa.core import plugin_registry 24 25 from elisa.core.media_uri import MediaUri 26 27 from elisa.extern.translation import gettexter, N_ 28 T_ = gettexter('elisa-aspect-ratio-switcher') 29 30 31 MenuActivityClass = plugin_registry.get_component_class('base:menu_activity') 32 from switch_aspect_ratio_action import SwitchAspectRatioAction 3335 """ 36 DOCME 37 """ 38 39 config_doc = {'aspect_ratios': "a list of aspect ratio like '16:9' or 'auto'"} 40 default_config = {'aspect_ratios': []} 41 42 menu_name = T_(N_("Screen type")) 43 menu_icon_name = "aspect_ratio_switcher" 44 media_types = [] 45 46 default_ratios = ['auto', '4:3', '16:9', '16:10'] 479849 """ 50 Returns a menu_node_model for the aspect_ratios menu 51 """ 52 main_node = MenuActivityClass.get_model(self) 53 54 # create the default ratio items 55 for aspect_ratio in self.default_ratios: 56 menu_model = self._model_from_ratio(aspect_ratio) 57 58 if menu_model != None: 59 self.log("menu model: %r", menu_model) 60 main_node.append(menu_model) 61 else: 62 self.debug("error when creating menu_model %s", aspect_ratio) 63 64 for aspect_ratio in self.config.get("aspect_ratios", []): 65 if aspect_ratio in self.default_ratios: 66 continue 67 68 menu_model = self._model_from_ratio(aspect_ratio) 69 70 if menu_model != None: 71 self.log("menu model: %r", menu_model) 72 main_node.append(menu_model) 73 else: 74 self.debug("error when creating menu_model %s", aspect_ratio) 75 76 main_node.has_children = len(main_node) > 0 77 78 return main_node7981 self.log("Creating aspect ratio menu model %s", aspect_ratio) 82 83 icon_name = "ratio_" + aspect_ratio.replace(":", "_") 84 85 if aspect_ratio == 'auto': 86 label = T_(N_('Automatic')) 87 elif aspect_ratio == 'mm': 88 label = T_(N_('Use screen size')) 89 else: 90 label = aspect_ratio 91 92 menu_model = self._create_menu_model(label, icon_name) 93 action = SwitchAspectRatioAction() 94 action.aspect_ratio = aspect_ratio 95 menu_model.activate_action = action 96 97 return menu_model
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:54 2008 | http://epydoc.sourceforge.net |