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__ = 'Florian Boucault <florian@fluendo.com>' 19 20 21 from elisa.core import plugin_registry 22 NodeControllerClass = plugin_registry.get_component_class('base:node_controller') 23 24 from elisa.core.input_event import * 25 26 from twisted.internet import reactor 2729 30 supported_models = ('base:menu_model', 'base:menu_node_model') 31135 136 ## def loading__set(self, value): 137 ## # display grid mode if we have more than 10 items 138 ## if not value: 139 ## if len(self.model) > 10 and self.visualisation_mode == 'list': 140 ## self.visualisation_mode = 'grid' 141 ## else: 142 ## if self.visualisation_mode == 'grid': 143 ## self.visualisation_mode = 'list' 14433 # visualisation modes 34 self._visualisation_modes = ["list", "grid"] 35 self.visualisation_mode = self._visualisation_modes[0] 36 37 NodeControllerClass.__init__(self) 38 self.hover_delay = 1.000 39 self.hover_delayed = None40 4143 if input_event.action == EventAction.GO_UP: 44 self.exit_node() 45 return True 46 47 elif input_event.action == EventAction.GO_DOWN: 48 self.enter_node() 49 return True 50 51 elif input_event.action == EventAction.GO_LEFT: 52 if len(self) > 0 and self.current_index > 0: 53 self.current_index -= 1 54 return True 55 56 elif input_event.action == EventAction.GO_RIGHT: 57 if len(self) > 0 and self.current_index < len(self) - 1: 58 self.current_index += 1 59 return True 60 61 elif input_event.action == EventAction.OK: 62 self.activate_node(input_event.origin) 63 return True 64 65 """ 66 elif input_event.value == EventValue.KEY_m: 67 # switch to the next visualisation mode 68 current = self._visualisation_modes.index(self.visualisation_mode) 69 current = (current + 1) % len(self._visualisation_modes) 70 self.visualisation_mode = self._visualisation_modes[current] 71 72 return True 73 """ 74 75 return False7678 NodeControllerClass.selected__set(self, value) 79 80 if value: 81 self.hover_delayed = reactor.callLater(self.hover_delay, self.hover_action) 82 else: 83 if self.hover_delayed and self.hover_delayed.active(): 84 self.hover_delayed.cancel()8587 NodeControllerClass.current_index__set(self, index) 88 89 if self.hover_delayed and self.hover_delayed.active(): 90 self.hover_delayed.reset(self.hover_delay) 91 else: 92 self.hover_delayed = reactor.callLater(self.hover_delay, self.hover_action)9395 if self.current_index >= 0 and self.current_index < len(self): 96 child_controller = self[self.current_index] 97 if child_controller.model.hover_action != None: 98 child_controller.model.hover_action(self)99101 if len(self) == 0: 102 return 103 104 child_controller = self[self.current_index] 105 if child_controller.model.has_children: 106 child_controller.loadmore() 107 child_controller.focus() 108 child_controller.selected = True 109 110 if self.loadmore_on_selection == True and len(child_controller) > 0: 111 grand_child_controller = child_controller[child_controller.current_index] 112 if grand_child_controller.model.has_children: 113 grand_child_controller.loadmore() 114 115 elif child_controller.model.loading: 116 child_controller.focus() 117 child_controller.selected = True118120 if isinstance(self.parent, NodeControllerClass): 121 self.parent.focus() 122 self.parent.selected = True 123 self.model.activity.unload(self.model)124126 if self.hover_delayed.active(): 127 self.hover_delayed.cancel() 128 129 if self.current_index >= 0 and self.current_index < len(self): 130 child_controller = self[self.current_index] 131 if callable(child_controller.model.activate_action): 132 child_controller.model.activate_action(self, origin) 133 else: 134 self.enter_node()
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:26 2008 | http://epydoc.sourceforge.net |