mirror of
				https://github.com/checktheroads/hyperglass
				synced 2024-05-11 05:55:08 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			73 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| """UI Configuration models."""
 | |
| 
 | |
| # Standard Library
 | |
| from typing import Any, Dict, List, Tuple, Union, Literal, Optional
 | |
| 
 | |
| # Third Party
 | |
| from pydantic import StrictStr, StrictBool
 | |
| 
 | |
| # Local
 | |
| from .main import HyperglassModel
 | |
| from .config.web import WebPublic
 | |
| from .config.cache import CachePublic
 | |
| from .config.params import ParamsPublic
 | |
| from .config.messages import Messages
 | |
| 
 | |
| Alignment = Union[Literal["left"], Literal["center"], Literal["right"], None]
 | |
| StructuredDataField = Tuple[str, str, Alignment]
 | |
| 
 | |
| 
 | |
| class UIDirectiveInfo(HyperglassModel):
 | |
|     """UI: Directive Info."""
 | |
| 
 | |
|     enable: StrictBool
 | |
|     params: Dict[str, str]
 | |
|     content: StrictStr
 | |
| 
 | |
| 
 | |
| class UIDirective(HyperglassModel):
 | |
|     """UI: Directive."""
 | |
| 
 | |
|     id: StrictStr
 | |
|     name: StrictStr
 | |
|     field_type: StrictStr
 | |
|     groups: List[StrictStr]
 | |
|     description: StrictStr
 | |
|     info: Optional[UIDirectiveInfo] = None
 | |
|     options: Optional[List[Dict[str, Any]]]
 | |
| 
 | |
| 
 | |
| class UILocation(HyperglassModel):
 | |
|     """UI: Location (Device)."""
 | |
| 
 | |
|     id: StrictStr
 | |
|     name: StrictStr
 | |
|     network: StrictStr
 | |
|     directives: List[UIDirective] = []
 | |
| 
 | |
| 
 | |
| class UINetwork(HyperglassModel):
 | |
|     """UI: Network."""
 | |
| 
 | |
|     display_name: StrictStr
 | |
|     locations: List[UILocation] = []
 | |
| 
 | |
| 
 | |
| class UIContent(HyperglassModel):
 | |
|     """UI: Content."""
 | |
| 
 | |
|     credit: StrictStr
 | |
|     greeting: StrictStr
 | |
| 
 | |
| 
 | |
| class UIParameters(ParamsPublic, HyperglassModel):
 | |
|     """UI Configuration Parameters."""
 | |
| 
 | |
|     cache: CachePublic
 | |
|     web: WebPublic
 | |
|     messages: Messages
 | |
|     version: StrictStr
 | |
|     networks: List[UINetwork] = []
 | |
|     parsed_data_fields: Tuple[StructuredDataField, ...]
 | |
|     content: UIContent
 |