X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fscreens%2Fconfigscreen.py;h=97e697c43353eb21bc84744cd13f55dacd041e66;hp=56391f1c277132fcf0ac5c473054482e6d5c91b4;hb=76b7956ab05ec9a16b460115928d16b5d12f0a2a;hpb=af944fe917c3f4236a162b318d466f3948543019 diff --git a/sface/screens/configscreen.py b/sface/screens/configscreen.py index 56391f1..97e697c 100644 --- a/sface/screens/configscreen.py +++ b/sface/screens/configscreen.py @@ -5,25 +5,39 @@ 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() @@ -32,8 +46,13 @@ class ConfigWidget(QWidget): button=QPushButton(label, self) button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) 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) @@ -51,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() @@ -62,3 +84,4 @@ class ConfigScreen(SfaScreen): widget = ConfigWidget(self) self.init(widget, "Configure", "Configure the OneLab Federation GUI") +