feat(ui): Implement _render_selectable_label helper and complete UI audit
This commit is contained in:
16
src/gui_2.py
16
src/gui_2.py
@@ -222,6 +222,22 @@ class App:
|
||||
imgui.text_unformatted(content)
|
||||
# ---------------------------------------------------------------- gui
|
||||
|
||||
|
||||
def _render_selectable_label(self, label: str, value: str, width: float = 0.0, multiline: bool = False, height: float = 0.0, color: Optional[imgui.ImVec4] = None) -> None:
|
||||
imgui.push_id(label + str(hash(value)))
|
||||
pops = 2
|
||||
imgui.push_style_color(imgui.Col_.frame_bg, vec4(0, 0, 0, 0))
|
||||
imgui.push_style_color(imgui.Col_.border, vec4(0, 0, 0, 0))
|
||||
if color:
|
||||
imgui.push_style_color(imgui.Col_.text, color)
|
||||
pops += 1
|
||||
if multiline:
|
||||
imgui.input_text_multiline("##" + label, value, imgui.ImVec2(width, height), imgui.InputTextFlags_.read_only)
|
||||
else:
|
||||
if width > 0: imgui.set_next_item_width(width)
|
||||
imgui.input_text("##" + label, value, imgui.InputTextFlags_.read_only)
|
||||
imgui.pop_style_color(pops)
|
||||
imgui.pop_id()
|
||||
def _show_menus(self) -> None:
|
||||
if imgui.begin_menu("manual slop"):
|
||||
if imgui.menu_item("Quit", "Ctrl+Q", False)[0]:
|
||||
|
||||
Reference in New Issue
Block a user