PyWebWinUI3 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. pywebwinui3/__init__.py +3 -0
  2. pywebwinui3/core.py +176 -0
  3. pywebwinui3/event.py +147 -0
  4. pywebwinui3/qt.py +887 -0
  5. pywebwinui3/type.py +362 -0
  6. pywebwinui3/util.py +194 -0
  7. pywebwinui3/web/Pretendard/PretendardVariable.subset.0.woff2 +0 -0
  8. pywebwinui3/web/Pretendard/PretendardVariable.subset.1.woff2 +0 -0
  9. pywebwinui3/web/Pretendard/PretendardVariable.subset.10.woff2 +0 -0
  10. pywebwinui3/web/Pretendard/PretendardVariable.subset.11.woff2 +0 -0
  11. pywebwinui3/web/Pretendard/PretendardVariable.subset.12.woff2 +0 -0
  12. pywebwinui3/web/Pretendard/PretendardVariable.subset.13.woff2 +0 -0
  13. pywebwinui3/web/Pretendard/PretendardVariable.subset.14.woff2 +0 -0
  14. pywebwinui3/web/Pretendard/PretendardVariable.subset.15.woff2 +0 -0
  15. pywebwinui3/web/Pretendard/PretendardVariable.subset.16.woff2 +0 -0
  16. pywebwinui3/web/Pretendard/PretendardVariable.subset.17.woff2 +0 -0
  17. pywebwinui3/web/Pretendard/PretendardVariable.subset.18.woff2 +0 -0
  18. pywebwinui3/web/Pretendard/PretendardVariable.subset.19.woff2 +0 -0
  19. pywebwinui3/web/Pretendard/PretendardVariable.subset.2.woff2 +0 -0
  20. pywebwinui3/web/Pretendard/PretendardVariable.subset.20.woff2 +0 -0
  21. pywebwinui3/web/Pretendard/PretendardVariable.subset.21.woff2 +0 -0
  22. pywebwinui3/web/Pretendard/PretendardVariable.subset.22.woff2 +0 -0
  23. pywebwinui3/web/Pretendard/PretendardVariable.subset.23.woff2 +0 -0
  24. pywebwinui3/web/Pretendard/PretendardVariable.subset.24.woff2 +0 -0
  25. pywebwinui3/web/Pretendard/PretendardVariable.subset.25.woff2 +0 -0
  26. pywebwinui3/web/Pretendard/PretendardVariable.subset.26.woff2 +0 -0
  27. pywebwinui3/web/Pretendard/PretendardVariable.subset.27.woff2 +0 -0
  28. pywebwinui3/web/Pretendard/PretendardVariable.subset.28.woff2 +0 -0
  29. pywebwinui3/web/Pretendard/PretendardVariable.subset.29.woff2 +0 -0
  30. pywebwinui3/web/Pretendard/PretendardVariable.subset.3.woff2 +0 -0
  31. pywebwinui3/web/Pretendard/PretendardVariable.subset.30.woff2 +0 -0
  32. pywebwinui3/web/Pretendard/PretendardVariable.subset.31.woff2 +0 -0
  33. pywebwinui3/web/Pretendard/PretendardVariable.subset.32.woff2 +0 -0
  34. pywebwinui3/web/Pretendard/PretendardVariable.subset.33.woff2 +0 -0
  35. pywebwinui3/web/Pretendard/PretendardVariable.subset.34.woff2 +0 -0
  36. pywebwinui3/web/Pretendard/PretendardVariable.subset.35.woff2 +0 -0
  37. pywebwinui3/web/Pretendard/PretendardVariable.subset.36.woff2 +0 -0
  38. pywebwinui3/web/Pretendard/PretendardVariable.subset.37.woff2 +0 -0
  39. pywebwinui3/web/Pretendard/PretendardVariable.subset.38.woff2 +0 -0
  40. pywebwinui3/web/Pretendard/PretendardVariable.subset.39.woff2 +0 -0
  41. pywebwinui3/web/Pretendard/PretendardVariable.subset.4.woff2 +0 -0
  42. pywebwinui3/web/Pretendard/PretendardVariable.subset.40.woff2 +0 -0
  43. pywebwinui3/web/Pretendard/PretendardVariable.subset.41.woff2 +0 -0
  44. pywebwinui3/web/Pretendard/PretendardVariable.subset.42.woff2 +0 -0
  45. pywebwinui3/web/Pretendard/PretendardVariable.subset.43.woff2 +0 -0
  46. pywebwinui3/web/Pretendard/PretendardVariable.subset.44.woff2 +0 -0
  47. pywebwinui3/web/Pretendard/PretendardVariable.subset.45.woff2 +0 -0
  48. pywebwinui3/web/Pretendard/PretendardVariable.subset.46.woff2 +0 -0
  49. pywebwinui3/web/Pretendard/PretendardVariable.subset.47.woff2 +0 -0
  50. pywebwinui3/web/Pretendard/PretendardVariable.subset.48.woff2 +0 -0
  51. pywebwinui3/web/Pretendard/PretendardVariable.subset.49.woff2 +0 -0
  52. pywebwinui3/web/Pretendard/PretendardVariable.subset.5.woff2 +0 -0
  53. pywebwinui3/web/Pretendard/PretendardVariable.subset.50.woff2 +0 -0
  54. pywebwinui3/web/Pretendard/PretendardVariable.subset.51.woff2 +0 -0
  55. pywebwinui3/web/Pretendard/PretendardVariable.subset.52.woff2 +0 -0
  56. pywebwinui3/web/Pretendard/PretendardVariable.subset.53.woff2 +0 -0
  57. pywebwinui3/web/Pretendard/PretendardVariable.subset.54.woff2 +0 -0
  58. pywebwinui3/web/Pretendard/PretendardVariable.subset.55.woff2 +0 -0
  59. pywebwinui3/web/Pretendard/PretendardVariable.subset.56.woff2 +0 -0
  60. pywebwinui3/web/Pretendard/PretendardVariable.subset.57.woff2 +0 -0
  61. pywebwinui3/web/Pretendard/PretendardVariable.subset.58.woff2 +0 -0
  62. pywebwinui3/web/Pretendard/PretendardVariable.subset.59.woff2 +0 -0
  63. pywebwinui3/web/Pretendard/PretendardVariable.subset.6.woff2 +0 -0
  64. pywebwinui3/web/Pretendard/PretendardVariable.subset.60.woff2 +0 -0
  65. pywebwinui3/web/Pretendard/PretendardVariable.subset.61.woff2 +0 -0
  66. pywebwinui3/web/Pretendard/PretendardVariable.subset.62.woff2 +0 -0
  67. pywebwinui3/web/Pretendard/PretendardVariable.subset.63.woff2 +0 -0
  68. pywebwinui3/web/Pretendard/PretendardVariable.subset.64.woff2 +0 -0
  69. pywebwinui3/web/Pretendard/PretendardVariable.subset.65.woff2 +0 -0
  70. pywebwinui3/web/Pretendard/PretendardVariable.subset.66.woff2 +0 -0
  71. pywebwinui3/web/Pretendard/PretendardVariable.subset.67.woff2 +0 -0
  72. pywebwinui3/web/Pretendard/PretendardVariable.subset.68.woff2 +0 -0
  73. pywebwinui3/web/Pretendard/PretendardVariable.subset.69.woff2 +0 -0
  74. pywebwinui3/web/Pretendard/PretendardVariable.subset.7.woff2 +0 -0
  75. pywebwinui3/web/Pretendard/PretendardVariable.subset.70.woff2 +0 -0
  76. pywebwinui3/web/Pretendard/PretendardVariable.subset.71.woff2 +0 -0
  77. pywebwinui3/web/Pretendard/PretendardVariable.subset.72.woff2 +0 -0
  78. pywebwinui3/web/Pretendard/PretendardVariable.subset.73.woff2 +0 -0
  79. pywebwinui3/web/Pretendard/PretendardVariable.subset.74.woff2 +0 -0
  80. pywebwinui3/web/Pretendard/PretendardVariable.subset.75.woff2 +0 -0
  81. pywebwinui3/web/Pretendard/PretendardVariable.subset.76.woff2 +0 -0
  82. pywebwinui3/web/Pretendard/PretendardVariable.subset.77.woff2 +0 -0
  83. pywebwinui3/web/Pretendard/PretendardVariable.subset.78.woff2 +0 -0
  84. pywebwinui3/web/Pretendard/PretendardVariable.subset.79.woff2 +0 -0
  85. pywebwinui3/web/Pretendard/PretendardVariable.subset.8.woff2 +0 -0
  86. pywebwinui3/web/Pretendard/PretendardVariable.subset.80.woff2 +0 -0
  87. pywebwinui3/web/Pretendard/PretendardVariable.subset.81.woff2 +0 -0
  88. pywebwinui3/web/Pretendard/PretendardVariable.subset.82.woff2 +0 -0
  89. pywebwinui3/web/Pretendard/PretendardVariable.subset.83.woff2 +0 -0
  90. pywebwinui3/web/Pretendard/PretendardVariable.subset.84.woff2 +0 -0
  91. pywebwinui3/web/Pretendard/PretendardVariable.subset.85.woff2 +0 -0
  92. pywebwinui3/web/Pretendard/PretendardVariable.subset.86.woff2 +0 -0
  93. pywebwinui3/web/Pretendard/PretendardVariable.subset.87.woff2 +0 -0
  94. pywebwinui3/web/Pretendard/PretendardVariable.subset.88.woff2 +0 -0
  95. pywebwinui3/web/Pretendard/PretendardVariable.subset.89.woff2 +0 -0
  96. pywebwinui3/web/Pretendard/PretendardVariable.subset.9.woff2 +0 -0
  97. pywebwinui3/web/Pretendard/PretendardVariable.subset.90.woff2 +0 -0
  98. pywebwinui3/web/Pretendard/PretendardVariable.subset.91.woff2 +0 -0
  99. pywebwinui3/web/Pretendard/Variable-dynamic-subset.min.css +927 -0
  100. pywebwinui3/web/SegoeFluentIcons.ttf +0 -0
  101. pywebwinui3/web/_app/env.js +1 -0
  102. pywebwinui3/web/_app/immutable/assets/2.wYBxhgNe.css +1 -0
  103. pywebwinui3/web/_app/immutable/chunks/BeVEiAlX.js +1 -0
  104. pywebwinui3/web/_app/immutable/chunks/C-ZTJ6AF.js +1 -0
  105. pywebwinui3/web/_app/immutable/chunks/D2X8AmeL.js +1 -0
  106. pywebwinui3/web/_app/immutable/chunks/DLxx5-LD.js +2 -0
  107. pywebwinui3/web/_app/immutable/chunks/DPxT1AeO.js +1 -0
  108. pywebwinui3/web/_app/immutable/chunks/DZb1s-qq.js +1 -0
  109. pywebwinui3/web/_app/immutable/chunks/DbLPBgK4.js +1 -0
  110. pywebwinui3/web/_app/immutable/chunks/d_V4Mktp.js +1 -0
  111. pywebwinui3/web/_app/immutable/chunks/pGvP_QvR.js +1 -0
  112. pywebwinui3/web/_app/immutable/entry/app.DgyHcM8N.js +2 -0
  113. pywebwinui3/web/_app/immutable/entry/start.D7vHaDGu.js +1 -0
  114. pywebwinui3/web/_app/immutable/nodes/0.DO1mLoyu.js +54 -0
  115. pywebwinui3/web/_app/immutable/nodes/1.DvyFB-Wy.js +1 -0
  116. pywebwinui3/web/_app/immutable/nodes/2.CrF9bZZd.js +94 -0
  117. pywebwinui3/web/_app/version.json +1 -0
  118. pywebwinui3/web/index.html +101 -0
  119. pywebwinui3-1.0.0.dist-info/METADATA +92 -0
  120. pywebwinui3-1.0.0.dist-info/RECORD +124 -0
  121. pywebwinui3-1.0.0.dist-info/WHEEL +5 -0
  122. pywebwinui3-1.0.0.dist-info/licenses/LICENSE +201 -0
  123. pywebwinui3-1.0.0.dist-info/licenses/NOTICE +13 -0
  124. pywebwinui3-1.0.0.dist-info/top_level.txt +1 -0
pywebwinui3/type.py ADDED
@@ -0,0 +1,362 @@
1
+ class Status:
2
+ Attention = 0
3
+ Success = 1
4
+ Caution = 2
5
+ Critical = 3
6
+ Neutral = 4
7
+
8
+ class ThemeResource:
9
+ TextFillColorPrimaryBrush = "var(--TextFillColorPrimaryBrush)"
10
+ TextFillColorSecondaryBrush = "var(--TextFillColorSecondaryBrush)"
11
+ TextFillColorTertiaryBrush = "var(--TextFillColorTertiaryBrush)"
12
+ TextFillColorDisabledBrush = "var(--TextFillColorDisabledBrush)"
13
+ TextFillColorInverseBrush = "var(--TextFillColorInverseBrush)"
14
+ AccentTextFillColorPrimaryBrush = "var(--AccentTextFillColorPrimaryBrush)"
15
+ AccentTextFillColorSecondaryBrush = "var(--AccentTextFillColorSecondaryBrush)"
16
+ AccentTextFillColorTertiaryBrush = "var(--AccentTextFillColorTertiaryBrush)"
17
+ AccentTextFillColorDisabledBrush = "var(--AccentTextFillColorDisabledBrush)"
18
+ TextOnAccentFillColorPrimaryBrush = "var(--TextOnAccentFillColorPrimaryBrush)"
19
+ TextOnAccentFillColorSecondaryBrush = "var(--TextOnAccentFillColorSecondaryBrush)"
20
+ TextOnAccentFillColorDisabledBrush = "var(--TextOnAccentFillColorDisabledBrush)"
21
+ TextOnAccentFillColorSelectedTextBrush = "var(--TextOnAccentFillColorSelectedTextBrush)"
22
+ ControlFillColorDefaultBrush = "var(--ControlFillColorDefaultBrush)"
23
+ ControlFillColorSecondaryBrush = "var(--ControlFillColorSecondaryBrush)"
24
+ ControlFillColorTertiaryBrush = "var(--ControlFillColorTertiaryBrush)"
25
+ ControlFillColorDisabledBrush = "var(--ControlFillColorDisabledBrush)"
26
+ ControlFillColorTransparentBrush = "var(--ControlFillColorTransparentBrush)"
27
+ ControlFillColorInputActiveBrush = "var(--ControlFillColorInputActiveBrush)"
28
+ ControlAltFillColorTransparentBrush = "var(--ControlAltFillColorTransparentBrush)"
29
+ ControlAltFillColorSecondaryBrush = "var(--ControlAltFillColorSecondaryBrush)"
30
+ ControlAltFillColorTertiaryBrush = "var(--ControlAltFillColorTertiaryBrush)"
31
+ ControlAltFillColorQuarternaryBrush = "var(--ControlAltFillColorQuarternaryBrush)"
32
+ ControlAltFillColorDisabledBrush = "var(--ControlAltFillColorDisabledBrush)"
33
+ ControlSolidFillColorDefaultBrush = "var(--ControlSolidFillColorDefaultBrush)"
34
+ ControlStrongFillColorDefaultBrush = "var(--ControlStrongFillColorDefaultBrush)"
35
+ ControlStrongFillColorDisabledBrush = "var(--ControlStrongFillColorDisabledBrush)"
36
+ ControlOnImageFillColorDefaultBrush = "var(--ControlOnImageFillColorDefaultBrush)"
37
+ ControlOnImageFillColorSecondaryBrush = "var(--ControlOnImageFillColorSecondaryBrush)"
38
+ ControlOnImageFillColorTertiaryBrush = "var(--ControlOnImageFillColorTertiaryBrush)"
39
+ ControlOnImageFillColorDisabledBrush = "var(--ControlOnImageFillColorDisabledBrush)"
40
+ SubtleFillColorTransparentBrush = "var(--SubtleFillColorTransparentBrush)"
41
+ SubtleFillColorSecondaryBrush = "var(--SubtleFillColorSecondaryBrush)"
42
+ SubtleFillColorTertiaryBrush = "var(--SubtleFillColorTertiaryBrush)"
43
+ SubtleFillColorDisabledBrush = "var(--SubtleFillColorDisabledBrush)"
44
+ AccentFillColorDefaultBrush = "var(--AccentFillColorDefaultBrush)"
45
+ AccentFillColorSecondaryBrush = "var(--AccentFillColorSecondaryBrush)"
46
+ AccentFillColorTertiaryBrush = "var(--AccentFillColorTertiaryBrush)"
47
+ AccentFillColorDisabledBrush = "var(--AccentFillColorDisabledBrush)"
48
+ AccentFillColorSelectedTextBackgroundBrush = "var(--AccentFillColorSelectedTextBackgroundBrush)"
49
+ CardStrokeColorDefaultBrush = "var(--CardStrokeColorDefaultBrush)"
50
+ CardStrokeColorDefaultSolidBrush = "var(--CardStrokeColorDefaultSolidBrush)"
51
+ ControlStrokeColorDefaultBrush = "var(--ControlStrokeColorDefaultBrush)"
52
+ ControlStrokeColorSecondaryBrush = "var(--ControlStrokeColorSecondaryBrush)"
53
+ ControlStrokeColorOnAccentDefaultBrush = "var(--ControlStrokeColorOnAccentDefaultBrush)"
54
+ ControlStrokeColorOnAccentSecondaryBrush = "var(--ControlStrokeColorOnAccentSecondaryBrush)"
55
+ ControlStrokeColorOnAccentTertiaryBrush = "var(--ControlStrokeColorOnAccentTertiaryBrush)"
56
+ ControlStrokeColorOnAccentDisabledBrush = "var(--ControlStrokeColorOnAccentDisabledBrush)"
57
+ ControlStrokeColorForStrongFillWhenOnImageBrush = "var(--ControlStrokeColorForStrongFillWhenOnImageBrush)"
58
+ ControlStrongStrokeColorDefaultBrush = "var(--ControlStrongStrokeColorDefaultBrush)"
59
+ ControlStrongStrokeColorDisabledBrush = "var(--ControlStrongStrokeColorDisabledBrush)"
60
+ SurfaceStrokeColorDefaultBrush = "var(--SurfaceStrokeColorDefaultBrush)"
61
+ SurfaceStrokeColorFlyoutBrush = "var(--SurfaceStrokeColorFlyoutBrush)"
62
+ SurfaceStrokeColorInverseBrush = "var(--SurfaceStrokeColorInverseBrush)"
63
+ DividerStrokeColorDefaultBrush = "var(--DividerStrokeColorDefaultBrush)"
64
+ FocusStrokeColorOuterBrush = "var(--FocusStrokeColorOuterBrush)"
65
+ FocusStrokeColorInnerBrush = "var(--FocusStrokeColorInnerBrush)"
66
+ CardBackgroundFillColorDefaultBrush = "var(--CardBackgroundFillColorDefaultBrush)"
67
+ CardBackgroundFillColorSecondaryBrush = "var(--CardBackgroundFillColorSecondaryBrush)"
68
+ SmokeFillColorDefaultBrush = "var(--SmokeFillColorDefaultBrush)"
69
+ LayerFillColorDefaultBrush = "var(--LayerFillColorDefaultBrush)"
70
+ LayerFillColorAltBrush = "var(--LayerFillColorAltBrush)"
71
+ LayerOnAcrylicFillColorDefaultBrush = "var(--LayerOnAcrylicFillColorDefaultBrush)"
72
+ LayerOnAccentAcrylicFillColorDefaultBrush = "var(--LayerOnAccentAcrylicFillColorDefaultBrush)"
73
+ LayerOnMicaBaseAltFillColorDefaultBrush = "var(--LayerOnMicaBaseAltFillColorDefaultBrush)"
74
+ LayerOnMicaBaseAltFillColorSecondaryBrush = "var(--LayerOnMicaBaseAltFillColorSecondaryBrush)"
75
+ LayerOnMicaBaseAltFillColorTertiaryBrush = "var(--LayerOnMicaBaseAltFillColorTertiaryBrush)"
76
+ LayerOnMicaBaseAltFillColorTransparentBrush = "var(--LayerOnMicaBaseAltFillColorTransparentBrush)"
77
+ SolidBackgroundFillColorBaseBrush = "var(--SolidBackgroundFillColorBaseBrush)"
78
+ SolidBackgroundFillColorSecondaryBrush = "var(--SolidBackgroundFillColorSecondaryBrush)"
79
+ SolidBackgroundFillColorTertiaryBrush = "var(--SolidBackgroundFillColorTertiaryBrush)"
80
+ SolidBackgroundFillColorQuarternaryBrush = "var(--SolidBackgroundFillColorQuarternaryBrush)"
81
+ SolidBackgroundFillColorBaseAltBrush = "var(--SolidBackgroundFillColorBaseAltBrush)"
82
+ SystemFillColorAttentionBrush = "var(--SystemFillColorAttentionBrush)"
83
+ SystemFillColorSuccessBrush = "var(--SystemFillColorSuccessBrush)"
84
+ SystemFillColorCautionBrush = "var(--SystemFillColorCautionBrush)"
85
+ SystemFillColorCriticalBrush = "var(--SystemFillColorCriticalBrush)"
86
+ SystemFillColorNeutralBrush = "var(--SystemFillColorNeutralBrush)"
87
+ SystemFillColorAttentionBackgroundBrush = "var(--SystemFillColorAttentionBackgroundBrush)"
88
+ SystemFillColorSuccessBackgroundBrush = "var(--SystemFillColorSuccessBackgroundBrush)"
89
+ SystemFillColorCautionBackgroundBrush = "var(--SystemFillColorCautionBackgroundBrush)"
90
+ SystemFillColorCriticalBackgroundBrush = "var(--SystemFillColorCriticalBackgroundBrush)"
91
+ SystemFillColorNeutralBackgroundBrush = "var(--SystemFillColorNeutralBackgroundBrush)"
92
+ SystemFillColorSolidNeutralBrush = "var(--SystemFillColorSolidNeutralBrush)"
93
+ SystemFillColorSolidAttentionBackgroundBrush = "var(--SystemFillColorSolidAttentionBackgroundBrush)"
94
+ SystemFillColorSolidNeutralBackgroundBrush = "var(--SystemFillColorSolidNeutralBackgroundBrush)"
95
+
96
+ class Color:
97
+
98
+ class Fill:
99
+
100
+ class Text:
101
+ Primary = ThemeResource.TextFillColorPrimaryBrush
102
+ Secondary = ThemeResource.TextFillColorSecondaryBrush
103
+ Tertiary = ThemeResource.TextFillColorTertiaryBrush
104
+ Disabled = ThemeResource.TextFillColorDisabledBrush
105
+ Inverse = ThemeResource.TextFillColorInverseBrush
106
+
107
+ class Accent:
108
+ Primary = ThemeResource.AccentTextFillColorPrimaryBrush
109
+ Secondary = ThemeResource.AccentTextFillColorSecondaryBrush
110
+ Tertiary = ThemeResource.AccentTextFillColorTertiaryBrush
111
+ Disabled = ThemeResource.AccentTextFillColorDisabledBrush
112
+
113
+ class OnAccent:
114
+ Primary = ThemeResource.TextOnAccentFillColorPrimaryBrush
115
+ Secondary = ThemeResource.TextOnAccentFillColorSecondaryBrush
116
+ Disabled = ThemeResource.TextOnAccentFillColorDisabledBrush
117
+ SelectedText = ThemeResource.TextOnAccentFillColorSelectedTextBrush
118
+
119
+ class Control:
120
+ Default = ThemeResource.ControlFillColorDefaultBrush
121
+ Secondary = ThemeResource.ControlFillColorSecondaryBrush
122
+ Tertiary = ThemeResource.ControlFillColorTertiaryBrush
123
+ Disabled = ThemeResource.ControlFillColorDisabledBrush
124
+ Transparent = ThemeResource.ControlFillColorTransparentBrush
125
+ InputActive = ThemeResource.ControlFillColorInputActiveBrush
126
+
127
+ class Alt:
128
+ Transparent = ThemeResource.ControlAltFillColorTransparentBrush
129
+ Secondary = ThemeResource.ControlAltFillColorSecondaryBrush
130
+ Tertiary = ThemeResource.ControlAltFillColorTertiaryBrush
131
+ Quarternary = ThemeResource.ControlAltFillColorQuarternaryBrush
132
+ Disabled = ThemeResource.ControlAltFillColorDisabledBrush
133
+
134
+ class Solid:
135
+ Default = ThemeResource.ControlSolidFillColorDefaultBrush
136
+
137
+ class Strong:
138
+ Default = ThemeResource.ControlStrongFillColorDefaultBrush
139
+ Disabled = ThemeResource.ControlStrongFillColorDisabledBrush
140
+
141
+ class OnImage:
142
+ Default = ThemeResource.ControlOnImageFillColorDefaultBrush
143
+ Secondary = ThemeResource.ControlOnImageFillColorSecondaryBrush
144
+ Tertiary = ThemeResource.ControlOnImageFillColorTertiaryBrush
145
+ Disabled = ThemeResource.ControlOnImageFillColorDisabledBrush
146
+
147
+ class Subtle:
148
+ Transparent = ThemeResource.SubtleFillColorTransparentBrush
149
+ Secondary = ThemeResource.SubtleFillColorSecondaryBrush
150
+ Tertiary = ThemeResource.SubtleFillColorTertiaryBrush
151
+ Disabled = ThemeResource.SubtleFillColorDisabledBrush
152
+
153
+ class Accent:
154
+ Default = ThemeResource.AccentFillColorDefaultBrush
155
+ Secondary = ThemeResource.AccentFillColorSecondaryBrush
156
+ Tertiary = ThemeResource.AccentFillColorTertiaryBrush
157
+ Disabled = ThemeResource.AccentFillColorDisabledBrush
158
+ SelectedTextBackground = ThemeResource.AccentFillColorSelectedTextBackgroundBrush
159
+
160
+ class Smoke:
161
+ Default = ThemeResource.SmokeFillColorDefaultBrush
162
+
163
+ class Layer:
164
+ Default = ThemeResource.LayerFillColorDefaultBrush
165
+ Alt = ThemeResource.LayerFillColorAltBrush
166
+
167
+ class OnAcrylic:
168
+ Default = ThemeResource.LayerOnAcrylicFillColorDefaultBrush
169
+
170
+ class OnAccentAcrylic:
171
+ Default = ThemeResource.LayerOnAccentAcrylicFillColorDefaultBrush
172
+
173
+ class OnMicaBaseAlt:
174
+ Default = ThemeResource.LayerOnMicaBaseAltFillColorDefaultBrush
175
+ Secondary = ThemeResource.LayerOnMicaBaseAltFillColorSecondaryBrush
176
+ Tertiary = ThemeResource.LayerOnMicaBaseAltFillColorTertiaryBrush
177
+ Transparent = ThemeResource.LayerOnMicaBaseAltFillColorTransparentBrush
178
+
179
+ class System:
180
+ Attention = ThemeResource.SystemFillColorAttentionBrush
181
+ Success = ThemeResource.SystemFillColorSuccessBrush
182
+ Caution = ThemeResource.SystemFillColorCautionBrush
183
+ Critical = ThemeResource.SystemFillColorCriticalBrush
184
+ Neutral = ThemeResource.SystemFillColorNeutralBrush
185
+
186
+ class Solid:
187
+ Neutral = ThemeResource.SystemFillColorSolidNeutralBrush
188
+
189
+ class Stroke:
190
+
191
+ class Card:
192
+ Default = ThemeResource.CardStrokeColorDefaultBrush
193
+ DefaultSolid = ThemeResource.CardStrokeColorDefaultSolidBrush
194
+
195
+ class Control:
196
+ Default = ThemeResource.ControlStrokeColorDefaultBrush
197
+ Secondary = ThemeResource.ControlStrokeColorSecondaryBrush
198
+ OnAccentDefault = ThemeResource.ControlStrokeColorOnAccentDefaultBrush
199
+ OnAccentSecondary = ThemeResource.ControlStrokeColorOnAccentSecondaryBrush
200
+ OnAccentTertiary = ThemeResource.ControlStrokeColorOnAccentTertiaryBrush
201
+ OnAccentDisabled = ThemeResource.ControlStrokeColorOnAccentDisabledBrush
202
+ ForStrongFillWhenOnImage = ThemeResource.ControlStrokeColorForStrongFillWhenOnImageBrush
203
+
204
+ class Strong:
205
+ Default = ThemeResource.ControlStrongStrokeColorDefaultBrush
206
+ Disabled = ThemeResource.ControlStrongStrokeColorDisabledBrush
207
+
208
+ class Surface:
209
+ Default = ThemeResource.SurfaceStrokeColorDefaultBrush
210
+ Flyout = ThemeResource.SurfaceStrokeColorFlyoutBrush
211
+ Inverse = ThemeResource.SurfaceStrokeColorInverseBrush
212
+
213
+ class Divider:
214
+ Default = ThemeResource.DividerStrokeColorDefaultBrush
215
+
216
+ class Focus:
217
+ Outer = ThemeResource.FocusStrokeColorOuterBrush
218
+ Inner = ThemeResource.FocusStrokeColorInnerBrush
219
+
220
+ class Background:
221
+
222
+ class Solid:
223
+ Base = ThemeResource.SolidBackgroundFillColorBaseBrush
224
+ Secondary = ThemeResource.SolidBackgroundFillColorSecondaryBrush
225
+ Tertiary = ThemeResource.SolidBackgroundFillColorTertiaryBrush
226
+ Quarternary = ThemeResource.SolidBackgroundFillColorQuarternaryBrush
227
+ BaseAlt = ThemeResource.SolidBackgroundFillColorBaseAltBrush
228
+
229
+ class Card:
230
+ Default = ThemeResource.CardBackgroundFillColorDefaultBrush
231
+ Secondary = ThemeResource.CardBackgroundFillColorSecondaryBrush
232
+
233
+ class System:
234
+ Attention = ThemeResource.SystemFillColorAttentionBackgroundBrush
235
+ Success = ThemeResource.SystemFillColorSuccessBackgroundBrush
236
+ Caution = ThemeResource.SystemFillColorCautionBackgroundBrush
237
+ Critical = ThemeResource.SystemFillColorCriticalBackgroundBrush
238
+ Neutral = ThemeResource.SystemFillColorNeutralBackgroundBrush
239
+
240
+ class Solid:
241
+ Attention = ThemeResource.SystemFillColorSolidAttentionBackgroundBrush
242
+ Neutral = ThemeResource.SystemFillColorSolidNeutralBackgroundBrush
243
+
244
+ # class Element:
245
+ # class Box:
246
+ # gap = "inherit"
247
+ # round = "4px"
248
+ # border = "1px"
249
+ # padding = "16px"
250
+ # align = "inherit"
251
+ # background = Color.Background.Card.Default
252
+ # class Button:
253
+ # disabled = False
254
+ # value = None
255
+ # width = "auto"
256
+ # height = "auto"
257
+ # type = None
258
+ # url = None
259
+ # class Check:
260
+ # disabled = False
261
+ # value = None
262
+ # align = "left"
263
+ # type = "two"
264
+ # class Expender:
265
+ # disabled = False
266
+ # gap = "inherit"
267
+ # round = "4px"
268
+ # padding = "16px"
269
+ # align = "inherit"
270
+ # class Horizontal:
271
+ # gap = "inherit"
272
+ # align = "inherit"
273
+ # class If:
274
+ # disabled = False
275
+ # value = None
276
+ # class Image:
277
+ # disabled = False
278
+ # source = None
279
+ # width = "auto"
280
+ # height = "auto"
281
+ # class Input:
282
+ # disabled = False
283
+ # width = "auto"
284
+ # height = "auto"
285
+ # type = "text"
286
+ # min = None
287
+ # max = None
288
+ # value = None
289
+ # class Line:
290
+ # margin = "0"
291
+ # size = "1"
292
+ # color = Color.Fill.Control.Strong.Default
293
+ # class Match:
294
+ # disabled = False
295
+ # value = None
296
+ # class Option:
297
+ # value = None
298
+ # class Page:
299
+ # title = None
300
+ # name = None
301
+ # path = None
302
+ # icon = ""
303
+ # state = None
304
+ # badge = None
305
+ # class Progressbar:
306
+ # disabled = False
307
+ # type = None
308
+ # width = "160px"
309
+ # value = None
310
+ # class Radio:
311
+ # disabled = False
312
+ # group = None
313
+ # value = None
314
+ # class Repeat:
315
+ # disabled = False
316
+ # data = None
317
+ # value = None
318
+ # class Select:
319
+ # disabled = False
320
+ # width = "auto"
321
+ # height = "auto"
322
+ # value = None
323
+ # class Slider:
324
+ # disabled = False
325
+ # width = "160px"
326
+ # type = "horizontal"
327
+ # min = 0
328
+ # max = 100
329
+ # step = 1
330
+ # value = None
331
+ # class Space:
332
+ # factor = 1
333
+ # class Switch:
334
+ # disabled = False
335
+ # align = "left"
336
+ # on = "ON"
337
+ # off = "OFF"
338
+ # value = None
339
+ # class Text:
340
+ # disabled = False
341
+ # type = "default"
342
+ # margin = "0"
343
+ # color = None
344
+ # size = None
345
+ # url = None
346
+ # class Vertical:
347
+ # gap = "inherit"
348
+ # width = "auto"
349
+ # align = "inherit"
350
+ # class Webview:
351
+ # disabled = False
352
+ # source = None
353
+ # width = "auto"
354
+ # height = "auto"
355
+
356
+ # Other = [
357
+ # "Case",
358
+ # "True",
359
+ # "False",
360
+ # "Header",
361
+ # "Content",
362
+ # ]
pywebwinui3/util.py ADDED
@@ -0,0 +1,194 @@
1
+ import xml.etree.ElementTree
2
+ from typing import Any, Callable
3
+ import winreg
4
+ import logging
5
+ import re
6
+
7
+ from .event import PathEvent, Event
8
+
9
+ logger = logging.getLogger('pywebwinui3.util')
10
+
11
+ DEFAULT_ACCENT_PALETTE = [
12
+ "#99ebff",
13
+ "#00ccff",
14
+ "#0099ff",
15
+ "#0078d4",
16
+ "#005fb8",
17
+ "#004a92",
18
+ "#003966",
19
+ "#00264a",
20
+ ]
21
+
22
+ def xamlToJson(element: xml.etree.ElementTree.Element):
23
+ return {
24
+ "tag":element.tag,
25
+ "attr":element.attrib,
26
+ "text":(element.text or "").strip(),
27
+ "child":[xamlToJson(e) for e in element]
28
+ }
29
+
30
+ def loadPage(filePath: str):
31
+ return xamlToJson(xml.etree.ElementTree.parse(filePath).getroot())
32
+
33
+ class SyncDict(dict):
34
+ def __init__(self, init:dict=None, event:PathEvent=None, sync:Callable=None):
35
+ super().__init__(init or {})
36
+ self.event = event or PathEvent()
37
+ self.sync = sync
38
+
39
+ @staticmethod
40
+ def _parsePath(key:str):
41
+ if not isinstance(key, str) or "[" not in key:
42
+ return None
43
+ start = key.find("[")
44
+ root = key[:start]
45
+ if not root:
46
+ return None
47
+ tokens = [root]
48
+ index = start
49
+ while index < len(key):
50
+ if key[index] != "[":
51
+ return None
52
+ end = key.find("]", index + 1)
53
+ if end == -1:
54
+ return None
55
+ raw = key[index + 1:end].strip()
56
+ if not raw:
57
+ return None
58
+ if re.fullmatch(r"\d+", raw):
59
+ tokens.append(int(raw))
60
+ elif len(raw) >= 2 and raw[0] == raw[-1] and raw[0] in "'\"":
61
+ tokens.append(raw[1:-1])
62
+ else:
63
+ tokens.append(raw)
64
+ index = end + 1
65
+ return tokens
66
+
67
+ @staticmethod
68
+ def _cloneContainer(value, nextToken):
69
+ if isinstance(value, list):
70
+ return list(value)
71
+ if isinstance(value, dict):
72
+ return dict(value)
73
+ return [] if isinstance(nextToken, int) else {}
74
+
75
+ def _getPathValue(self, key:str, default=None):
76
+ tokens = self._parsePath(key)
77
+ if not tokens:
78
+ return self.get(key, default)
79
+ current = self
80
+ try:
81
+ for token in tokens:
82
+ current = current[token]
83
+ return current
84
+ except (KeyError, IndexError, TypeError):
85
+ return default
86
+
87
+ def _setPathValue(self, key:str, value:Any):
88
+ tokens = self._parsePath(key)
89
+ if not tokens:
90
+ return False
91
+
92
+ root, *segments = tokens
93
+ if not segments:
94
+ super().__setitem__(root, value)
95
+ return True
96
+
97
+ source = super().get(root)
98
+ cloned = self._cloneContainer(source, segments[0])
99
+ cursor = cloned
100
+ sourceCursor = source
101
+
102
+ for index, token in enumerate(segments[:-1]):
103
+ nextToken = segments[index + 1]
104
+ if isinstance(sourceCursor, list) and isinstance(token, int) and 0 <= token < len(sourceCursor):
105
+ sourceValue = sourceCursor[token]
106
+ elif isinstance(sourceCursor, dict):
107
+ sourceValue = sourceCursor.get(token)
108
+ else:
109
+ sourceValue = None
110
+
111
+ child = self._cloneContainer(sourceValue, nextToken)
112
+ if isinstance(cursor, list) and isinstance(token, int):
113
+ while len(cursor) <= token:
114
+ cursor.append(None)
115
+ cursor[token] = child
116
+ else:
117
+ cursor[token] = child
118
+ cursor = child
119
+ sourceCursor = sourceValue
120
+
121
+ lastToken = segments[-1]
122
+ if isinstance(cursor, list) and isinstance(lastToken, int):
123
+ while len(cursor) <= lastToken:
124
+ cursor.append(None)
125
+ cursor[lastToken] = value
126
+ else:
127
+ cursor[lastToken] = value
128
+
129
+ super().__setitem__(root, cloned)
130
+ return True
131
+
132
+ def _sync(self, key, before, after, sync):
133
+ if sync and self.sync:
134
+ self.sync(key, after)
135
+ self.event.set(key, before, after)
136
+
137
+ def __setitem__(self, key:str, value:Any, sync=True):
138
+ before = self._getPathValue(key, None)
139
+ if not self._setPathValue(key, value):
140
+ super().__setitem__(key, value)
141
+ self._sync(key, before, value, sync)
142
+ return value
143
+
144
+ def set(self, key:str, value:Any, sync=True):
145
+ return self.__setitem__(key, value, sync)
146
+
147
+ def append(self, key:str, value:Any, sync=True):
148
+ before = list(self.get(key,[]))
149
+ self.setdefault(key,[]).append(value)
150
+ self._sync(key, before, self.get(key), sync)
151
+ return self[key]
152
+
153
+ def remove(self, key:str, value:Any, sync=True):
154
+ before = list(self.get(key,[]))
155
+ self.setdefault(key,[]).remove(value)
156
+ self._sync(key, before, self.get(key), sync)
157
+ return self[key]
158
+
159
+ class AccentColorWatcher:
160
+ def __init__(self, event:Event=None):
161
+ self.event = event or Event()
162
+ self.theme_event = Event()
163
+ self.palette = self.getSystemAccentColor()
164
+ self.theme = self.getSystemTheme()
165
+
166
+ @staticmethod
167
+ def getSystemAccentColor():
168
+ try:
169
+ with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Accent") as key:
170
+ p, _ = winreg.QueryValueEx(key, "AccentPalette")
171
+ except OSError:
172
+ return DEFAULT_ACCENT_PALETTE.copy()
173
+ return [f"#{p[i]:02x}{p[i+1]:02x}{p[i+2]:02x}" for i in range(0,len(p),4)]
174
+
175
+ @staticmethod
176
+ def getSystemTheme():
177
+ try:
178
+ with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize") as key:
179
+ t, _ = winreg.QueryValueEx(key, "AppsUseLightTheme")
180
+ except OSError:
181
+ return "dark"
182
+ return "light" if t else "dark"
183
+
184
+ def refresh(self):
185
+ if self.palette != (color := self.getSystemAccentColor()):
186
+ self.palette = color
187
+ self.event.set(self.palette)
188
+ if self.theme != (theme := self.getSystemTheme()):
189
+ self.theme = theme
190
+ self.theme_event.set(self.theme)
191
+
192
+ def start(self):
193
+ self.refresh()
194
+ logger.debug("Accent watcher initialized")