Improve viewer element types (#1743)

This commit is contained in:
Brent Yi authored and GitHub committed 2023-04-15 01:14:38 -07:00
1 parent db03d5792e
commit 2ddb2631b5
5 files changed
+76 -56

No files matched your search

+5 -3
View File
@@ -180,15 +180,17 @@ class GuiSelectHandle(GuiHandle[TString], Generic[TString]):
inferred where possible when handles are instantiated; for the most flexibility,
we can declare handles as `GuiHandle[str]`.
"""
overwrite_value = False
# Make sure initial value is in options.
self._impl.leva_conf["options"] = options
if self._impl.leva_conf["value"] not in options:
self._impl.leva_conf["value"] = options[0]
overwrite_value = True
# Update options.
self._impl.api._queue(
GuiSetLevaConfMessage(self._impl.name, self._impl.leva_conf),
)
if overwrite_value:
# Make sure current value is in options.
if self.get_value() not in options:
self.set_value(options[0])