| 157 | self.connector.setConfigValue(k, option, str(i.text()), sec) |
| 158 | |
| 159 | class Section(QGroupBox): |
| 160 | def __init__(self, data, parent, ctype="core"): |
| 161 | self.data = data |
| 162 | QGroupBox.__init__(self, data.description, parent) |
| 163 | self.labels = {} |
| 164 | self.inputs = {} |
| 165 | self.ctype = ctype |
| 166 | layout = QFormLayout(self) |
| 167 | self.setLayout(layout) |
| 168 | |
| 169 | sw = QWidget() |
| 170 | sw.setLayout(QVBoxLayout()) |
| 171 | sw.layout().addWidget(self) |
| 172 | |
| 173 | sa = QScrollArea() |
| 174 | sa.setWidgetResizable(True) |
| 175 | sa.setWidget(sw) |
| 176 | sa.setFrameShape(sa.NoFrame) |
| 177 | |
| 178 | parent.addTab(sa, data.description) |
| 179 | |
| 180 | for option in self.data.items: |
| 181 | if option.type == "int": |
| 182 | i = QSpinBox(self) |
| 183 | i.setMaximum(999999) |
| 184 | i.setValue(int(option.value)) |
| 185 | elif not option.type.find(";") == -1: |
| 186 | choices = option.type.split(";") |
| 187 | i = QComboBox(self) |
| 188 | i.addItems(choices) |
| 189 | i.setCurrentIndex(i.findText(option.value)) |
| 190 | elif option.type == "bool": |
| 191 | i = QComboBox(self) |
| 192 | i.addItem(_("Yes"), QVariant(True)) |
| 193 | i.addItem(_("No"), QVariant(False)) |
| 194 | if True if option.value.lower() in ("1","true", "on", "an","yes") else False: |
| 195 | i.setCurrentIndex(0) |
| 196 | else: |
| 197 | i.setCurrentIndex(1) |
| 198 | else: |
| 199 | i = QLineEdit(self) |
| 200 | i.setText(option.value) |
| 201 | layout.addRow(option.description, i) |
| 202 | layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) |