From: Andy Bavier Date: Thu, 10 Jun 2010 20:21:56 +0000 (-0400) Subject: Broke out PLE, PLJ, GpENI into separate tabs. For now, make as few assumptions as... X-Git-Url: http://git.onelab.eu/?p=sfa-gui.git;a=commitdiff_plain;h=743fb4d29bdf0e58bffb84b420f922c722a8d8cb Broke out PLE, PLJ, GpENI into separate tabs. For now, make as few assumptions as possible about semantics of federation --- diff --git a/GpENI.py b/GpENI.py new file mode 100644 index 0000000..43ebb89 --- /dev/null +++ b/GpENI.py @@ -0,0 +1,26 @@ +from Sink import Sink, SinkInfo +from pyjamas.ui.TabPanel import TabPanel +from pyjamas.ui.VerticalPanel import VerticalPanel +from pyjamas.ui.TextArea import TextArea +from pyjamas.ui.HTML import HTML +from SfaData import GpENIData +from NodePanel import NodePanel +from LinkPanel import LinkPanel +from SliverPanel import SliverPanel +from SubmitPanel import SubmitPanel +from HelpPanel import PlanetLabHelpPanel +from PlanetLab import PlTabs + +class GpENI(Sink): + def __init__(self): + + Sink.__init__(self) + + self.tabs = PlTabs(GpENIData()) + + self.tabs.setWidth("100%") + self.tabs.setHeight("100%") + self.initWidget(self.tabs) + +def init(): + return SinkInfo("GpENI", "Specify GpENI Resources", GpENI) diff --git a/NodePanel.py b/NodePanel.py index c4861b2..80a6bf4 100644 --- a/NodePanel.py +++ b/NodePanel.py @@ -30,10 +30,10 @@ class NodePanel(DockPanel): self.selectedRegex = None leftpanel = VerticalPanel() - leftcap = CaptionPanel("Available nodes") + self.leftcap = CaptionPanel("Available nodes") self.leftlist = ListBox(MultipleSelect=True, VisibleItemCount=20) - leftcap.add(self.leftlist) - leftpanel.add(leftcap) + self.leftcap.add(self.leftlist) + leftpanel.add(self.leftcap) hp1 = HorizontalPanel() filterButton = Button("Filter", self.filterLeft) @@ -43,10 +43,10 @@ class NodePanel(DockPanel): leftpanel.add(hp1) rightpanel = VerticalPanel() - rightcap = CaptionPanel("Selected nodes") + self.rightcap = CaptionPanel("Selected nodes") self.rightlist = ListBox(MultipleSelect=True, VisibleItemCount=20) - rightcap.add(self.rightlist) - rightpanel.add(rightcap) + self.rightcap.add(self.rightlist) + rightpanel.add(self.rightcap) hp2 = HorizontalPanel() filterButton = Button("Filter", self.filterRight) @@ -72,8 +72,10 @@ class NodePanel(DockPanel): rspec = self.sfadata.getRSpec() slivers = self.sortNodes(rspec.get_sliver_list()) + self.rightcap.setCaption("Selected nodes (%s)" % len(slivers)) all = rspec.get_node_list() available = self.sortNodes(filter(lambda x:x not in slivers,all)) + self.leftcap.setCaption("Available nodes (%s)" % len(available)) if self.availableRegex: pattern = re.compile(self.availableRegex) diff --git a/PLE.py b/PLE.py new file mode 100644 index 0000000..c72f63e --- /dev/null +++ b/PLE.py @@ -0,0 +1,26 @@ +from Sink import Sink, SinkInfo +from pyjamas.ui.TabPanel import TabPanel +from pyjamas.ui.VerticalPanel import VerticalPanel +from pyjamas.ui.TextArea import TextArea +from pyjamas.ui.HTML import HTML +from SfaData import PLEData +from NodePanel import NodePanel +from LinkPanel import LinkPanel +from SliverPanel import SliverPanel +from SubmitPanel import SubmitPanel +from HelpPanel import PlanetLabHelpPanel +from PlanetLab import PlTabs + +class PLE(Sink): + def __init__(self): + + Sink.__init__(self) + + self.tabs = PlTabs(PLEData()) + + self.tabs.setWidth("100%") + self.tabs.setHeight("100%") + self.initWidget(self.tabs) + +def init(): + return SinkInfo("PLE", "Specify PlanetLab Europe Resources", PLE) diff --git a/PLJ.py b/PLJ.py new file mode 100644 index 0000000..a9b1bbe --- /dev/null +++ b/PLJ.py @@ -0,0 +1,26 @@ +from Sink import Sink, SinkInfo +from pyjamas.ui.TabPanel import TabPanel +from pyjamas.ui.VerticalPanel import VerticalPanel +from pyjamas.ui.TextArea import TextArea +from pyjamas.ui.HTML import HTML +from SfaData import PLJData +from NodePanel import NodePanel +from LinkPanel import LinkPanel +from SliverPanel import SliverPanel +from SubmitPanel import SubmitPanel +from HelpPanel import PlanetLabHelpPanel +from PlanetLab import PlTabs + +class PLJ(Sink): + def __init__(self): + + Sink.__init__(self) + + self.tabs = PlTabs(PLJData()) + + self.tabs.setWidth("100%") + self.tabs.setHeight("100%") + self.initWidget(self.tabs) + +def init(): + return SinkInfo("PLJ", "Specify PlanetLab Japan Resources", PLJ) diff --git a/PlanetLab.py b/PlanetLab.py index b26241e..027ae14 100644 --- a/PlanetLab.py +++ b/PlanetLab.py @@ -11,10 +11,10 @@ from SubmitPanel import SubmitPanel from HelpPanel import PlanetLabHelpPanel class PlTabs(TabPanel): - def __init__(self): + def __init__(self, data): TabPanel.__init__(self) - self.data = PlanetLabData() + self.data = data self.data.refreshRSpec() nodetab = NodePanel(self.data) @@ -34,16 +34,16 @@ class PlTabs(TabPanel): tab.refresh() TabPanel.onTabSelected(self, sender, index) -class PlanetLab(Sink): +class PLC(Sink): def __init__(self): Sink.__init__(self) - self.tabs = PlTabs() + self.tabs = PlTabs(PlanetLabData()) self.tabs.setWidth("100%") self.tabs.setHeight("100%") self.initWidget(self.tabs) def init(): - return SinkInfo("PlanetLab", "Specify PlanetLab Resources", PlanetLab) + return SinkInfo("PLC", "Specify PlanetLab Central Resources", PLC) diff --git a/SfaBrowser.py b/SfaBrowser.py index fe3f4ac..30442e8 100644 --- a/SfaBrowser.py +++ b/SfaBrowser.py @@ -4,6 +4,9 @@ from pyjamas.ui.PopupPanel import PopupPanel from pyjamas.ui.HTML import HTML from SfaData import PlanetLabData +def alwaysDelegateFocus(elem): + return True + class PopupRecord(PopupPanel): def __init__(self, record): PopupPanel.__init__(self, True) @@ -13,18 +16,19 @@ class PopupRecord(PopupPanel): self.setStyleName("ks-popups-Popup") class SfaItem(TreeItem): - def __init__(self, hrn, kind): + def __init__(self, hrn, kind, truncate = True): self.kind = kind self.hrn = hrn - last = hrn.split('.')[-1] + if truncate: + hrn = hrn.split('.')[-1] if self.kind == "(authority)": - self.label = "%s" % last + self.label = "%s" % hrn elif self.kind == "(slice)": - self.label = "%s" % last + self.label = "%s" % hrn elif self.kind == "(user)": - self.label = "%s" % last + self.label = "%s" % hrn else: - self.label = "%s" % last + self.label = "%s" % hrn TreeItem.__init__(self, self.label) @@ -46,11 +50,21 @@ class SfaBrowser(Sink): self.data = PlanetLabData() self.tree = Tree() + self.tree.shouldTreeDelegateFocusToElement = alwaysDelegateFocus - item = SfaItem("plc", "(authority)") + item = SfaItem("plc", "(authority)", truncate = False) + self.tree.addItem(item) + + item = SfaItem("plc.glc", "(authority)", truncate = False) + self.tree.addItem(item) + + item = SfaItem("plc.vini", "(authority)", truncate = False) + self.tree.addItem(item) + + item = SfaItem("ple", "(authority)", truncate = False) self.tree.addItem(item) - item = SfaItem("ple", "(authority)") + item = SfaItem("plj", "(authority)", truncate = False) self.tree.addItem(item) self.tree.addTreeListener(self) @@ -67,7 +81,6 @@ class SfaBrowser(Sink): p.show() def onTreeItemStateChanged(self, item): - self.tree.moveFocus(item) child = item.getChild(0) if hasattr(child, "isPendingItem"): item.removeItem(child) diff --git a/SfaData.py b/SfaData.py index b99c56e..9100b3e 100644 --- a/SfaData.py +++ b/SfaData.py @@ -6,7 +6,7 @@ from sfa.util.rspecHelper import RSpec class SfaData: authority = "plc.princeton" user = "plc.princeton.acb" - slice = "plc.princeton.iias" + slice = "plc.princeton.sapan" def __init__(self): self.registry = None @@ -73,11 +73,11 @@ class SfaData: "-r", self.registry, "-s", self.slicemgr, "create", slice, filename]) -class ViniData(SfaData): +class PlanetLabData(SfaData): def __init__(self): SfaData.__init__(self) self.registry = "http://www.planet-lab.org:12345" - self.slicemgr = "http://www.vini-veritas.net:12346" + self.slicemgr = "http://www.planet-lab.org:12346" self.rspec = None def refreshRSpec(self): @@ -93,25 +93,25 @@ class ViniData(SfaData): xml = self.rspec.toxml() SfaData.applyRSpec(self, xml) -class PlanetLabData(SfaData): +class PLEData(PlanetLabData): def __init__(self): - SfaData.__init__(self) - self.registry = "http://www.planet-lab.org:12345" - self.slicemgr = "http://www.planet-lab.org:12346" - self.rspec = None + PlanetLabData.__init__(self) + self.slicemgr = "http://www.planet-lab.eu:12346" - def refreshRSpec(self): - xml = SfaData.getRSpec(self) - self.rspec = RSpec(xml) +class PLJData(PlanetLabData): + def __init__(self): + PlanetLabData.__init__(self) + self.slicemgr = "http://www.planet-lab.jp:12346" - def getRSpec(self): - if self.rspec is None: - self.refreshRSpec() - return self.rspec - - def applyRSpec(self): - xml = self.rspec.toxml() - SfaData.applyRSpec(self, xml) +class ViniData(PlanetLabData): + def __init__(self): + PlanetLabData.__init__(self) + self.slicemgr = "http://www.vini-veritas.net:12346" + +class GpENIData(PlanetLabData): + def __init__(self): + PlanetLabData.__init__(self) + self.slicemgr = "http://198.248.241.100:12346" class OpenCirrusData(SfaData): def __init__(self): diff --git a/SfaGUI.py b/SfaGUI.py index 11f9a32..09f0333 100644 --- a/SfaGUI.py +++ b/SfaGUI.py @@ -15,6 +15,9 @@ import Welcome import Slices import Identities import PlanetLab +import PLE +import PLJ +import GpENI import VINI import OpenCirrus import SfaBrowser @@ -93,6 +96,9 @@ class SfaGUI: #self.sink_list.addSink(Identities.init()) # self.sink_list.addSink(Slices.init()) self.sink_list.addSink(PlanetLab.init()) + self.sink_list.addSink(PLE.init()) + self.sink_list.addSink(PLJ.init()) + self.sink_list.addSink(GpENI.init()) self.sink_list.addSink(VINI.init()) #self.sink_list.addSink(OpenCirrus.init()) self.sink_list.addSink(SfaBrowser.init())