conductor(checkpoint): Final performance optimizations for Phase 3: Throttled UI updates and optimized retro blinking
This commit is contained in:
80
gui.py
80
gui.py
@@ -520,6 +520,8 @@ class App:
|
||||
self.perf_monitor.alert_callback = self._on_performance_alert
|
||||
self._last_bleed_update_time = 0
|
||||
self._last_diag_update_time = 0
|
||||
self._last_script_alpha = -1
|
||||
self._last_resp_alpha = -1
|
||||
self._recalculate_session_usage()
|
||||
|
||||
# ---------------------------------------------------------------- project loading
|
||||
@@ -2316,26 +2318,28 @@ class App:
|
||||
val = math.sin(elapsed * 8 * math.pi)
|
||||
alpha = 60 if val > 0 else 0
|
||||
|
||||
if not dpg.does_item_exist("script_blink_theme"):
|
||||
with dpg.theme(tag="script_blink_theme"):
|
||||
with dpg.theme_component(dpg.mvAll):
|
||||
dpg.add_theme_color(dpg.mvThemeCol_FrameBg, (0, 100, 255, alpha), tag="script_blink_color")
|
||||
dpg.add_theme_color(dpg.mvThemeCol_ChildBg, (0, 100, 255, alpha), tag="script_blink_color2")
|
||||
else:
|
||||
dpg.set_value("script_blink_color", [0, 100, 255, alpha])
|
||||
if dpg.does_item_exist("script_blink_color2"):
|
||||
dpg.set_value("script_blink_color2", [0, 100, 255, alpha])
|
||||
|
||||
if dpg.does_item_exist("last_script_output"):
|
||||
try:
|
||||
dpg.bind_item_theme("last_script_output", "script_blink_theme")
|
||||
dpg.bind_item_theme("last_script_text", "script_blink_theme")
|
||||
if dpg.does_item_exist("last_script_output_wrap_container"):
|
||||
dpg.bind_item_theme("last_script_output_wrap_container", "script_blink_theme")
|
||||
if dpg.does_item_exist("last_script_text_wrap_container"):
|
||||
dpg.bind_item_theme("last_script_text_wrap_container", "script_blink_theme")
|
||||
except Exception:
|
||||
pass
|
||||
if alpha != self._last_script_alpha:
|
||||
self._last_script_alpha = alpha
|
||||
if not dpg.does_item_exist("script_blink_theme"):
|
||||
with dpg.theme(tag="script_blink_theme"):
|
||||
with dpg.theme_component(dpg.mvAll):
|
||||
dpg.add_theme_color(dpg.mvThemeCol_FrameBg, (0, 100, 255, alpha), tag="script_blink_color")
|
||||
dpg.add_theme_color(dpg.mvThemeCol_ChildBg, (0, 100, 255, alpha), tag="script_blink_color2")
|
||||
else:
|
||||
dpg.set_value("script_blink_color", [0, 100, 255, alpha])
|
||||
if dpg.does_item_exist("script_blink_color2"):
|
||||
dpg.set_value("script_blink_color2", [0, 100, 255, alpha])
|
||||
|
||||
if dpg.does_item_exist("last_script_output"):
|
||||
try:
|
||||
dpg.bind_item_theme("last_script_output", "script_blink_theme")
|
||||
dpg.bind_item_theme("last_script_text", "script_blink_theme")
|
||||
if dpg.does_item_exist("last_script_output_wrap_container"):
|
||||
dpg.bind_item_theme("last_script_output_wrap_container", "script_blink_theme")
|
||||
if dpg.does_item_exist("last_script_text_wrap_container"):
|
||||
dpg.bind_item_theme("last_script_text_wrap_container", "script_blink_theme")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if self._trigger_blink:
|
||||
self._trigger_blink = False
|
||||
@@ -2360,23 +2364,25 @@ class App:
|
||||
val = math.sin(elapsed * 8 * math.pi)
|
||||
alpha = 50 if val > 0 else 0
|
||||
|
||||
if not dpg.does_item_exist("response_blink_theme"):
|
||||
with dpg.theme(tag="response_blink_theme"):
|
||||
with dpg.theme_component(dpg.mvAll):
|
||||
dpg.add_theme_color(dpg.mvThemeCol_FrameBg, (0, 255, 0, alpha), tag="response_blink_color")
|
||||
dpg.add_theme_color(dpg.mvThemeCol_ChildBg, (0, 255, 0, alpha), tag="response_blink_color2")
|
||||
else:
|
||||
dpg.set_value("response_blink_color", [0, 255, 0, alpha])
|
||||
if dpg.does_item_exist("response_blink_color2"):
|
||||
dpg.set_value("response_blink_color2", [0, 255, 0, alpha])
|
||||
|
||||
if dpg.does_item_exist("ai_response"):
|
||||
try:
|
||||
dpg.bind_item_theme("ai_response", "response_blink_theme")
|
||||
if dpg.does_item_exist("ai_response_wrap_container"):
|
||||
dpg.bind_item_theme("ai_response_wrap_container", "response_blink_theme")
|
||||
except Exception:
|
||||
pass
|
||||
if alpha != self._last_resp_alpha:
|
||||
self._last_resp_alpha = alpha
|
||||
if not dpg.does_item_exist("response_blink_theme"):
|
||||
with dpg.theme(tag="response_blink_theme"):
|
||||
with dpg.theme_component(dpg.mvAll):
|
||||
dpg.add_theme_color(dpg.mvThemeCol_FrameBg, (0, 255, 0, alpha), tag="response_blink_color")
|
||||
dpg.add_theme_color(dpg.mvThemeCol_ChildBg, (0, 255, 0, alpha), tag="response_blink_color2")
|
||||
else:
|
||||
dpg.set_value("response_blink_color", [0, 255, 0, alpha])
|
||||
if dpg.does_item_exist("response_blink_color2"):
|
||||
dpg.set_value("response_blink_color2", [0, 255, 0, alpha])
|
||||
|
||||
if dpg.does_item_exist("ai_response"):
|
||||
try:
|
||||
dpg.bind_item_theme("ai_response", "response_blink_theme")
|
||||
if dpg.does_item_exist("ai_response_wrap_container"):
|
||||
dpg.bind_item_theme("ai_response_wrap_container", "response_blink_theme")
|
||||
except Exception:
|
||||
pass
|
||||
self.perf_monitor.end_component("Blinking")
|
||||
|
||||
# Flush any comms entries queued from background threads
|
||||
|
||||
Reference in New Issue
Block a user