From: Thierry Parmentelat Date: Thu, 8 Sep 2011 13:18:58 +0000 (+0200) Subject: avoid sending a 'resources' after 'create', use the result of 'create' X-Git-Tag: sface-0.1-19~11 X-Git-Url: http://git.onelab.eu/?p=sface.git;a=commitdiff_plain;h=312ec1d8972acfdd51b2bc6c26ba7f89b6096303 avoid sending a 'resources' after 'create', use the result of 'create' instead cosmetic tweaks in the config screen --- diff --git a/sface/screens/configscreen.py b/sface/screens/configscreen.py index 37db423..3c716ce 100644 --- a/sface/screens/configscreen.py +++ b/sface/screens/configscreen.py @@ -73,28 +73,29 @@ class ConfigWidget(QWidget): row += 1 hlayout = QHBoxLayout() - hlayout.addStretch() - def conf_button (action,label): + def bottom_button (action,label,align): button=QPushButton(label, self) button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) - hlayout.addWidget(button) + hlayout.addWidget(button,0,align) hlayout.addSpacing(10) self.connect(button, SIGNAL('clicked()'), getattr(self,action)) - conf_button ('load','Load Conf. Dir') + bottom_button ('load','Load Config Dir',Qt.AlignLeft) # the config dir edit dialog - edit=QLineEdit (config.get_dirname(),self) - self.store_local('config_dirname',edit) - edit.setAttribute(Qt.WA_MacShowFocusRect, 0) - edit.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Maximum) - self.connect(edit,SIGNAL ('returnPressed()'), self.load) - hlayout.addWidget (edit) + confdir=QLineEdit (config.get_dirname(),self) + self.store_local('config_dirname',confdir) + confdir.setAttribute(Qt.WA_MacShowFocusRect, 0) + confdir.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Maximum) + confdir.setStyleSheet("QLineEdit { width: 200px; }") + self.connect(confdir,SIGNAL ('returnPressed()'), self.load) + hlayout.addWidget (confdir,0,Qt.AlignLeft) hlayout.addSpacing(10) - conf_button ('createSlice', 'Create New Slice'), - conf_button ('apply','Apply Only'), - conf_button ('save','Apply && Save') + hlayout.addStretch() + bottom_button ('createSlice', 'Create New Slice', Qt.AlignRight), + bottom_button ('apply','Apply Only',Qt.AlignRight), + bottom_button ('save','Apply && Save',Qt.AlignRight) layout = QVBoxLayout() layout.addLayout(glayout) @@ -111,7 +112,6 @@ class ConfigWidget(QWidget): self.save() def apply(self): - print 'applying' for field in config.fields(): widget=getattr(self,field) if isinstance(widget,QCheckBox): diff --git a/sface/screens/mainscreen.py b/sface/screens/mainscreen.py index 5578fbc..90f8df1 100644 --- a/sface/screens/mainscreen.py +++ b/sface/screens/mainscreen.py @@ -358,7 +358,10 @@ class SliceWidget(QWidget): def submitFinished(self): self.setStatus("Slice data submitted.") - QTimer.singleShot(1000, self.refresh) + # no need to do that anymore + # QTimer.singleShot(1000, self.refresh) + self.updateView() + self.parent().signalAll("rspecUpdated") def refreshFinished(self): self.setStatus("Slice data refreshed.", timeout=5000) @@ -475,7 +478,7 @@ class SliceWidget(QWidget): self.disconnect(self.process, SIGNAL('finished()'), self.submitFinished) self.connect(self.process, SIGNAL('finished()'), self.refreshFinished) - self.process.getRSpecFromSM() + self.process.retrieveRspec() self.setStatus("Refreshing slice data. This will take some time...") def updateView(self): diff --git a/sface/sfiprocess.py b/sface/sfiprocess.py index 34608de..108530c 100644 --- a/sface/sfiprocess.py +++ b/sface/sfiprocess.py @@ -103,9 +103,10 @@ class SfiProcess(QObject): return self.faults[0].get("faultString","") + " (" + self.faults[0].get("faultCode","") + ")" - def __getRSpec(self, mgr): + def retrieveRspec(self): slice = config.getSlice() - # Write RSpec to file for testing. + mgr = config.getSlicemgr() + # Write RSpec to file filename = config.fullpath ("%s.rspec"%slice) try: os.remove(filename) @@ -119,11 +120,6 @@ class SfiProcess(QObject): self.start() return filename - def getRSpecFromSM(self): - return self.__getRSpec(config.getSlicemgr()) - -# def getRSpecFromAM(self): -# return self.__getRSpec(config.getAggmgr()) def listRecords(self, hrn, rectype=None, filename=None): args = ["-u", config.getUser(), "-a", config.getAuthority(), @@ -162,14 +158,18 @@ class SfiProcess(QObject): self.getRecord(config.getAuthority(), config.getAuthorityRecordFile()) def applyRSpec(self, rspec): - filename = config.getSliceRSpecFile() + "_new" - rspec.save(filename) + # that's what we pass, like in what we'd like to get + requested = config.getSliceRSpecFile() + "_new" + # that's what we actually receive + # just overwrite the slice file as if we'd used 'resources' + obtained = config.getSliceRSpecFile() + rspec.save(requested) args = ["-u", config.getUser(), "-a", config.getAuthority(), "-r", config.getRegistry(), "-s", config.getSlicemgr(), "create", - config.getSlice(), filename] + "-o", obtained, + config.getSlice(), requested] self.__init_command(args) self.start() - return filename def updateRecord(self, filename): args = ["-u", config.getUser(), "-a", config.getAuthority(),