1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
56
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):
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
80 - def getCompletions(self, input):
82
83
84 - def runCommand(self, command):
86