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