| 314 | """ |
| 315 | |
| 316 | def __init__(self, parent, target, feat): |
| 317 | super().__init__(parent) |
| 318 | self._feat = feat |
| 319 | |
| 320 | layout = QtGui.QHBoxLayout(self) |
| 321 | |
| 322 | if feat.keys: |
| 323 | wid = QtGui.QComboBox() |
| 324 | if isinstance(feat.keys, dict): |
| 325 | self._keys = list(feat.keys.keys()) |
| 326 | else: |
| 327 | self._keys = list(feat.keys) |
| 328 | |
| 329 | wid.addItems([str(key) for key in self._keys]) |
| 330 | wid.currentIndexChanged.connect(self._combobox_changed) |
| 331 | else: |
| 332 | wid = QtGui.QLineEdit() |
| 333 | wid.textChanged.connect(self._lineedit_changed) |
| 334 | |
| 335 | layout.addWidget(wid) |
| 336 | self._key_widget = wid |
| 337 | |
| 338 | wid = WidgetMixin.from_feat(feat) |
| 339 | wid.bind_feat(feat) |
| 340 | wid.feat_key = self._keys[0] |
| 341 | wid.lantz_target = target |
| 342 | layout.addWidget(wid) |
| 343 | self._value_widget = wid |
| 344 | |
| 345 | @QtCore.Slot(int, object, object) |
| 346 | def _combobox_changed(self, value, old_value=MISSING, other=MISSING): |