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

Source Code for Module flumotion.component.producers.videotest.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) 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  import gettext 
 23  import os 
 24   
 25  import gtk 
 26  from zope.interface import implements 
 27   
 28  from flumotion.admin.assistant.interfaces import IProducerPlugin 
 29  from flumotion.admin.assistant.models import VideoProducer 
 30  from flumotion.admin.gtk.basesteps import VideoProducerStep 
 31  from flumotion.configure import configure 
 32   
 33  __version__ = "$Rev: 8456 $" 
 34  _ = gettext.gettext 
 35   
 36   
37 -class TestVideoProducer(VideoProducer):
38 componentType = 'videotest-producer' 39
40 - def __init__(self):
41 super(TestVideoProducer, self).__init__() 42 43 self.properties.pattern = 0
44 45
46 -class TestVideoProducerStep(VideoProducerStep):
47 name = 'Test Video Producer' 48 title = _('Test Video Producer') 49 icon = 'testsource.png' 50 gladeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 51 'wizard.glade') 52 componentType = 'videotestsrc' 53 docSection = 'help-configuration-assistant-producer-video-test' 54 docAnchor = '' 55 docVersion = 'local' 56 57 # WizardStep 58
59 - def setup(self):
60 self.pattern.data_type = int 61 self.framerate.data_type = float 62 63 patterns = [('SMPTE Color bars', 0, 'pattern_smpte.png'), 64 ('Random (television snow)', 1, 'pattern_snow.png'), 65 ('100% Black', 2, 'pattern_black.png'), 66 ('Blink', 12, 'pattern_blink.png')] 67 self.pattern_icons = dict() 68 69 for description, id, image in patterns: 70 self.pattern.append_item(_(description), id) 71 if image: 72 self.pattern_icons[id] = os.path.join(configure.imagedir, 73 'wizard', image) 74 75 self.pattern.connect('changed', self._change_image) 76 77 self.add_proxy(self.model.properties, 78 ['pattern', 'width', 'height', 79 'framerate']) 80 81 sizegroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) 82 sizegroup.add_widget(self.width) 83 sizegroup.add_widget(self.height) 84 sizegroup.add_widget(self.framerate)
85
86 - def workerChanged(self, worker):
87 self.model.worker = worker 88 self.wizard.requireElements(worker, 'videotestsrc', 'level')
89
90 - def _change_image(self, combo):
91 self.pattern_image.set_from_file( 92 self.pattern_icons.get(combo.get_selected_data(), None))
93 94
95 -class VideoTestWizardPlugin(object):
96 implements(IProducerPlugin) 97
98 - def __init__(self, wizard):
99 self.wizard = wizard 100 self.model = TestVideoProducer()
101
102 - def getProductionStep(self, type):
103 return TestVideoProducerStep(self.wizard, self.model)
104