Read ~/.sfi/sfi_config
[sfa-gui.git] / PlanetLab.py
1 from Sink import Sink, SinkInfo
2 from pyjamas.ui.TabPanel import TabPanel
3 from pyjamas.ui.VerticalPanel import VerticalPanel
4 from pyjamas.ui.TextArea import TextArea
5 from pyjamas.ui.HTML import HTML
6 from SfaData import PlanetLabData
7 from NodePanel import NodePanel
8 from LinkPanel import LinkPanel
9 from SliverPanel import SliverPanel
10 from SubmitPanel import SubmitPanel
11 from HelpPanel import PlanetLabHelpPanel
12
13 class PlTabs(TabPanel):
14     def __init__(self, data):
15         TabPanel.__init__(self)
16
17         self.data = data
18         self.data.refreshRSpec()
19
20         nodetab = NodePanel(self.data)
21         slivertab = SliverPanel(self.data)
22         submittab = SubmitPanel(self.data)
23         helptab = PlanetLabHelpPanel()
24
25         self.add(nodetab, "Nodes")
26         self.add(slivertab, "Slivers")
27         self.add(submittab, "Submit")
28         self.add(HTML("force tabs to right"), None)
29         self.add(helptab, "Help")
30         self.selectTab(0)
31
32     def onTabSelected(self, sender, index):
33         tab = self.getWidget(index)
34         tab.refresh()
35         TabPanel.onTabSelected(self, sender, index)
36
37 class PLC(Sink):
38     def __init__(self):
39
40         Sink.__init__(self)
41         
42         self.tabs = PlTabs(PlanetLabData())
43
44         self.tabs.setWidth("100%")
45         self.tabs.setHeight("100%")
46         self.initWidget(self.tabs)
47
48 def init():
49     return SinkInfo("PlanetLab", "Specify PlanetLab Central Resources", PLC)