Trees | Indices | Help |
---|
|
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 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 """Wizard plugin for the cortado http plug 23 """ 24 25 from zope.interface import implements 26 27 import gtk 28 import os 29 30 from flumotion.admin.assistant.interfaces import IHTTPServerPlugin 31 from flumotion.admin.assistant.models import Plug 32 from flumotion.common import messages 33 from flumotion.common.i18n import N_, gettexter 34 from flumotion.ui.fileselector import FileSelectorDialog 35 from flumotion.ui.plugarea import WizardPlugLine 36 37 __version__ = "$Rev$" 38 T_ = gettexter() 39 4042 """I am a model representing the configuration file for a 43 Request Logger plug. 44 """ 45 plugType = "requestlogger-file" 46 5157 5860 gladeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 61 'wizard.glade') 62 toplevel_name = 'requestlogger-window' 6310265 WizardPlugLine.__init__(self, wizard, model, description) 66 67 self.logfile.data_type = str 68 self._proxy = self.add_proxy(self.model.properties, ['logfile']) 69 70 if self.getActive(): 71 self.model.setActive(True) 72 else: 73 self.plugActiveChanged(False)74 75 # WizardPlugLine 7678 self.logfile.set_sensitive(active) 79 self.select_logfile.set_sensitive(active) 80 self.model.setActive(active)81 82 # Callbacks 8385 86 def response(fs, response): 87 fs.hide() 88 if response == gtk.RESPONSE_OK: 89 filename = os.path.join(fs.getFilename(), 'access.log') 90 self.model.properties.logfile = filename 91 self._proxy.update('logfile')92 93 fs = FileSelectorDialog(self.wizard.window, 94 self.wizard.getAdminModel()) 95 96 fs.connect('response', response) 97 fs.selector.setOnlyDirectoriesMode(True) 98 fs.selector.setWorkerName(self.model.component.worker) 99 directory = os.path.dirname(self.model.properties.logfile) 100 fs.setDirectory(directory) 101 fs.show_all()104 self._runChecks()105107 self.wizard.waitForTask('ondemand check') 108 109 worker = self.model.component.worker 110 directory = os.path.dirname(self.logfile.get_text()) 111 112 def importError(failure): 113 failure.trap(ImportError) 114 self.info('could not import twisted-web') 115 message = messages.Warning(T_(N_( 116 "Worker '%s' cannot import module '%s'."), 117 worker, 'twisted.web')) 118 message.add(T_(N_("\nThis module is part of the '%s'."), 119 'Twisted Project')) 120 message.add(T_(N_("\nThe project's homepage is %s"), 121 'http://www.twistedmatrix.com/')) 122 message.id = 'module-twisted-web' 123 self.wizard.add_msg(message) 124 self.wizard.taskFinished(True) 125 return False126 127 def checkPathFinished(pathExists): 128 if not pathExists: 129 message = messages.Warning(T_(N_( 130 "Directory '%s' does not exist, " 131 "or is not readable on worker '%s'.") 132 % (directory, worker))) 133 message.id = 'log-path-check' 134 self.wizard.add_msg(message) 135 self.wizard.taskFinished(True) 136 return False 137 else: 138 self.wizard.clear_msg('log-path-check') 139 self.wizard.taskFinished(False) 140 return True 141 142 self.wizard.taskFinished() 143 144 def checkPath(unused): 145 d = self.wizard.runInWorker( 146 worker, 'flumotion.worker.checks.check', 147 'checkDirectory', directory) 148 d.addCallback(checkPathFinished) 149 return d 150 151 d = self.wizard.checkImport(worker, 'twisted.web') 152 d.addCallback(checkPath) 153 d.addErrback(importError) 154 return d 155 156 169 170172 """I am a model representing the configuration file for the 173 Force download plug. 174 """ 175 plugType = "requestmodifier-forcedownload" 176188 189178 Plug.__init__(self) 179 self.component = component 180 self.properties.argument_name = 'force' 181 self.properties.trigger_value = 'true'182191202 203 217193 WizardPlugLine.__init__(self, wizard, model, description) 194 195 if self.getActive(): 196 self.model.setActive(True)197 198 # WizardPlugLine 199201 self.model.setActive(active)
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Apr 29 18:56:40 2011 | http://epydoc.sourceforge.net |