""" Select Layout """ import os from pathlib import Path from potato.ai.ai_help_wrapper import get_ai_wrapper, get_dynamic_ai_help from .identifier_utils import ( safe_generate_layout, generate_element_identifier, generate_validation_attribute, escape_html_content, generate_layout_attributes ) def generate_select_layout(annotation_scheme): """ Generate HTML for a select dropdown interface. Args: annotation_scheme (dict): Configuration including: - name: Schema identifier - description: Display description - labels: List of options or path to file containing options - use_predefined_labels: Use predefined label sets (country, ethnicity, religion) - label_requirement (dict): Optional validation settings - required (bool): Whether selection is mandatory Returns: tuple: (html_string, key_bindings) html_string: Complete HTML for the select interface key_bindings: Empty list (no keyboard shortcuts) """ return safe_generate_layout(annotation_scheme, _generate_select_layout_internal) def _generate_select_layout_internal(annotation_scheme): """ Internal function to generate select layout after validation. """ # Generate consistent identifiers identifiers = generate_element_identifier(annotation_scheme["name"], "select-one", "select") validation = generate_validation_attribute(annotation_scheme) # Get layout attributes for grid positioning layout_attrs = generate_layout_attributes(annotation_scheme) schematic = ( f'
\n" return schematic, []