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