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