fix(gui): Restore discussion tinting and fix Markdown table width
- Implement layered tinting using draw_list channels in modular discussion renderer. - Fix vertical squashing of Markdown tables by forcing full group width with a dummy. - Consolidate color constants into src/ui_shared.py to prevent circular imports. - Update src/theme_2.py with role-based tint helpers. - Successfully verified imports and layout logic.
This commit is contained in:
+31
-1
@@ -1,13 +1,43 @@
|
||||
from __future__ import annotations
|
||||
from imgui_bundle import imgui
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from src.gui_2 import App
|
||||
|
||||
# Standard Color Constants (normalized to 0-1)
|
||||
def vec4(r: float, g: float, b: float, a: float = 1.0) -> imgui.ImVec4:
|
||||
return imgui.ImVec4(r/255.0, g/255.0, b/255.0, a)
|
||||
|
||||
C_OUT: imgui.ImVec4 = vec4(100, 200, 255)
|
||||
C_IN: imgui.ImVec4 = vec4(140, 255, 160)
|
||||
C_REQ: imgui.ImVec4 = vec4(255, 220, 100)
|
||||
C_RES: imgui.ImVec4 = vec4(180, 255, 180)
|
||||
C_TC: imgui.ImVec4 = vec4(255, 180, 80)
|
||||
C_TR: imgui.ImVec4 = vec4(180, 220, 255)
|
||||
C_TRS: imgui.ImVec4 = vec4(200, 180, 255)
|
||||
C_LBL: imgui.ImVec4 = vec4(180, 180, 180)
|
||||
C_VAL: imgui.ImVec4 = vec4(220, 220, 220)
|
||||
C_KEY: imgui.ImVec4 = vec4(140, 200, 255)
|
||||
C_NUM: imgui.ImVec4 = vec4(180, 255, 180)
|
||||
C_SUB: imgui.ImVec4 = vec4(220, 200, 120)
|
||||
|
||||
def render_text_viewer(app: 'App', label: str, content: str, text_type: str = 'text', force_open: bool = False, id_suffix: str = "") -> None:
|
||||
if imgui.button(f"[+]##{id_suffix or str(id(content))}") or force_open:
|
||||
app.text_viewer_type = text_type
|
||||
app.show_windows["Text Viewer"] = True
|
||||
app.text_viewer_title = label
|
||||
app.text_viewer_content = content
|
||||
|
||||
def render_selectable_label(app: 'App', label: str, value: str, width: float = 0.0, multiline: bool = False, height: float = 0.0, color: Any = None) -> None:
|
||||
from src import imscope
|
||||
with imscope.id(label + str(hash(value))):
|
||||
with imscope.style_color(imgui.Col_.frame_bg, imgui.ImVec4(0, 0, 0, 0)), \
|
||||
imscope.style_var(imgui.StyleVar_.frame_border_size, 0.0):
|
||||
if color:
|
||||
with imscope.style_color(imgui.Col_.text, color):
|
||||
if multiline: _, _ = imgui.input_text_multiline(f"##{label}", value, imgui.ImVec2(width, height), imgui.InputTextFlags_.read_only)
|
||||
else: _, _ = imgui.input_text(f"##{label}", value, imgui.InputTextFlags_.read_only)
|
||||
else:
|
||||
if multiline: _, _ = imgui.input_text_multiline(f"##{label}", value, imgui.ImVec2(width, height), imgui.InputTextFlags_.read_only)
|
||||
else: _, _ = imgui.input_text(f"##{label}", value, imgui.InputTextFlags_.read_only)
|
||||
|
||||
Reference in New Issue
Block a user