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