Coverage for openhcs/textual_tui/windows/pipeline_plate_window.py: 0.0%
36 statements
« prev ^ index » next coverage.py v7.10.3, created at 2025-08-14 05:57 +0000
« prev ^ index » next coverage.py v7.10.3, created at 2025-08-14 05:57 +0000
1"""Shared Pipeline/Plate Manager window for OpenHCS TUI."""
3from textual.app import ComposeResult
4from textual.containers import Container, Horizontal
5from openhcs.textual_tui.windows.base_window import BaseOpenHCSWindow
6from openhcs.textual_tui.widgets.pipeline_editor import PipelineEditorWidget
7from openhcs.textual_tui.widgets.plate_manager import PlateManagerWidget
10class PipelinePlateWindow(BaseOpenHCSWindow):
11 """Shared window containing both Pipeline Editor and Plate Manager widgets."""
13 DEFAULT_CSS = """
14 PipelinePlateWindow {
15 width: 80; height: 20;
16 min-width: 80; min-height: 20;
17 }
18 PipelinePlateWindow #content_pane {
19 padding: 0; /* Remove all padding from content pane */
20 }
21 """
23 def __init__(self, filemanager, global_config, **kwargs):
24 """
25 Initialize the shared pipeline/plate window.
27 Args:
28 filemanager: File manager instance
29 global_config: Global configuration instance
30 """
31 super().__init__(
32 window_id="pipeline_plate",
33 title="Main", # Changed to "Main" as requested
34 mode="permanent", # Use permanent mode so state persists
35 allow_maximize=True,
36 **kwargs
37 )
38 self.filemanager = filemanager
39 self.global_config = global_config
40 self.current_view = "pipeline"
42 # Create both widgets as instance variables
43 self.pipeline_widget = PipelineEditorWidget(filemanager, global_config)
44 self.plate_widget = PlateManagerWidget(filemanager, global_config)
46 def compose(self) -> ComposeResult:
47 """Compose the shared window with both widgets in horizontal layout with titles."""
48 with Horizontal():
49 # Left pane: Plate Manager with proper border title
50 plate_container = Container(id="plate_manager_container")
51 plate_container.border_title = "Plate Manager"
52 with plate_container:
53 yield self.plate_widget
55 # Right pane: Pipeline Editor with proper border title
56 pipeline_container = Container(id="pipeline_editor_container")
57 pipeline_container.border_title = "Pipeline Editor"
58 with pipeline_container:
59 yield self.pipeline_widget
61 def on_mount(self):
62 """Set up widget coordination - EXACT copy from MainContent.on_mount()."""
63 # Both widgets are always visible in the horizontal layout
64 # No need to hide anything - this matches the original MainContent behavior
66 # Set up bidirectional widget references (preserve existing relationships)
67 self.pipeline_widget.plate_manager = self.plate_widget
68 self.plate_widget.pipeline_editor = self.pipeline_widget
70 # Set up plate selection callback (exact coordination logic from MainContent)
71 def on_plate_selected(plate_path: str):
72 self.pipeline_widget.current_plate = plate_path
74 self.plate_widget.on_plate_selected = on_plate_selected
76 def show_pipeline_editor(self):
77 """Focus on pipeline editor (but both are always visible)."""
78 self.current_view = "pipeline"
79 # Both widgets are always visible in horizontal layout
80 # This method is kept for compatibility but doesn't hide anything
82 def show_plate_manager(self):
83 """Focus on plate manager (but both are always visible)."""
84 self.current_view = "plate"
85 # Both widgets are always visible in horizontal layout
86 # This method is kept for compatibility but doesn't hide anything
88 def show_both(self):
89 """Show both pipeline editor and plate manager together (default behavior)."""
90 self.current_view = "both"
91 # Both widgets are always visible in horizontal layout - this is the default