Package flumotion :: Package component :: Package consumers :: Package disker :: Module admin_text
[hide private]

Source Code for Module flumotion.component.consumers.disker.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  from flumotion.component.base.admin_text import BaseAdminText 
19   
20  import string 
21   
22  from twisted.internet import defer 
23   
24  __version__ = "$Rev$" 
25   
26   
27 -class DiskerAdminText(BaseAdminText):
28 commands = ['changefile'] 29 filename_change_defers = [] 30
31 - def setup(self):
32 pass
33
34 - def getCompletions(self, input):
35 input_split = input.split() 36 available_commands = [] 37 if input.endswith(' '): 38 input_split.append('') 39 if len(input_split) <= 1: 40 for c in self.commands: 41 if c.startswith(string.lower(input_split[0])): 42 available_commands.append(c) 43 return available_commands
44
45 - def runCommand(self, command):
46 command_split = command.split() 47 if string.lower(command_split[0]) == 'changefile': 48 # change filename and wait for new filename 49 self.callRemote("changeFilename") 50 newd = defer.Deferred() 51 self.filename_change_defers.append(newd) 52 return newd 53 else: 54 return None
55
56 - def component_filenameChanged(self, filename):
57 for i in self.filename_change_defers: 58 i.callback(filename) 59 self.filename_change_defers = []
60 61 UIClass = DiskerAdminText 62