PropertiesDlg changed: retrieve additional information about the user, use QSettings to store the derived parameters

This commit is contained in:
Sebastian Wehling-Benatelli 2014-12-17 07:52:55 +01:00
parent 3fe1e3906e
commit 9d1a78222e

View File

@ -31,7 +31,8 @@ from PySide.QtGui import (QAction,
QToolBar, QToolBar,
QVBoxLayout, QVBoxLayout,
QWidget) QWidget)
from PySide.QtCore import (Qt, from PySide.QtCore import (QSettings,
Qt,
QUrl, QUrl,
SIGNAL, SIGNAL,
SLOT) SLOT)
@ -72,17 +73,17 @@ class PropertiesDlg(QDialog):
self.setWindowTitle("{0} Properties".format(appName)) self.setWindowTitle("{0} Properties".format(appName))
tabWidget = QTabWidget() self.tabWidget = QTabWidget()
tabWidget.addTab(InputsTab(self), "Inputs") self.tabWidget.addTab(InputsTab(self), "Inputs")
tabWidget.addTab(OutputsTab(self), "Outputs") self.tabWidget.addTab(OutputsTab(self), "Outputs")
tabWidget.addTab(PhasesTab(self), "Phases") self.tabWidget.addTab(PhasesTab(self), "Phases")
tabWidget.addTab(GraphicsTab(self), "Graphics") self.tabWidget.addTab(GraphicsTab(self), "Graphics")
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |
QDialogButtonBox.Apply | QDialogButtonBox.Apply |
QDialogButtonBox.Close) QDialogButtonBox.Close)
layout = QVBoxLayout() layout = QVBoxLayout()
layout.addWidget(tabWidget) layout.addWidget(self.tabWidget)
layout.addWidget(self.buttonBox) layout.addWidget(self.buttonBox)
self.setLayout(layout) self.setLayout(layout)
@ -92,23 +93,40 @@ class PropertiesDlg(QDialog):
SIGNAL("clicked()"), self.apply) SIGNAL("clicked()"), self.apply)
self.connect(self.buttonBox, SIGNAL("rejected()"), self.connect(self.buttonBox, SIGNAL("rejected()"),
self, SLOT("reject()")) self, SLOT("reject()"))
pass
def apply(self): def apply(self):
pass settings = QSettings()
for widint in range(self.tabWidget.count()):
curwid = self.tabWidget.widget(widint)
values = self.getValues(curwid)
settings.setValue()
class InputsTab(QWidget): class InputsTab(QWidget):
def __init__(self, parent=None): def __init__(self, parent):
super(InputsTab, self).__init__(parent) super(InputsTab, self).__init__(parent)
settings = QSettings()
fulluser = settings.value("user/FullName")
login = settings.value("user/Login")
fullNameLabel = QLabel("Full name for user '{0}'".format(login))
parent.fullNameEdit = QLineEdit()
parent.fullNameEdit.setText(fulluser)
dataroot = settings.value("data/dataRoot")
dataDirLabel = QLabel("data directory:") dataDirLabel = QLabel("data directory:")
dataDirEdit = QLineEdit() parent.dataDirEdit = QLineEdit()
parent.dataDirEdit.setText(dataroot)
parent.dataDirEdit.selectAll()
layout = QGridLayout() layout = QGridLayout()
layout.addWidget(dataDirLabel, 0, 0) layout.addWidget(dataDirLabel, 0, 0)
layout.addWidget(dataDirEdit, 0, 1) layout.addWidget(parent.dataDirEdit, 0, 1)
layout.addWidget(fullNameLabel, 1, 0)
layout.addWidget(parent.fullNameEdit, 1, 1)
self.setLayout(layout) self.setLayout(layout)