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