1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
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
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
107
108 GUIClass = VideoTestAdminGtk
109