Package flumotion :: Package common :: Module componentui
[hide private]

Source Code for Module flumotion.common.componentui

 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,2008,2009 Fluendo, S.L. 
 6  # Copyright (C) 2010,2011 Flumotion Services, S.A. 
 7  # All rights reserved. 
 8  # 
 9  # This file may be distributed and/or modified under the terms of 
10  # the GNU Lesser General Public License version 2.1 as published by 
11  # the Free Software Foundation. 
12  # This file is distributed without any warranty; without even the implied 
13  # warranty of merchantability or fitness for a particular purpose. 
14  # See "LICENSE.LGPL" in the source distribution for more information. 
15  # 
16  # Headers in this file shall remain intact. 
17   
18  """jelliers for State shared between worker, manager and admin 
19  """ 
20   
21  # FIXME: Users of this module relies heavily on side effects, 
22  #        this should be addressed so they have to call a function 
23  #        to register the unjelliers, imports should have as few 
24  #        side effects as possible 
25   
26  from twisted.spread import pb 
27   
28  from flumotion.twisted import flavors 
29  from flumotion.common import registry 
30   
31  __version__ = "$Rev$" 
32   
33   
34  # state of a component used for UI purposes 
35   
36   
37 -class WorkerComponentUIState(flavors.StateCacheable):
38 pass
39 40
41 -class ManagerComponentUIState(flavors.StateCacheable, 42 flavors.StateRemoteCache):
43
44 - def processUniqueID(self):
45 # Make sure proxies for the same object are the same, if we are 46 # later cached by someone else. See bug #519. 47 return id(self.__dict__)
48 49
50 -class AdminComponentUIState(flavors.StateRemoteCache):
51 pass
52 53 54 pb.setUnjellyableForClass(WorkerComponentUIState, ManagerComponentUIState) 55 pb.setUnjellyableForClass(ManagerComponentUIState, AdminComponentUIState) 56 57
58 -class WizardEntryState(pb.RemoteCopy):
59
60 - def getAcceptedMediaTypes(self):
61 """ 62 Fetches a list of media types this components accepts. 63 @returns: a list of strings 64 """ 65 return [accepted.media_type for accepted in self.accepts]
66
67 - def getProvidedMediaTypes(self):
68 """ 69 Fetches a list of media types this components provides. 70 @returns: a list of strings 71 """ 72 return [provided.media_type for provided in self.provides]
73
74 - def getRank(self):
75 return self.rank
76 77 pb.setUnjellyableForClass(registry.RegistryEntryWizard, WizardEntryState) 78 79
80 -class WizardEntryFormatState(pb.RemoteCopy):
81 pass
82 83 pb.setUnjellyableForClass(registry.RegistryEntryWizardFormat, 84 WizardEntryFormatState) 85