Package flumotion :: Package admin :: Package text :: Module admin_text
[hide private]

Source Code for Module flumotion.admin.text.admin_text

 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  """base view for displaying cursor components""" 
23   
24  from zope.interface import implements 
25   
26  from flumotion.common import log 
27  from flumotion.twisted import flavors 
28   
29  __version__ = "$Rev: 6961 $" 
30   
31   
32 -class BaseAdminText(log.Loggable):
33 """ 34 I am a base class for all Text-based Admin views. 35 I am a view on one component's properties. 36 """ 37 38 implements(flavors.IStateListener) 39 40 logCategory = "admintext" 41 42 state = admin = 'hello pychecker' 43
44 - def __init__(self, state, admin):
45 """ 46 @param state: state of component this is a UI for 47 @type state: L{flumotion.common.planet.AdminComponentState} 48 @type admin: L{flumotion.admin.admin.AdminModel} 49 @param admin: the admin model that interfaces with the manager for us 50 """ 51 self.state = state 52 self.name = state.get('name') 53 self.admin = admin 54 self.debug('creating admin text for state %r' % state)
55
56 - def callRemote(self, methodName, *args, **kwargs):
57 return self.admin.componentCallRemote(self.state, methodName, 58 *args, **kwargs)
59 60 ### child class methods to be overridden 61
62 - def setup(self):
63 """ 64 Set up the admin view so it can display nodes. 65 """ 66 raise NotImplementedError("Child class needs to implement setup")
67
68 - def uiStateChanged(self, stateObject):
69 # default implementation 70 pass
71
72 - def stateSet(self, object, key, value):
73 self.uiStateChanged(object)
74 75
76 - def stateAppend(self, object, key, value):
77 self.uiStateChanged(object)
78 79
80 - def stateRemove(self, object, key, value):
81 self.uiStateChanged(object)
82 83 84 # given an input text return possible completions
85 - def getCompletions(self, input):
86 return []
87 88 # run command, return string with result
89 - def runCommand(self, command):
90 return ""
91