1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import gettext
23
24 from flumotion.common.python import any as pany
25 from flumotion.configure import configure
26 from flumotion.ui.wizard import WizardStep
27 from flumotion.wizard.httpstreamersteps import HTTPBothStep, HTTPAudioStep, \
28 HTTPVideoStep
29 from flumotion.wizard.diskersteps import DiskBothStep, DiskAudioStep, \
30 DiskVideoStep
31 from flumotion.wizard.models import Porter
32 from flumotion.wizard.shout2steps import Shout2BothStep, Shout2AudioStep, \
33 Shout2VideoStep
34 from flumotion.wizard.workerstep import WorkerWizardStep
35
36 __version__ = "$Rev: 7087 $"
37 _ = gettext.gettext
38
39
42 self.has_client_limit = False
43 self.has_bandwidth_limit = False
44 self.client_limit = 1000
45 self.bandwidth_limit = 500.0
46 self.burst_on_connect = False
47
48
50 name = 'Consumption'
51 title = _('Consumption')
52 section = _('Consumption')
53 icon = 'consumption.png'
54 gladeFile = 'consumption-wizard.glade'
55
61
62
63
65 return self._httpCommon
66
68 return self._httpPorter
69
70
71
73 has_audio = self.wizard.hasAudio()
74 has_video = self.wizard.hasVideo()
75 has_both = has_audio and has_video
76
77
78 for checkbutton in (self.http_audio_video,
79 self.http_audio,
80 self.http_video,
81 self.disk_audio_video,
82 self.disk_audio,
83 self.disk_video,
84 self.shout2_audio_video,
85 self.shout2_audio,
86 self.shout2_video):
87 checkbutton.set_property('visible', has_both)
88
90 steps = self._getSteps()
91 assert steps
92
93 if step is None:
94 step_class = steps[0]
95 else:
96 step_class = step.__class__
97 if step_class in steps and steps[-1] != step_class:
98 step_class = steps[steps.index(step_class)+1]
99 else:
100 return
101
102 return step_class(self.wizard)
103
104
105
107 disk = self.disk.get_active()
108 disk_audio = self.disk_audio.get_active()
109 disk_video = self.disk_video.get_active()
110 disk_audio_video = self.disk_audio_video.get_active()
111 http = self.http.get_active()
112 http_audio = self.http_audio.get_active()
113 http_video = self.http_video.get_active()
114 http_audio_video = self.http_audio_video.get_active()
115 shout2 = self.shout2.get_active()
116 shout2_audio = self.shout2_audio.get_active()
117 shout2_video = self.shout2_video.get_active()
118 shout2_audio_video = self.shout2_audio_video.get_active()
119
120 blockNext = True
121 if ((disk and pany([disk_audio, disk_video, disk_audio_video])) or
122 (http and pany([http_audio, http_video, http_audio_video])) or
123 (shout2 and pany([shout2_audio, shout2_video, shout2_audio_video]))):
124 blockNext = False
125 self.wizard.blockNext(blockNext)
126
128 uielements = []
129 retval = []
130 if self.http.get_active():
131 retval.append(HTTPConsumptionStep)
132 uielements.append(
133 ([HTTPAudioStep, HTTPVideoStep, HTTPBothStep],
134 [self.http_audio,
135 self.http_video,
136 self.http_audio_video]))
137 if self.disk.get_active():
138 uielements.append(
139 ([DiskAudioStep, DiskVideoStep, DiskBothStep],
140 [self.disk_audio,
141 self.disk_video,
142 self.disk_audio_video]))
143 if self.shout2.get_active():
144 uielements.append(
145 ([Shout2AudioStep, Shout2VideoStep, Shout2BothStep],
146 [self.shout2_audio,
147 self.shout2_video,
148 self.shout2_audio_video]))
149
150 has_audio = self.wizard.hasAudio()
151 has_video = self.wizard.hasVideo()
152
153 for steps, (audio, video, audio_video) in uielements:
154
155
156 if has_audio and has_video:
157 enable_audio_video = audio_video.get_active()
158 enable_audio = audio.get_active()
159 enable_video = video.get_active()
160
161
162
163 elif has_audio and not has_video:
164 enable_audio_video = False
165 enable_audio = True
166 enable_video = False
167
168 elif has_video and not has_audio:
169 enable_audio_video = False
170 enable_audio = False
171 enable_video = True
172 else:
173 raise AssertionError
174
175 audio_step, video_step, audio_video_step = steps
176 if enable_audio_video:
177 retval.append(audio_video_step)
178 if enable_audio:
179 retval.append(audio_step)
180 if enable_video:
181 retval.append(video_step)
182
183 return retval
184
185
186
188 value = self.disk.get_active()
189 self.disk_audio_video.set_sensitive(value)
190 self.disk_audio.set_sensitive(value)
191 self.disk_video.set_sensitive(value)
192
193 self._verify()
194
196 value = self.shout2.get_active()
197 self.shout2_audio_video.set_sensitive(value)
198 self.shout2_audio.set_sensitive(value)
199 self.shout2_video.set_sensitive(value)
200
201 self._verify()
202
205
208
211
213 value = self.http.get_active()
214 self.http_audio_video.set_sensitive(value)
215 self.http_audio.set_sensitive(value)
216 self.http_video.set_sensitive(value)
217
218 self._verify()
219
220
222 """I am a step of the configuration wizard which allows you
223 to configure the common http properties of a stream
224 """
225 name = 'HTTPStreaming'
226 title = _('HTTP Streaming')
227 section = _('Consumption')
228 icon = 'consumption.png'
229 gladeFile = 'http-wizard.glade'
230
236
237
238
240 self.bandwidth_limit.data_type = float
241 self.burst_on_connect.data_type = bool
242 self.client_limit.data_type = int
243 self.port.data_type = int
244
245 self.add_proxy(self.porter.properties, ['port'])
246 self.add_proxy(self.common, ['has_client_limit',
247 'has_bandwidth_limit',
248 'client_limit',
249 'bandwidth_limit',
250 'burst_on_connect'])
251
254
257
260
261
262
264 self.client_limit.set_sensitive(
265 self.has_client_limit.get_active())
266 self.bandwidth_limit.set_sensitive(
267 self.has_bandwidth_limit.get_active())
268
269
270
273
276