1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import os
23 import gtk
24
25 from flumotion.common import errors
26
27 from flumotion.component.base.admin_gtk import BaseAdminGtk
28 from flumotion.component.base.baseadminnode import BaseAdminGtkNode
29
30 __version__ = "$Rev$"
31
32
34
35 - def __init__(self, state, admin, title=None):
36 BaseAdminGtkNode.__init__(self, state, admin, title)
37
38 self.widget = gtk.Table(2, 1)
39 self.radioButton = {}
40 self.radioButton["backup"] = gtk.RadioButton(label="Backup")
41 self.radioButton["master"] = gtk.RadioButton(
42 self.radioButton["backup"],
43 label="Master")
44 self.radioButtonHandlers = {}
45 currentRow = 0
46 for eaterName in self.radioButton:
47 self.widget.attach(self.radioButton[eaterName], 0, 1, currentRow,
48 currentRow+1, yoptions=gtk.FILL, xpadding=6, ypadding=6)
49 currentRow = currentRow + 1
50 self.radioButton[eaterName].show()
51 sigID = self.radioButton[eaterName].connect(
52 "toggled", self.cb_toggled, eaterName)
53 self.radioButtonHandlers[eaterName] = sigID
54 self.widget.show()
55
57 if button.get_active():
58 if eaterName == "master":
59 self.callRemote("switchToMaster")
60 else:
61 self.callRemote("switchToBackup")
62
66
68 if key == 'active-eater':
69 if not self.radioButton[value].get_active():
70 self.radioButton[value].handler_block(
71 self.radioButtonHandlers[value])
72 self.radioButton[value].set_active(True)
73 self.radioButton[value].handler_unblock(
74 self.radioButtonHandlers[value])
75
76
83
84 GUIClass = SwitcherAdminGtk
85