Show environment selector when loading project request into empty tab
This commit is contained in:
parent
532e71172d
commit
4b43a509b0
@ -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.environment_selector_box = None # Will store the environment selector UI box
|
||||
self.undefined_variables = set() # Track undefined variables for visual feedback
|
||||
self._update_indicators_timeout_id = None # Debounce timer for indicator updates
|
||||
|
||||
@ -90,9 +91,9 @@ class RequestTabWidget(Gtk.Box):
|
||||
self.append(url_clamp)
|
||||
|
||||
# Environment Selector (only if project_id is set)
|
||||
env_selector = self._build_environment_selector()
|
||||
if env_selector:
|
||||
self.append(env_selector)
|
||||
# Store reference for potential later insertion
|
||||
if self.project_id:
|
||||
self._show_environment_selector()
|
||||
|
||||
# Vertical Paned: Main Content | History Panel
|
||||
vpane = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
|
||||
@ -666,6 +667,26 @@ class RequestTabWidget(Gtk.Box):
|
||||
# Update indicators after environment is set
|
||||
self._update_variable_indicators()
|
||||
|
||||
def _show_environment_selector(self):
|
||||
"""Show environment selector (create if it doesn't exist)."""
|
||||
# If selector already exists, nothing to do
|
||||
if self.environment_selector_box:
|
||||
return
|
||||
|
||||
# Create the selector
|
||||
self.environment_selector_box = self._build_environment_selector()
|
||||
|
||||
# Insert it after the URL box (which is the first child)
|
||||
# Get the first child (url_clamp) to insert after it
|
||||
first_child = self.get_first_child()
|
||||
if first_child:
|
||||
# Insert after the first child
|
||||
self.insert_child_after(self.environment_selector_box, 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."""
|
||||
if not hasattr(self, 'environment_ids'):
|
||||
|
||||
@ -925,8 +925,8 @@ class RosterWindow(Adw.ApplicationWindow):
|
||||
# Update widget with project context
|
||||
widget.project_id = project_id
|
||||
widget.selected_environment_id = default_env_id
|
||||
if project_id and hasattr(widget, '_populate_environment_dropdown'):
|
||||
widget._populate_environment_dropdown()
|
||||
if project_id and hasattr(widget, '_show_environment_selector'):
|
||||
widget._show_environment_selector()
|
||||
|
||||
# Update the tab page title
|
||||
page.set_title(tab_name)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user