config.setUser("%s" % self.user.text())
config.setSlice("%s" % self.slice.text())
config.save_config()
- self.parent().setStatus("<font color='green'>Configuration saved!</font>")
+ self.parent().setStatus("<font color='green'>Configuration saved!</font>", timeout=3000)
class ConfigScreen(SfaScreen):
self.updateView()
def submit(self):
- self.parent().setStatus("TODO: Submit not implemented yet!")
+ self.parent().setStatus("TODO: Submit not implemented yet!", 3000)
def readSliceRSpec(self):
- rspec_file = os.path.expanduser("~/.sfi/%s.rspec" % config.getSlice())
+ rspec_file = config.getSliceRSpecFile()
xml = open(rspec_file).read()
return xml
def refresh(self, link=None):
if not config.getSlice():
- self.parent().setStatus("<font color='red'>Slice not set yet!</font>")
+ self.parent().setStatus("<font color='red'>Slice not set yet!</font>", timeout=None)
return
self.process = SfiProcess()
outfile = self.process.getRSpecFromSM()
- self.parent().setStatus("Updating slice data. This may take some time...")
+ self.parent().setStatus("Updating slice data. This may take some time...", timeout=None)
self.connect(self.process, SIGNAL('finished()'), self.refreshFinished)
def refreshFinished(self):
del self.process
- self.parent().setStatus("<font color='green'>Slice data updated.</font>")
+ self.parent().setStatus("<font color='green'>Slice data updated.</font>", timeout=5000)
self.updateView()
def updateView(self):
def getTitleText(self):
return "<b>%s</b>" % self.title
- def setStatus(self, msg):
- self.mainwin.setStatus(msg)
+ def setStatus(self, msg, timeout):
+ self.mainwin.setStatus(msg, timeout)
+import os
+import time
+
from PyQt4.QtCore import *
from PyQt4.QtGui import *
+from sface.sficonfig import config
from sface.screens.configscreen import ConfigScreen
from sface.screens.mainscreen import MainScreen
def __init__(self, parent=None):
QLabel.__init__(self, "", parent)
- def set(self, msg):
+ def set(self, msg, timeout):
self.setText(msg)
- QTimer.singleShot(3000, self, SLOT("clear()"))
+ if timeout:
+ QTimer.singleShot(timeout, self, SLOT("clear()"))
+
+ def sliceUpdateDate(self):
+ rspec_file = config.getSliceRSpecFile()
+ creation_time = os.stat(rspec_file).st_ctime
+ last_update = time.ctime(creation_time)
+ self.set(last_update, timeout=None)
def clear(self):
- self.setText("")
+# self.setText("")
+ self.sliceUpdateDate()
class SfaWindow(QWidget):
self.nav.setLink(self.config_screen.getLinkText())
self.nav.setTitle(self.main_screen.getTitleText())
- def setStatus(self, msg):
- self.status.set(msg)
+ def setStatus(self, msg, timeout):
+ self.status.set(msg, timeout)
def aggmgr(self):
return SfiConfig.SFI_AM
+ def getSliceRSpecFile(self):
+ return os.path.expanduser("~/.sfi/%s.rspec" % self.getSlice())
+
+
# configuration singleton
config = SfiConfig()