MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / prop_enum

Method prop_enum

src/python/lfs/rml_im_mode_layout.cpp:2277–2294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2275 }
2276
2277 bool RmlImModeLayout::prop_enum(nb::object data, const std::string& prop_id,
2278 const std::string& value, const std::string& text) {
2279 const std::string current = nb::cast<std::string>(data.attr(prop_id.c_str()));
2280 const bool selected = (current == value);
2281 const std::string& display = text.empty() ? value : text;
2282
2283 bool clicked;
2284 if (selected)
2285 clicked = button_styled(display, "primary");
2286 else
2287 clicked = button(display);
2288
2289 if (clicked && !selected) {
2290 data.attr(prop_id.c_str()) = nb::cast(value);
2291 return true;
2292 }
2293 return false;
2294 }
2295
2296 nb::object RmlImModeLayout::operator_(const std::string& operator_id, const std::string& text,
2297 const std::string& /*icon*/) {

Callers

nothing calls this directly

Calls 3

buttonFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected