X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fscreens%2Fconfigscreen.py;h=97e697c43353eb21bc84744cd13f55dacd041e66;hp=077ee1b7ec870a82f68f14ecb9c52cb31a2196ea;hb=76b7956ab05ec9a16b460115928d16b5d12f0a2a;hpb=225f44c6dd0ced8e880a5a106f0563d390af54ee diff --git a/sface/screens/configscreen.py b/sface/screens/configscreen.py index 077ee1b..97e697c 100644 --- a/sface/screens/configscreen.py +++ b/sface/screens/configscreen.py @@ -5,33 +5,54 @@ from PyQt4.QtGui import * from sface.config import config from sface.screens.sfascreen import SfaScreen +static_labels = { + 'registry': "usual port for registry: 12345", + 'slicemgr': ["usual port for slice manager: 12347","usual port for aggregate: 12346"], +} + class ConfigWidget(QWidget): def __init__(self, parent): QWidget.__init__(self, parent) - layout = QVBoxLayout() + glayout = QGridLayout() + row = 0 for (field,msg) in config.field_labels(): - # label - layout.addWidget(QLabel(msg,self)) # edit : text or checkbox default=config.field_default(field) + if static_labels.has_key(field): + labels=static_labels[field] + if not isinstance(labels,list): labels = [ labels, ] + for label in labels: + glayout.addWidget(QLabel(label),row,1) + row+=1 if isinstance(default,bool): edit=QCheckBox(msg) if config.is_true(config.get(field)): edit.setCheckState(Qt.Checked) else: - edit=QLineEdit(config.get(field), self) + edit=QLineEdit(config.get(field) or "", self) edit.setAttribute(Qt.WA_MacShowFocusRect, 0) setattr(self,field,edit) - layout.addWidget (edit) + glayout.addWidget(QLabel(msg+":",self), row, 0) + glayout.addWidget(edit, row, 1) + + row += 1 + + hlayout = QHBoxLayout() + hlayout.addStretch() for (action,label) in [('apply','Apply'), ('save','Apply && Save')]: button=QPushButton(label, self) button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) - layout.addWidget(button, 0, Qt.AlignRight) - layout.addStretch() + hlayout.addWidget(button, 0, Qt.AlignRight) + hlayout.addSpacing(10) self.connect(button, SIGNAL('clicked()'), getattr(self,action)) + + layout = QVBoxLayout() + layout.addLayout(glayout) + layout.addLayout(hlayout) + layout.addStretch() self.setLayout(layout) @@ -49,6 +70,9 @@ class ConfigWidget(QWidget): self.parent().setStatus("Settings loaded for current session", timeout=5000) config.display("after apply") + self.parent().signalAll('configurationChanged') + + def save(self): self.apply() config.save_config() @@ -60,3 +84,4 @@ class ConfigScreen(SfaScreen): widget = ConfigWidget(self) self.init(widget, "Configure", "Configure the OneLab Federation GUI") +