1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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: 8413 $"
31
32
33 VideoTestPattern = enum.EnumClass(
34 'VideoTestPattern',
35 ['Bars', 'Snow', 'Black', 'White', 'Red', 'Green', 'Blue', 'Checkers-1',
36 'Checkers-2', 'Checkers-4', 'Checkers-8', 'Circular', 'Blink',
37 'Bars 75%', 'Zone-plate'],
38 [_('SMPTE 100% color bars'),
39 _('Random (television snow)'),
40 _('100% Black'),
41 _('100% White'),
42 _('100% Red'),
43 _('100% Green'),
44 _('100% Blue'),
45 _('Checkers 1px'),
46 _('Checkers 2px'),
47 _('Checkers 4px'),
48 _('Checkers 8px'),
49 _('Circular'),
50 _('Blink'),
51 _('SMPTE 75% color bars'),
52 _('Zone plate')])
53
54
56 uiStateHandlers = None
57
59
60 self.widget = gtk.Table(1, 2)
61 label = gtk.Label(_("Pattern:"))
62 self.widget.attach(label, 0, 1, 0, 1, 0, 0, 6, 6)
63 label.show()
64 self.combobox_pattern = fgtk.FProxyComboBox()
65 self.combobox_pattern.set_enum(VideoTestPattern)
66 self.pattern_changed_id = self.combobox_pattern.connect('changed',
67 self.cb_pattern_changed)
68 self.widget.attach(self.combobox_pattern, 1, 2, 0, 1, 0, 0, 6, 6)
69 self.combobox_pattern.show()
70 return BaseAdminGtkNode.render(self)
71
78
80
81 def _setPatternErrback(failure):
82 self.warning("Failure %s setting pattern: %s" % (
83 failure.type, failure.getErrorMessage()))
84 return None
85
86 pattern = combobox.get_active()
87 d = self.callRemote("setPattern", pattern)
88 d.addErrback(_setPatternErrback)
89
91 self.debug("pattern changed to %r" % value)
92 c = self.combobox_pattern
93 hid = self.pattern_changed_id
94 c.handler_block(hid)
95 c.set_active(value)
96 c.handler_unblock(hid)
97
102
103
111
112 GUIClass = VideoTestAdminGtk
113