Package flumotion :: Package component :: Package consumers :: Package fgdp :: Module wizard_gtk
[hide private]

Source Code for Module flumotion.component.consumers.fgdp.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  from zope.interface import implements 
 21   
 22  from flumotion.admin.assistant.interfaces import IConsumerPlugin 
 23  from flumotion.admin.assistant.models import Consumer 
 24  from flumotion.admin.gtk.basesteps import ConsumerStep 
 25   
 26  __version__ = "$Rev$" 
 27  _ = gettext.gettext 
 28   
 29   
30 -class FGDPConsumer(Consumer):
31 componentType = 'fgdp-consumer' 32 prefix = 'fgdp' 33
34 - def __init__(self):
35 super(FGDPConsumer, self).__init__() 36 self.properties.host = '127.0.0.1' 37 self.properties.port = 15000 38 self.properties.username = 'user' 39 self.properties.password = 'test'
40 41
42 -class FGDPStep(ConsumerStep):
43 gladeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 44 'wizard.glade') 45
46 - def __init__(self, wizard):
47 self.model = FGDPConsumer() 48 ConsumerStep.__init__(self, wizard)
49 50 # ConsumerStep 51
52 - def getConsumerModel(self):
53 return self.model
54 55 # WizardStep 56
57 - def setup(self):
58 self.host.data_type = str 59 self.port.data_type = int 60 self.username.data_type = str 61 self.password.data_type = str 62 63 self.add_proxy(self.model.properties, 64 ['host', 65 'port', 66 'username', 67 'password'])
68
69 - def workerChanged(self, worker):
70 self.model.worker = worker 71 self.wizard.checkElements(worker, 'fgdpsend')
72 73
74 -class FGDPBothStep(FGDPStep):
75 name = 'Flumotion streamer (audio & video)' 76 title = _('Flumotion Streamer (Audio and Video)') 77 sidebarName = _('Audio/video FGDP') 78 docSection = 'help-configuration-assistant-fgdp-streaming-both' 79 docAnchor = '' 80 docVersion = 'local' 81 82 # ConsumerStep 83
84 - def getConsumerType(self):
85 return 'audio-video'
86 87
88 -class FGDPAudioStep(FGDPStep):
89 name = 'FGDP streamer (audio only)' 90 title = _('FGDP Streamer (Audio Only)') 91 sidebarName = _('Audio FGDP') 92 docSection = 'help-configuration-assistant-fgdp-streaming-audio-only' 93 docAnchor = '' 94 docVersion = 'local' 95 96 # ConsumerStep 97
98 - def getConsumerType(self):
99 return 'audio'
100 101
102 -class FGDPVideoStep(FGDPStep):
103 name = 'Flumotion streamer (video only)' 104 title = _('Flumotion Streamer (Video Only)') 105 sidebarName = _('Video FGDP') 106 docSection = 'help-configuration-assistant-fgdp-streaming-video-only' 107 docAnchor = '' 108 docVersion = 'local' 109 110 # ConsumerStep 111
112 - def getConsumerType(self):
113 return 'video'
114 115
116 -class FGDPConsumerWizardPlugin(object):
117 implements(IConsumerPlugin) 118
119 - def __init__(self, wizard):
120 self.wizard = wizard
121
122 - def getConsumptionStep(self, type):
123 if type == 'video': 124 return FGDPVideoStep(self.wizard) 125 elif type == 'audio': 126 return FGDPAudioStep(self.wizard) 127 elif type == 'audio-video': 128 return FGDPBothStep(self.wizard)
129