Add debug output for header indicators

This commit is contained in:
vesp 2025-12-30 14:12:52 +01:00
parent 277a8dc13e
commit 1cccded694

View File

@ -735,6 +735,7 @@ class RequestTabWidget(Gtk.Box):
"""Update visual indicators for undefined variables."""
# Detect undefined variables
self.undefined_variables = self._detect_undefined_variables()
print(f"Updating indicators, undefined vars: {self.undefined_variables}")
# Update URL entry
self._update_url_indicator()
@ -769,33 +770,45 @@ class RequestTabWidget(Gtk.Box):
# Iterate through all header rows
child = self.headers_listbox.get_first_child()
while child:
# Check if this is a HeaderRow widget
# Debug: print child type
print(f"Header child type: {type(child).__name__}")
# HeaderRow might be a child of the ListBox row
header_row = None
if isinstance(child, HeaderRow):
header_row = child
elif hasattr(child, 'get_child'):
# GTK4 ListBox wraps widgets in GtkListBoxRow
actual_child = child.get_child()
if isinstance(actual_child, HeaderRow):
header_row = actual_child
if header_row:
# Check key
key_text = child.key_entry.get_text()
key_text = header_row.key_entry.get_text()
key_vars = set(VariableSubstitution.find_variables(key_text))
undefined_in_key = key_vars & self.undefined_variables
if undefined_in_key:
child.key_entry.add_css_class("warning")
header_row.key_entry.add_css_class("warning")
tooltip = "Undefined: " + ", ".join(sorted(undefined_in_key))
child.key_entry.set_tooltip_text(tooltip)
header_row.key_entry.set_tooltip_text(tooltip)
else:
child.key_entry.remove_css_class("warning")
child.key_entry.set_tooltip_text("")
header_row.key_entry.remove_css_class("warning")
header_row.key_entry.set_tooltip_text("")
# Check value
value_text = child.value_entry.get_text()
value_text = header_row.value_entry.get_text()
value_vars = set(VariableSubstitution.find_variables(value_text))
undefined_in_value = value_vars & self.undefined_variables
if undefined_in_value:
child.value_entry.add_css_class("warning")
header_row.value_entry.add_css_class("warning")
tooltip = "Undefined: " + ", ".join(sorted(undefined_in_value))
child.value_entry.set_tooltip_text(tooltip)
header_row.value_entry.set_tooltip_text(tooltip)
else:
child.value_entry.remove_css_class("warning")
child.value_entry.set_tooltip_text("")
header_row.value_entry.remove_css_class("warning")
header_row.value_entry.set_tooltip_text("")
child = child.get_next_sibling()