Esempio n. 1
0
class SecurityDialog(QtGui.QDialog):
    def __init__(self, parent):
        QtGui.QDialog.__init__(self, parent)
        self.ui = Ui_DialogSecurity()
        self.ui.setupUi(self)

        self.layout = QtGui.QVBoxLayout(self.ui.frameFields)
        self.widgets = {}

        self.connect(self.ui.buttonBox, SIGNAL("accepted()"), self.accept)
        self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.reject)

    def setFields(self, fields=[]):
        for key, widget in self.widgets.iteritems():
            self.layout.removeWidget(widget)
            widget.hide()
        self.widgets = {}
        for key, label, _type in fields:
            widget = SecurityWidget(self.ui.frameFields, key, label, _type)
            self.layout.addWidget(widget)
            self.widgets[key] = widget
        self.updateGeometry()

    def setValues(self, values={}):
        for key, value in values.iteritems():
            if key in self.widgets:
                self.widgets[key].setValue(value)

    def getValues(self):
        values = {}
        for key, widget in self.widgets.iteritems():
            values[key] = widget.getValue()
        return values
Esempio n. 2
0
class SecurityDialog(QtGui.QDialog):
    def __init__(self, parent):
        QtGui.QDialog.__init__(self, parent)
        self.ui = Ui_DialogSecurity()
        self.ui.setupUi(self)

        self.layout = QtGui.QVBoxLayout(self.ui.frameFields)
        self.widgets = {}

        self.connect(self.ui.buttonBox, SIGNAL("accepted()"), self.accept)
        self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.reject)

    def setFields(self, fields=[]):
        for key, widget in self.widgets.iteritems():
            self.layout.removeWidget(widget)
            widget.hide()
        self.widgets = {}
        for key, label, _type in fields:
            widget = SecurityWidget(self.ui.frameFields, key, label, _type)
            self.layout.addWidget(widget)
            self.widgets[key] = widget
        self.updateGeometry()

    def setValues(self, values={}):
        for key, value in values.iteritems():
            if key in self.widgets:
                self.widgets[key].setValue(value)

    def getValues(self):
        values = {}
        for key, widget in self.widgets.iteritems():
            values[key] = widget.getValue()
        return values
Esempio n. 3
0
    def __init__(self, parent):
        QtGui.QDialog.__init__(self, parent)
        self.ui = Ui_DialogSecurity()
        self.ui.setupUi(self)

        self.layout = QtGui.QVBoxLayout(self.ui.frameFields)
        self.widgets = {}

        self.connect(self.ui.buttonBox, SIGNAL("accepted()"), self.accept)
        self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.reject)
Esempio n. 4
0
    def __init__(self, parent):
        QtGui.QDialog.__init__(self, parent)
        self.ui = Ui_DialogSecurity()
        self.ui.setupUi(self)

        self.layout = QtGui.QVBoxLayout(self.ui.frameFields)
        self.widgets = {}

        self.connect(self.ui.buttonBox, SIGNAL("accepted()"), self.accept)
        self.connect(self.ui.buttonBox, SIGNAL("rejected()"), self.reject)