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 __maintainer2__ = 'Florian Boucault <florian@fluendo.com>' 20 21 22 from elisa.base_components.controller import Controller 23 from twisted.internet import reactor 24 from elisa.core.input_event import * 25 2628 29 supported_models = ('base:slideshow_model',) 30 bindings = {'current_index': 'current_index', 31 'playing': 'playing', 32 'preview_mode': 'preview_mode', 33 'duration': 'duration'} 34 3812040 if input_event.action == EventAction.GO_LEFT: 41 if len(self.model.playlist) > 0: 42 self.previous_image() 43 return True 44 45 elif input_event.action == EventAction.GO_RIGHT: 46 if len(self.model.playlist) > 0: 47 self.next_image() 48 return True 49 50 elif input_event.action == EventAction.OK: 51 self.model.playing = not self.model.playing 52 return True 53 54 elif input_event.action == EventAction.PLAY: 55 self.model.playing = True 56 return True 57 58 elif input_event.action == EventAction.PAUSE: 59 self.model.playing = False 60 return True 61 62 elif input_event.action == EventAction.STOP: 63 self.model.playing = False 64 self.model.current_index = 0 65 return True 66 67 return False6870 Controller.attribute_set(self, origin, key, old_value, new_value) 71 72 if key == 'playing': 73 if self.model.playing: 74 self._call_later = reactor.callLater(self.model.duration, 75 self.next_image) 76 else: 77 self._cancel_last_call_later() 78 elif key == 'preview_mode': 79 if not new_value: 80 self.focus()81 8587 if new_focused == False and self.model.playing == True: 88 self._cancel_last_call_later() 89 self.model.playing = False9092 self._cancel_last_call_later() 93 94 index = self.model.current_index + 1 95 if index < len(self.model.playlist): 96 self.info("Loading image at index %r", index) 97 self.model.current_index = index 98 if self.model.playing == True: 99 self._call_later = reactor.callLater(self.model.duration, 100 self.next_image) 101 return True 102 else: 103 self.info("Reached end of slideshow") 104 return False105107 self._cancel_last_call_later() 108 109 index = self.model.current_index - 1 110 if index < len(self.model.playlist) and index >= 0: 111 self.info("Loading image at index %r", index) 112 self.model.current_index = index 113 if self.model.playing == True: 114 self._call_later = reactor.callLater(self.model.duration, 115 self.previous_image) 116 return True 117 else: 118 self.info("Reached beginning of slideshow") 119 return False
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:26 2008 | http://epydoc.sourceforge.net |