Hide script result panels when there's no output
This commit is contained in:
parent
7e3a8c69d8
commit
85a1705f4c
@ -936,13 +936,20 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
if not isinstance(script_result, ScriptResult):
|
if not isinstance(script_result, ScriptResult):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Show container
|
# Determine if there's meaningful content to display (before building output_text)
|
||||||
self.script_results_container.set_visible(True)
|
has_content = (
|
||||||
|
(script_result.success and script_result.output.strip()) or # Has console output
|
||||||
|
script_result.variable_updates or # Set variables
|
||||||
|
script_result.warnings or # Has warnings
|
||||||
|
not script_result.success # Has errors
|
||||||
|
)
|
||||||
|
|
||||||
# Adjust paned positions to make the panel visible (use idle_add to wait for proper sizing)
|
# If no content, hide the panel and return early
|
||||||
GLib.idle_add(self._adjust_paned_for_script_results)
|
if not has_content:
|
||||||
|
self._clear_script_results()
|
||||||
|
return
|
||||||
|
|
||||||
# Set status icon
|
# Build output text for display
|
||||||
if script_result.success:
|
if script_result.success:
|
||||||
self.script_status_icon.set_from_icon_name("object-select-symbolic")
|
self.script_status_icon.set_from_icon_name("object-select-symbolic")
|
||||||
output_text = script_result.output
|
output_text = script_result.output
|
||||||
@ -968,6 +975,12 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
for warning in script_result.warnings:
|
for warning in script_result.warnings:
|
||||||
output_text += f"\n⚠ {warning}"
|
output_text += f"\n⚠ {warning}"
|
||||||
|
|
||||||
|
# Show container and display output
|
||||||
|
self.script_results_container.set_visible(True)
|
||||||
|
|
||||||
|
# Adjust paned positions to make the panel visible (use idle_add to wait for proper sizing)
|
||||||
|
GLib.idle_add(self._adjust_paned_for_script_results)
|
||||||
|
|
||||||
# Set output text
|
# Set output text
|
||||||
buffer = self.script_output_textview.get_buffer()
|
buffer = self.script_output_textview.get_buffer()
|
||||||
buffer.set_text(output_text)
|
buffer.set_text(output_text)
|
||||||
@ -1017,13 +1030,20 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
if not isinstance(preprocessing_result, ScriptResult):
|
if not isinstance(preprocessing_result, ScriptResult):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Show container
|
# Determine if there's meaningful content to display (before building output_text)
|
||||||
self.preprocessing_results_container.set_visible(True)
|
has_content = (
|
||||||
|
(preprocessing_result.success and preprocessing_result.output.strip()) or # Has console output
|
||||||
|
preprocessing_result.variable_updates or # Set variables
|
||||||
|
preprocessing_result.warnings or # Has warnings
|
||||||
|
not preprocessing_result.success # Has errors
|
||||||
|
)
|
||||||
|
|
||||||
# Adjust paned positions to make the panel visible (use idle_add to wait for proper sizing)
|
# If no content, hide the panel and return early
|
||||||
GLib.idle_add(self._adjust_paned_for_preprocessing_results)
|
if not has_content:
|
||||||
|
self._clear_preprocessing_results()
|
||||||
|
return
|
||||||
|
|
||||||
# Set status icon
|
# Build output text for display
|
||||||
if preprocessing_result.success:
|
if preprocessing_result.success:
|
||||||
self.preprocessing_status_icon.set_from_icon_name("object-select-symbolic")
|
self.preprocessing_status_icon.set_from_icon_name("object-select-symbolic")
|
||||||
output_text = preprocessing_result.output
|
output_text = preprocessing_result.output
|
||||||
@ -1049,13 +1069,19 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
for warning in preprocessing_result.warnings:
|
for warning in preprocessing_result.warnings:
|
||||||
output_text += f"\n⚠ {warning}"
|
output_text += f"\n⚠ {warning}"
|
||||||
|
|
||||||
# Add request modification summary if successful
|
# Add request modification summary if successful and there's other content to show
|
||||||
if preprocessing_result.success and preprocessing_result.modified_request:
|
if preprocessing_result.success and preprocessing_result.modified_request:
|
||||||
if output_text:
|
if output_text:
|
||||||
output_text += "\n"
|
output_text += "\n"
|
||||||
output_text += "\n--- Request Modified ---"
|
output_text += "\n--- Request Modified ---"
|
||||||
output_text += "\n✓ Request was modified by preprocessing script"
|
output_text += "\n✓ Request was modified by preprocessing script"
|
||||||
|
|
||||||
|
# Show container and display output
|
||||||
|
self.preprocessing_results_container.set_visible(True)
|
||||||
|
|
||||||
|
# Adjust paned positions to make the panel visible (use idle_add to wait for proper sizing)
|
||||||
|
GLib.idle_add(self._adjust_paned_for_preprocessing_results)
|
||||||
|
|
||||||
# Set output text
|
# Set output text
|
||||||
buffer = self.preprocessing_output_textview.get_buffer()
|
buffer = self.preprocessing_output_textview.get_buffer()
|
||||||
buffer.set_text(output_text)
|
buffer.set_text(output_text)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user