| 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,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 from gettext import gettext as _
19
20 import gtk
21 from flumotion.common import enum
22 from flumotion.component.base.admin_gtk import BaseAdminGtk
23 from flumotion.component.base.baseadminnode import BaseAdminGtkNode
24 from flumotion.ui import fgtk
25
26 __version__ = "$Rev$"
27
28
29 VideoTestPattern = enum.EnumClass(
30 'VideoTestPattern',
31 ['Bars', 'Snow', 'Black', 'White', 'Red', 'Green', 'Blue', 'Checkers-1',
32 'Checkers-2', 'Checkers-4', 'Checkers-8', 'Circular', 'Blink',
33 'Bars 75%', 'Zone-plate'],
34 [_('SMPTE 100% color bars'),
35 _('Random (television snow)'),
36 _('100% Black'),
37 _('100% White'),
38 _('100% Red'),
39 _('100% Green'),
40 _('100% Blue'),
41 _('Checkers 1px'),
42 _('Checkers 2px'),
43 _('Checkers 4px'),
44 _('Checkers 8px'),
45 _('Circular'),
46 _('Blink'),
47 _('SMPTE 75% color bars'),
48 _('Zone plate')])
49
50
52 uiStateHandlers = None
53
55 # FIXME: gladify
56 self.widget = gtk.Table(1, 2)
57 label = gtk.Label(_("Pattern:"))
58 self.widget.attach(label, 0, 1, 0, 1, 0, 0, 6, 6)
59 label.show()
60 self.combobox_pattern = fgtk.FProxyComboBox()
61 self.combobox_pattern.set_enum(VideoTestPattern)
62 self.pattern_changed_id = self.combobox_pattern.connect('changed',
63 self.cb_pattern_changed)
64 self.widget.attach(self.combobox_pattern, 1, 2, 0, 1, 0, 0, 6, 6)
65 self.combobox_pattern.show()
66 return BaseAdminGtkNode.render(self)
67
69 BaseAdminGtkNode.setUIState(self, state)
70 if not self.uiStateHandlers:
71 self.uiStateHandlers = {'pattern': self.patternSet}
72 for k, handler in self.uiStateHandlers.items():
73 handler(state.get(k))
74
76
77 def _setPatternErrback(failure):
78 self.warning("Failure %s setting pattern: %s" % (
79 failure.type, failure.getErrorMessage()))
80 return None
81
82 pattern = combobox.get_active()
83 d = self.callRemote("setPattern", pattern)
84 d.addErrback(_setPatternErrback)
85
87 self.debug("pattern changed to %r" % value)
88 c = self.combobox_pattern
89 hid = self.pattern_changed_id
90 c.handler_block(hid)
91 c.set_active(value)
92 c.handler_unblock(hid)
93
98
99
101
103 # FIXME: have constructor take self instead ?
104 pattern = PatternNode(self.state, self.admin, title=_("Pattern"))
105 self.nodes['Pattern'] = pattern
106 return BaseAdminGtk.setup(self)
107
108 GUIClass = VideoTestAdminGtk
109
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Mon May 11 00:19:44 2015 | http://epydoc.sourceforge.net |