| Trees | Indices | Help |
|---|
|
|
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 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 from gettext import gettext as _
23
24 import gtk
25 from flumotion.common import enum
26 from flumotion.component.base.admin_gtk import BaseAdminGtk
27 from flumotion.component.base.baseadminnode import BaseAdminGtkNode
28 from flumotion.ui import fgtk
29
30 __version__ = "$Rev: 7162 $"
31
32
33 VideoTestPattern = enum.EnumClass(
34 'VideoTestPattern',
35 ['Bars', 'Snow', 'Black'],
36 [_('SMPTE Color bars'),
37 _('Random (television snow)'),
38 _('Totally black')])
39
40
42 uiStateHandlers = None
43
45 # FIXME: gladify
46 self.widget = gtk.Table(1, 2)
47 label = gtk.Label(_("Pattern:"))
48 self.widget.attach(label, 0, 1, 0, 1, 0, 0, 6, 6)
49 label.show()
50 self.combobox_pattern = fgtk.FProxyComboBox()
51 self.combobox_pattern.set_enum(VideoTestPattern)
52 self.pattern_changed_id = self.combobox_pattern.connect('changed',
53 self.cb_pattern_changed)
54 self.widget.attach(self.combobox_pattern, 1, 2, 0, 1, 0, 0, 6, 6)
55 self.combobox_pattern.show()
56 return BaseAdminGtkNode.render(self)
57
59 BaseAdminGtkNode.setUIState(self, state)
60 if not self.uiStateHandlers:
61 self.uiStateHandlers = {'pattern': self.patternSet}
62 for k, handler in self.uiStateHandlers.items():
63 handler(state.get(k))
64
66
67 def _setPatternErrback(failure):
68 self.warning("Failure %s setting pattern: %s" % (
69 failure.type, failure.getErrorMessage()))
70 return None
71
72 pattern = combobox.get_active()
73 d = self.callRemote("setPattern", pattern)
74 d.addErrback(_setPatternErrback)
75
77 self.debug("pattern changed to %r" % value)
78 c = self.combobox_pattern
79 hid = self.pattern_changed_id
80 c.handler_block(hid)
81 c.set_active(value)
82 c.handler_unblock(hid)
83
88
89
91
93 # FIXME: have constructor take self instead ?
94 pattern = PatternNode(self.state, self.admin, title=_("Pattern"))
95 self.nodes['Pattern'] = pattern
96 return BaseAdminGtk.setup(self)
97
98 GUIClass = VideoTestAdminGtk
99
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sun Sep 13 13:20:22 2009 | http://epydoc.sourceforge.net |