| Trees | Indices | Help |
|---|
|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with the 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 """utilities used by flumotion-command""" 23 24 from flumotion.twisted.defer import defer_generator 25 from flumotion.common import errors 26 27 __version__ = "$Rev: 6961 $" 28 3436 split = string.split('/') 37 assert not split[0] 38 assert len(split) > 0 and len(split) < 4 39 if len(split) == 3: 40 return ['component'] + split[1:] 41 elif len(split) == 2: 42 if split[1] == 'atmosphere': 43 return ['atmosphere'] 44 elif split[1] == '': 45 return ['root'] 46 else: 47 return ['flow'] + split[1:]4850 if avatarId[0] == 'atmosphere': 51 for c in planet.get('atmosphere').get('components'): 52 if c.get('name') == avatarId[1]: 53 return c 54 print ('Could not find component named %s in flow %s' 55 % (avatarId[1], avatarId[0])) 56 return None 57 58 for f in planet.get('flows'): 59 if f.get('name') == avatarId[0]: 60 for c in f.get('components'): 61 if c.get('name') == avatarId[1]: 62 return c 63 print ('Could not find component named %s in flow %s' 64 % (avatarId[1], avatarId[0])) 65 return None6668 if not component: 69 d = model.callRemote('getPlanetState') 70 yield d 71 planet = d.value() 72 component = find_component(planet, avatarId) 73 if component: 74 d = model.componentCallRemote(component, 'getUIState') 75 yield d 76 try: 77 uistate = d.value() 78 yield uistate 79 except errors.SleepingComponentError: 80 if not quiet: 81 print ('Error: Component %s in flow %s is sleeping' 82 % (avatarId[1], avatarId[0]))83 get_component_uistate = defer_generator(get_component_uistate) 84
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sat Jul 26 09:43:12 2008 | http://epydoc.sourceforge.net |