Package flumotion :: Package component :: Package producers :: Package audiotest :: Module wizard_gtk
[hide private]

Source Code for Module flumotion.component.producers.audiotest.wizard_gtk

 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  import gettext 
19  import os 
20   
21  from zope.interface import implements 
22   
23  from flumotion.admin.assistant.interfaces import IProducerPlugin 
24  from flumotion.admin.assistant.models import AudioProducer 
25  from flumotion.admin.gtk.basesteps import AudioProducerStep 
26   
27  __version__ = "$Rev$" 
28  _ = gettext.gettext 
29   
30   
31 -class TestAudioProducer(AudioProducer):
32 componentType = 'audiotest-producer' 33
34 - def __init__(self):
35 super(TestAudioProducer, self).__init__() 36 37 self.properties.samplerate = '44100'
38 39
40 -class TestAudioProducerStep(AudioProducerStep):
41 name = 'TestAudioProducer' 42 title = _('Test Audio Producer') 43 icon = 'soundcard.png' 44 gladeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 45 'wizard.glade') 46 docSection = 'help-configuration-assistant-producer-audio-test' 47 docAnchor = '' 48 docVersion = 'local' 49 50 # WizardStep 51
52 - def setup(self):
53 self.samplerate.data_type = str 54 self.volume.data_type = float 55 self.wave.data_type = int 56 57 self.samplerate.prefill(['8000', 58 '16000', 59 '32000', 60 '44100']) 61 62 self.wave.prefill([(_('Sine'), 0), 63 (_('Square'), 1), 64 (_('Saw'), 2), 65 (_('Ticks'), 8)]) 66 67 self.add_proxy(self.model.properties, 68 ['frequency', 'volume', 'samplerate', 'wave']) 69 70 self.samplerate.set_sensitive(True)
71
72 - def workerChanged(self, worker):
73 self.model.worker = worker 74 self.wizard.requireElements(worker, 'audiotestsrc')
75
76 - def getNext(self):
77 return None
78 79
80 -class AudioTestWizardPlugin(object):
81 implements(IProducerPlugin) 82
83 - def __init__(self, wizard):
84 self.wizard = wizard 85 self.model = TestAudioProducer()
86
87 - def getProductionStep(self, type):
88 return TestAudioProducerStep(self.wizard, self.model)
89