Package elisa :: Package plugins :: Package base :: Package actions :: Module slideshow_action
[hide private]
[frames] | no frames]

Source Code for Module elisa.plugins.base.actions.slideshow_action

 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.base_components.action import Action 
22   
23 -class SlideshowAction(Action):
24 """ 25 DOCME 26 """ 27 28 label = 'slideshow' 29 supported_file_types = ('image',) 30 31 # Attribute to set at initialization 32 # MediaURI instance 33 uri = None 34 # URI of the picture the slideshow will start at 35 start_uri = None 36 # position to add the URI in playlist 37 # -1 : add at the end. 38 position = -1 39 # base:slideshow_model instance 40 slideshow_model = None 41 42 # Options: 43 # if True, the playlist will be played after URI adding 44 play_now = True 45 # if True, the playlist will be emptied before adding the new URIs 46 erase_before_enqueue = True 47 48
49 - def __call__(self, controller, origin):
50 playlist_model = self.slideshow_model.playlist 51 playlist_activity = playlist_model.activity 52 53 if self.erase_before_enqueue: 54 playlist_activity.empty() 55 56 self.slideshow_model.playing = False 57 self.slideshow_model.preview_mode = False 58 59 playlist_activity.add_uri(self.uri, -1) 60 61 def load_playlist(model): 62 if len(model) > 0: 63 if self.start_uri in model: 64 index = model.index(self.start_uri) 65 else: 66 index = 0 67 68 self.slideshow_model.current_index = index
69 70 dfr = playlist_activity.loadmore(self.uri, playlist_model) 71 dfr.addCallback(load_playlist) 72 73 if self.play_now == True: 74 def play_now(model): 75 self.slideshow_model.playing = True
76 77 dfr.addCallback(play_now) 78