diff --git a/src/request_tab_widget.py b/src/request_tab_widget.py index f5b1522..52d0abc 100644 --- a/src/request_tab_widget.py +++ b/src/request_tab_widget.py @@ -41,6 +41,7 @@ class RequestTabWidget(Gtk.Box): self.selected_environment_id = selected_environment_id self.project_manager = None # Will be injected from window 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._update_indicators_timeout_id = None # Debounce timer for indicator updates @@ -57,17 +58,26 @@ class RequestTabWidget(Gtk.Box): def _build_ui(self): """Build the complete UI for this tab.""" - # URL Input Section - url_clamp = Adw.Clamp(maximum_size=1000) - self.url_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=12) - self.url_box.set_margin_start(12) - self.url_box.set_margin_end(12) - self.url_box.set_margin_top(12) - self.url_box.set_margin_bottom(12) + # URL Input Section - outer container (store as instance var for dynamic updates) + self.url_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) + self.url_container.set_margin_start(12) + self.url_container.set_margin_end(12) + self.url_container.set_margin_top(12) + self.url_container.set_margin_bottom(12) - # Environment Selector (only if project_id is set, added first) + # Environment Selector (left-aligned, outside clamp) 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 self.method_dropdown = Gtk.DropDown() @@ -91,7 +101,8 @@ class RequestTabWidget(Gtk.Box): self.url_box.append(self.send_button) 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 vpane = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL) @@ -592,9 +603,9 @@ class RequestTabWidget(Gtk.Box): return body - def _build_environment_selector(self): - """Build environment selector and add to URL box.""" - if not self.project_id or not hasattr(self, 'url_box'): + def _build_environment_selector_inline(self, container): + """Build environment selector and add to container.""" + if not self.project_id: return # Create dropdown (compact, no label) @@ -605,8 +616,8 @@ class RequestTabWidget(Gtk.Box): # Connect signal self.environment_dropdown.connect("notify::selected", self._on_environment_changed) - # Add to URL box at the start (before method dropdown) - self.url_box.prepend(self.environment_dropdown) + # Add to container + container.append(self.environment_dropdown) # Populate if project_manager is already available if self.project_manager: @@ -660,12 +671,22 @@ class RequestTabWidget(Gtk.Box): if self.environment_dropdown: return - # Create and add the selector to URL box - self._build_environment_selector() + # Create and add the selector to URL container + if hasattr(self, 'url_container'): + self._build_environment_selector_inline(self.url_container) - # Populate if project_manager is available - if self.project_manager: - self._populate_environment_dropdown() + # Add separator after environment dropdown (insert before the url_clamp) + self.env_separator = Gtk.Separator(orientation=Gtk.Orientation.VERTICAL) + 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): """Handle environment selection change."""