Show environment selector when loading project request into empty tab
This commit is contained in:
parent
1192038080
commit
3a903f28ec
@ -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.environment_selector_box = None # Will store the environment selector UI box
|
||||||
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
|
||||||
|
|
||||||
@ -90,9 +91,9 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
self.append(url_clamp)
|
self.append(url_clamp)
|
||||||
|
|
||||||
# Environment Selector (only if project_id is set)
|
# Environment Selector (only if project_id is set)
|
||||||
env_selector = self._build_environment_selector()
|
# Store reference for potential later insertion
|
||||||
if env_selector:
|
if self.project_id:
|
||||||
self.append(env_selector)
|
self._show_environment_selector()
|
||||||
|
|
||||||
# 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)
|
||||||
@ -666,6 +667,26 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
# Update indicators after environment is set
|
# Update indicators after environment is set
|
||||||
self._update_variable_indicators()
|
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):
|
def _on_environment_changed(self, dropdown, _param):
|
||||||
"""Handle environment selection change."""
|
"""Handle environment selection change."""
|
||||||
if not hasattr(self, 'environment_ids'):
|
if not hasattr(self, 'environment_ids'):
|
||||||
|
|||||||
@ -925,8 +925,8 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
# Update widget with project context
|
# Update widget with project context
|
||||||
widget.project_id = project_id
|
widget.project_id = project_id
|
||||||
widget.selected_environment_id = default_env_id
|
widget.selected_environment_id = default_env_id
|
||||||
if project_id and hasattr(widget, '_populate_environment_dropdown'):
|
if project_id and hasattr(widget, '_show_environment_selector'):
|
||||||
widget._populate_environment_dropdown()
|
widget._show_environment_selector()
|
||||||
|
|
||||||
# Update the tab page title
|
# Update the tab page title
|
||||||
page.set_title(tab_name)
|
page.set_title(tab_name)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user