X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Frspecwindow.py;fp=sface%2Frspecwindow.py;h=19c535f291041109e695e80cad14fb4392e46c77;hp=7c6f061bd20ee7a4cf5837a96882d6ed14e3d759;hb=dc5a4a16b0819bc27efd1f77d632a76463db82c0;hpb=16876384173c217448f977faac6daa95702aea58 diff --git a/sface/rspecwindow.py b/sface/rspecwindow.py index 7c6f061..19c535f 100644 --- a/sface/rspecwindow.py +++ b/sface/rspecwindow.py @@ -8,6 +8,7 @@ from PyQt4.QtXml import * from sface.xmlwidget import * from sface.config import config from sface.screens.sfascreen import SfaScreen +from sface.sfidata import SfiData class RSpecView(XmlView): @@ -36,7 +37,7 @@ class RSpecView(XmlView): for r in range(rows): child_index = index.child(r, 0) search(child_index) - + root_rows = model.rowCount() for r in range(root_rows): index = model.index(r, 0) @@ -52,11 +53,28 @@ class RSpecWindow(XmlWindow): def showNode(self, hostname): self.view.expandMatchingText(hostname) - def updateView(self): - XmlWindow.updateView(self) + def readContent(self): + rspec = SfiData().getSliceRSpec() + if not rspec: + return "" + + return rspec.toxml() + +class ResourcesWindow(XmlWindow): + def __init__(self, parent=None): + XmlWindow.__init__(self, parent, 'Resources Window') + + def initView(self): + return RSpecView(self) + + def showNode(self, hostname): + self.view.expandMatchingText(hostname) + + def readContent(self): + rspec = SfiData().getResourcesRSpec() + if not rspec: + return "" + + return rspec.toxml() - rspec_file = config.getSliceRSpecFile() - if not os.path.exists(rspec_file): - return - self.document.setContent(open(rspec_file,'r').read())