Align environment selector to left with visual separator
This commit is contained in:
parent
edcec2e7a8
commit
95f62e1868
@ -41,6 +41,7 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
self.selected_environment_id = selected_environment_id
|
self.selected_environment_id = selected_environment_id
|
||||||
self.project_manager = None # Will be injected from window
|
self.project_manager = None # Will be injected from window
|
||||||
self.environment_dropdown = None # Will be created if project_id is set
|
self.environment_dropdown = None # Will be created if project_id is set
|
||||||
|
self.env_separator = None # Visual separator after environment dropdown
|
||||||
self.undefined_variables = set() # Track undefined variables for visual feedback
|
self.undefined_variables = set() # Track undefined variables for visual feedback
|
||||||
self._update_indicators_timeout_id = None # Debounce timer for indicator updates
|
self._update_indicators_timeout_id = None # Debounce timer for indicator updates
|
||||||
|
|
||||||
@ -57,17 +58,26 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
def _build_ui(self):
|
def _build_ui(self):
|
||||||
"""Build the complete UI for this tab."""
|
"""Build the complete UI for this tab."""
|
||||||
|
|
||||||
# URL Input Section
|
# URL Input Section - outer container (store as instance var for dynamic updates)
|
||||||
url_clamp = Adw.Clamp(maximum_size=1000)
|
self.url_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
|
||||||
self.url_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=12)
|
self.url_container.set_margin_start(12)
|
||||||
self.url_box.set_margin_start(12)
|
self.url_container.set_margin_end(12)
|
||||||
self.url_box.set_margin_end(12)
|
self.url_container.set_margin_top(12)
|
||||||
self.url_box.set_margin_top(12)
|
self.url_container.set_margin_bottom(12)
|
||||||
self.url_box.set_margin_bottom(12)
|
|
||||||
|
|
||||||
# Environment Selector (only if project_id is set, added first)
|
# Environment Selector (left-aligned, outside clamp)
|
||||||
if self.project_id:
|
if self.project_id:
|
||||||
self._build_environment_selector()
|
self._build_environment_selector_inline(self.url_container)
|
||||||
|
# Add visual separator/spacer after environment
|
||||||
|
self.env_separator = Gtk.Separator(orientation=Gtk.Orientation.VERTICAL)
|
||||||
|
self.env_separator.set_margin_start(12)
|
||||||
|
self.env_separator.set_margin_end(12)
|
||||||
|
self.url_container.append(self.env_separator)
|
||||||
|
|
||||||
|
# URL bar (method, URL, send) - centered in clamp
|
||||||
|
url_clamp = Adw.Clamp(maximum_size=1000)
|
||||||
|
url_clamp.set_hexpand(True)
|
||||||
|
self.url_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=12)
|
||||||
|
|
||||||
# Method Dropdown
|
# Method Dropdown
|
||||||
self.method_dropdown = Gtk.DropDown()
|
self.method_dropdown = Gtk.DropDown()
|
||||||
@ -91,7 +101,8 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
self.url_box.append(self.send_button)
|
self.url_box.append(self.send_button)
|
||||||
|
|
||||||
url_clamp.set_child(self.url_box)
|
url_clamp.set_child(self.url_box)
|
||||||
self.append(url_clamp)
|
self.url_container.append(url_clamp)
|
||||||
|
self.append(self.url_container)
|
||||||
|
|
||||||
# Vertical Paned: Main Content | History Panel
|
# Vertical Paned: Main Content | History Panel
|
||||||
vpane = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
|
vpane = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
|
||||||
@ -592,9 +603,9 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
|
|
||||||
return body
|
return body
|
||||||
|
|
||||||
def _build_environment_selector(self):
|
def _build_environment_selector_inline(self, container):
|
||||||
"""Build environment selector and add to URL box."""
|
"""Build environment selector and add to container."""
|
||||||
if not self.project_id or not hasattr(self, 'url_box'):
|
if not self.project_id:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Create dropdown (compact, no label)
|
# Create dropdown (compact, no label)
|
||||||
@ -605,8 +616,8 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
# Connect signal
|
# Connect signal
|
||||||
self.environment_dropdown.connect("notify::selected", self._on_environment_changed)
|
self.environment_dropdown.connect("notify::selected", self._on_environment_changed)
|
||||||
|
|
||||||
# Add to URL box at the start (before method dropdown)
|
# Add to container
|
||||||
self.url_box.prepend(self.environment_dropdown)
|
container.append(self.environment_dropdown)
|
||||||
|
|
||||||
# Populate if project_manager is already available
|
# Populate if project_manager is already available
|
||||||
if self.project_manager:
|
if self.project_manager:
|
||||||
@ -660,12 +671,22 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
if self.environment_dropdown:
|
if self.environment_dropdown:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Create and add the selector to URL box
|
# Create and add the selector to URL container
|
||||||
self._build_environment_selector()
|
if hasattr(self, 'url_container'):
|
||||||
|
self._build_environment_selector_inline(self.url_container)
|
||||||
|
|
||||||
# Populate if project_manager is available
|
# Add separator after environment dropdown (insert before the url_clamp)
|
||||||
if self.project_manager:
|
self.env_separator = Gtk.Separator(orientation=Gtk.Orientation.VERTICAL)
|
||||||
self._populate_environment_dropdown()
|
self.env_separator.set_margin_start(12)
|
||||||
|
self.env_separator.set_margin_end(12)
|
||||||
|
# Insert separator as second child (after environment dropdown)
|
||||||
|
first_child = self.url_container.get_first_child()
|
||||||
|
if first_child:
|
||||||
|
self.url_container.insert_child_after(self.env_separator, first_child)
|
||||||
|
|
||||||
|
# Populate if project_manager is available
|
||||||
|
if self.project_manager:
|
||||||
|
self._populate_environment_dropdown()
|
||||||
|
|
||||||
def _on_environment_changed(self, dropdown, _param):
|
def _on_environment_changed(self, dropdown, _param):
|
||||||
"""Handle environment selection change."""
|
"""Handle environment selection change."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user