Skip to content

Commit 5334391

Browse files
committed
add bool as field option
1 parent 1b99df6 commit 5334391

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ulc_mm_package/QtGUI/study_metadata_form.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from PyQt5.QtGui import QDoubleValidator
77

88
from PyQt5.QtWidgets import (
9+
QCheckBox,
910
QComboBox,
1011
QDialog,
1112
QDateEdit,
@@ -25,6 +26,7 @@
2526
"float": "doublespinbox",
2627
"date": "dateedit",
2728
"enum": "combobox",
29+
"bool": "checkbox",
2830
}
2931

3032

@@ -84,6 +86,12 @@ def create_widget_for_field(field_def):
8486
idx = w.findText(default)
8587
if idx >= 0:
8688
w.setCurrentIndex(idx)
89+
elif t == "bool":
90+
w = QCheckBox()
91+
default = field_def.get("default")
92+
if default is not None:
93+
w.setChecked(bool(default))
94+
8795
else:
8896
raise ValueError(f"Unsupported field type: {t}")
8997

0 commit comments

Comments
 (0)