1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """A wizard step for configuring an on demand stream
23 """
24
25 import gettext
26
27 import gobject
28 import gtk
29
30 from flumotion.common import messages
31
32 from flumotion.common.i18n import N_, gettexter
33 from flumotion.common.vfs import registerVFSJelly
34 from flumotion.ui.fileselector import FileSelectorDialog
35 from flumotion.wizard.models import HTTPServer
36 from flumotion.wizard.workerstep import WorkerWizardStep
37
38 __version__ = "$Rev: 7038 $"
39 _ = gettext.gettext
40 T_ = gettexter()
41
42
44 """I am a model representing the configuration file for a
45 an on demand HTTP server component.
46 """
47 componentType = 'http-server'
52
53
54
59
60
62 """I am a step of the configuration wizard which allows you
63 to configure an on demand configuration over HTTP
64 """
65 name = 'Demand'
66 title = _('Demand')
67 sidebarName = _('On demand')
68 section = _('Production')
69 gladeFile = 'ondemand-wizard.glade'
70
75
76
77
79 self.path.data_type = str
80 self.port.data_type = int
81 self.mount_point.data_type = str
82
83 self._proxy = self.add_proxy(self.model.properties,
84 ['path',
85 'port',
86 'mount_point'])
87
88 self.mount_point.set_text("/")
89 registerVFSJelly()
90
94
97
98
99
102
103
104
121
122 def checkPathFinished(pathExists, path):
123 if not pathExists:
124 message = messages.Warning(T_(N_(
125 "Directory '%s' does not exist, "
126 "or is not readable on worker '%s'.")
127 % (path, self.worker)))
128 message.id = 'demand-directory-check'
129 self.wizard.add_msg(message)
130 else:
131 self.wizard.clear_msg('demand-directory-check')
132
133 self.wizard.taskFinished(blockNext=not pathExists)
134
135 def checkPath(unused):
136 path = self.path.get_text()
137 d = self.runInWorker('flumotion.worker.checks.check',
138 'checkDirectory', path)
139 d.addCallback(checkPathFinished, path)
140
141 d = self.wizard.checkImport(self.worker, 'twisted.web')
142 d.addCallback(checkPath)
143 d.addErrback(importError)
144
146 if self._idleId != -1:
147 gobject.source_remove(self._idleId)
148 self._idleId = -1
149
153
156
161
168 def deleteEvent(fs, event):
169 pass
170 fs = FileSelectorDialog(self.wizard.window,
171 self.wizard.getAdminModel())
172 fs.connect('response', response)
173 fs.connect('delete-event', deleteEvent)
174 fs.selector.setWorkerName(self.model.worker)
175 fs.setDirectory(self.model.properties.path)
176 fs.show_all()
177
178
179
183
186
189