Coverage for openhcs/pyqt_gui/widgets/shared/layout_constants.py: 0.0%
16 statements
« prev ^ index » next coverage.py v7.10.7, created at 2025-10-01 18:33 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2025-10-01 18:33 +0000
1"""
2Layout constants for PyQt parameter forms.
4This module centralizes all spacing, margin, and layout configuration
5to ensure uniform appearance across all parameter forms.
6"""
8from dataclasses import dataclass
11@dataclass(frozen=True)
12class ParameterFormLayoutConfig:
13 """Configuration for parameter form layout spacing and margins."""
15 # Main form layout settings
16 main_layout_spacing: int = 2
17 main_layout_margins: tuple = (4, 4, 4, 4) # left, top, right, bottom
19 # Content layout settings (between parameter fields)
20 content_layout_spacing: int = 1
21 content_layout_margins: tuple = (2, 2, 2, 2)
23 # Parameter row layout settings (between label, widget, button)
24 parameter_row_spacing: int = 4
25 parameter_row_margins: tuple = (0, 0, 0, 0)
27 # Optional parameter layout settings (checkbox + nested content)
28 optional_layout_spacing: int = 2
29 optional_layout_margins: tuple = (0, 0, 0, 0)
31 # Reset button width
32 reset_button_width: int = 60
35# Default compact configuration
36COMPACT_LAYOUT = ParameterFormLayoutConfig()
38# Alternative configurations for different use cases
39SPACIOUS_LAYOUT = ParameterFormLayoutConfig(
40 main_layout_spacing=6,
41 main_layout_margins=(8, 8, 8, 8),
42 content_layout_spacing=4,
43 content_layout_margins=(4, 4, 4, 4),
44 parameter_row_spacing=8,
45 optional_layout_spacing=4,
46 reset_button_width=80
47)
49ULTRA_COMPACT_LAYOUT = ParameterFormLayoutConfig(
50 main_layout_spacing=1,
51 main_layout_margins=(2, 2, 2, 2),
52 content_layout_spacing=0,
53 content_layout_margins=(1, 1, 1, 1),
54 parameter_row_spacing=2,
55 parameter_row_margins=(0, 0, 0, 0),
56 optional_layout_spacing=1,
57 optional_layout_margins=(0, 0, 0, 0),
58 reset_button_width=50
59)
61# Current active configuration - change this to switch layouts globally
62CURRENT_LAYOUT = COMPACT_LAYOUT