Coverage for src / ezqt_app / domain / models / ui.py: 100.00%

16 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-06 13:12 +0000

1# /////////////////////////////////////////////////////////////// 

2# DOMAIN.MODELS.UI - UI component specifications 

3# Project: ezqt_app 

4# /////////////////////////////////////////////////////////////// 

5 

6"""Pure domain specifications for UI component factories.""" 

7 

8from __future__ import annotations 

9 

10# /////////////////////////////////////////////////////////////// 

11# IMPORTS 

12# /////////////////////////////////////////////////////////////// 

13# Standard library imports 

14from dataclasses import dataclass 

15 

16 

17# /////////////////////////////////////////////////////////////// 

18# DATACLASSES 

19# /////////////////////////////////////////////////////////////// 

20@dataclass(frozen=True) 

21class FontSpec: 

22 """Immutable specification for a ``QFont`` instance.""" 

23 

24 family: str 

25 point_size: int 

26 bold: bool = False 

27 italic: bool = False 

28 

29 

30@dataclass(frozen=True) 

31class SizePolicySpec: 

32 """Immutable specification for a ``QSizePolicy`` instance.""" 

33 

34 horizontal_policy: str 

35 vertical_policy: str 

36 horizontal_stretch: int = 0 

37 vertical_stretch: int = 0 

38 

39 

40# /////////////////////////////////////////////////////////////// 

41# SPECIFICATIONS 

42# /////////////////////////////////////////////////////////////// 

43FONT_SPECS: dict[str, FontSpec] = { 

44 "SEGOE_UI_8_REG": FontSpec(family="Segoe UI", point_size=8), 

45 "SEGOE_UI_10_REG": FontSpec(family="Segoe UI", point_size=10), 

46 "SEGOE_UI_12_REG": FontSpec(family="Segoe UI", point_size=12), 

47 "SEGOE_UI_8_SB": FontSpec(family="Segoe UI Semibold", point_size=8), 

48 "SEGOE_UI_10_SB": FontSpec(family="Segoe UI Semibold", point_size=10), 

49 "SEGOE_UI_12_SB": FontSpec(family="Segoe UI Semibold", point_size=12), 

50} 

51 

52SIZE_POLICY_SPECS: dict[str, SizePolicySpec] = { 

53 "H_EXPANDING_V_FIXED": SizePolicySpec( 

54 horizontal_policy="Expanding", 

55 vertical_policy="Fixed", 

56 ), 

57 "H_EXPANDING_V_PREFERRED": SizePolicySpec( 

58 horizontal_policy="Expanding", 

59 vertical_policy="Preferred", 

60 ), 

61 "H_PREFERRED_V_EXPANDING": SizePolicySpec( 

62 horizontal_policy="Preferred", 

63 vertical_policy="Expanding", 

64 ), 

65 "H_EXPANDING_V_EXPANDING": SizePolicySpec( 

66 horizontal_policy="Expanding", 

67 vertical_policy="Expanding", 

68 ), 

69}