quantumgui 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 (73) hide show
  1. quantumgui/__init__.py +9 -0
  2. quantumgui/__main__.py +6 -0
  3. quantumgui/cli.py +341 -0
  4. quantumgui/core/__init__.py +39 -0
  5. quantumgui/core/animation.py +221 -0
  6. quantumgui/core/audit.py +323 -0
  7. quantumgui/core/context.py +54 -0
  8. quantumgui/core/data_source.py +426 -0
  9. quantumgui/core/draw.py +428 -0
  10. quantumgui/core/enterprise.py +402 -0
  11. quantumgui/core/enterprise_app.py +419 -0
  12. quantumgui/core/events.py +34 -0
  13. quantumgui/core/geometry.py +108 -0
  14. quantumgui/core/native_dialogs.py +276 -0
  15. quantumgui/core/pdf_report.py +390 -0
  16. quantumgui/core/rules.py +284 -0
  17. quantumgui/core/state.py +42 -0
  18. quantumgui/core/task_runner.py +181 -0
  19. quantumgui/core/widget.py +498 -0
  20. quantumgui/core/window.py +920 -0
  21. quantumgui/core/xlsx_export.py +145 -0
  22. quantumgui/py.typed +0 -0
  23. quantumgui/theme/__init__.py +32 -0
  24. quantumgui/theme/hct.py +191 -0
  25. quantumgui/theme/theme.py +93 -0
  26. quantumgui/theme/tokens.py +423 -0
  27. quantumgui/ui.py +2142 -0
  28. quantumgui/widgets/__init__.py +168 -0
  29. quantumgui/widgets/advanced.py +499 -0
  30. quantumgui/widgets/button.py +224 -0
  31. quantumgui/widgets/charts.py +625 -0
  32. quantumgui/widgets/charts_bi.py +528 -0
  33. quantumgui/widgets/charts_extra.py +430 -0
  34. quantumgui/widgets/charts_pro.py +568 -0
  35. quantumgui/widgets/checkbox.py +199 -0
  36. quantumgui/widgets/chip.py +219 -0
  37. quantumgui/widgets/containers.py +321 -0
  38. quantumgui/widgets/data_controls.py +487 -0
  39. quantumgui/widgets/data_grid.py +956 -0
  40. quantumgui/widgets/data_table.py +551 -0
  41. quantumgui/widgets/date_picker.py +407 -0
  42. quantumgui/widgets/display_media.py +372 -0
  43. quantumgui/widgets/display_pro.py +407 -0
  44. quantumgui/widgets/drawer.py +252 -0
  45. quantumgui/widgets/enterprise_controls.py +934 -0
  46. quantumgui/widgets/fab.py +261 -0
  47. quantumgui/widgets/forms_pro.py +703 -0
  48. quantumgui/widgets/forms_pro_media.py +587 -0
  49. quantumgui/widgets/inputs.py +870 -0
  50. quantumgui/widgets/layout_pro.py +162 -0
  51. quantumgui/widgets/list_view.py +307 -0
  52. quantumgui/widgets/masked_input.py +131 -0
  53. quantumgui/widgets/master_detail.py +155 -0
  54. quantumgui/widgets/navigation.py +382 -0
  55. quantumgui/widgets/overlays.py +355 -0
  56. quantumgui/widgets/productivity.py +500 -0
  57. quantumgui/widgets/productivity_boards.py +544 -0
  58. quantumgui/widgets/radio.py +209 -0
  59. quantumgui/widgets/scroll_view.py +129 -0
  60. quantumgui/widgets/select.py +373 -0
  61. quantumgui/widgets/sheets.py +249 -0
  62. quantumgui/widgets/slider.py +209 -0
  63. quantumgui/widgets/switch.py +196 -0
  64. quantumgui/widgets/tabs.py +175 -0
  65. quantumgui/widgets/text.py +101 -0
  66. quantumgui/widgets/text_field.py +490 -0
  67. quantumgui/widgets/time_picker.py +499 -0
  68. quantumgui-1.0.0.dist-info/METADATA +137 -0
  69. quantumgui-1.0.0.dist-info/RECORD +73 -0
  70. quantumgui-1.0.0.dist-info/WHEEL +5 -0
  71. quantumgui-1.0.0.dist-info/entry_points.txt +2 -0
  72. quantumgui-1.0.0.dist-info/licenses/LICENSE +32 -0
  73. quantumgui-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,423 @@
1
+ """Official Material Design 3 Design Tokens.
2
+
3
+ Includes:
4
+ - ColorScheme (all M3 roles including Surface Container hierarchy)
5
+ - TypographyScale (Display, Headline, Title, Body, Label)
6
+ - ShapeScale (none, extra_small, small, medium, large, extra_large, full)
7
+ - Elevation levels (0..5)
8
+ - StateLayer opacities (hover, focus, pressed, dragged)
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ from dataclasses import dataclass
14
+ from typing import Literal
15
+
16
+ from .hct import Color, CorePalette
17
+
18
+ ContrastLevel = Literal["standard", "medium", "high"]
19
+
20
+ TypographyRole = Literal[
21
+ "display_large",
22
+ "display_medium",
23
+ "display_small",
24
+ "headline_large",
25
+ "headline_medium",
26
+ "headline_small",
27
+ "title_large",
28
+ "title_medium",
29
+ "title_small",
30
+ "body_large",
31
+ "body_medium",
32
+ "body_small",
33
+ "label_large",
34
+ "label_medium",
35
+ "label_small",
36
+ ]
37
+
38
+ ShapeToken = Literal[
39
+ "none",
40
+ "extra_small",
41
+ "small",
42
+ "medium",
43
+ "large",
44
+ "extra_large",
45
+ "full",
46
+ ]
47
+
48
+
49
+ @dataclass(frozen=True, slots=True)
50
+ class TextStyle:
51
+ size: float
52
+ line_height: float
53
+ weight: int # 400=Regular, 500=Medium, 600=SemiBold, 700=Bold
54
+ tracking: float = 0.0
55
+
56
+
57
+ @dataclass(frozen=True)
58
+ class TypographyScale:
59
+ """Official Material Design 3 Type Scale."""
60
+
61
+ display_large: TextStyle = TextStyle(57, 64, 400, -0.25)
62
+ display_medium: TextStyle = TextStyle(45, 52, 400, 0.0)
63
+ display_small: TextStyle = TextStyle(36, 44, 400, 0.0)
64
+
65
+ headline_large: TextStyle = TextStyle(32, 40, 400, 0.0)
66
+ headline_medium: TextStyle = TextStyle(28, 36, 400, 0.0)
67
+ headline_small: TextStyle = TextStyle(24, 32, 400, 0.0)
68
+
69
+ title_large: TextStyle = TextStyle(22, 28, 400, 0.0)
70
+ title_medium: TextStyle = TextStyle(16, 24, 500, 0.15)
71
+ title_small: TextStyle = TextStyle(14, 20, 500, 0.1)
72
+
73
+ body_large: TextStyle = TextStyle(16, 24, 400, 0.5)
74
+ body_medium: TextStyle = TextStyle(14, 20, 400, 0.25)
75
+ body_small: TextStyle = TextStyle(12, 16, 400, 0.4)
76
+
77
+ label_large: TextStyle = TextStyle(14, 20, 500, 0.1)
78
+ label_medium: TextStyle = TextStyle(12, 16, 500, 0.5)
79
+ label_small: TextStyle = TextStyle(11, 16, 500, 0.5)
80
+
81
+ def get(self, role: TypographyRole) -> TextStyle:
82
+ return getattr(self, role)
83
+
84
+
85
+ @dataclass(frozen=True)
86
+ class ShapeScale:
87
+ """Official Material Design 3 Shape corner radii (dp)."""
88
+
89
+ none: float = 0.0
90
+ extra_small: float = 4.0
91
+ small: float = 8.0
92
+ medium: float = 12.0
93
+ large: float = 16.0
94
+ extra_large: float = 28.0
95
+ full: float = 9999.0
96
+
97
+ def resolve(self, token: ShapeToken | float) -> float:
98
+ if isinstance(token, (int, float)):
99
+ return float(token)
100
+ return float(getattr(self, token))
101
+
102
+
103
+ @dataclass(frozen=True)
104
+ class StateLayers:
105
+ """Official Material Design 3 State Layer opacities."""
106
+
107
+ hover: float = 0.08
108
+ focus: float = 0.10
109
+ pressed: float = 0.10
110
+ dragged: float = 0.16
111
+ disabled_container: float = 0.12
112
+ disabled_content: float = 0.38
113
+
114
+
115
+ # Official M3 tonal elevation tint percentages for levels 0..5
116
+ ELEVATION_TINT: tuple[float, ...] = (0.0, 0.05, 0.08, 0.11, 0.12, 0.14)
117
+ ELEVATION_DP: tuple[float, ...] = (0.0, 1.0, 3.0, 6.0, 8.0, 12.0)
118
+
119
+
120
+ @dataclass(frozen=True)
121
+ class ColorScheme:
122
+ """Complete Material Design 3 Color Scheme (Light or Dark)."""
123
+
124
+ brightness: Literal["light", "dark"]
125
+
126
+ # Primary
127
+ primary: Color
128
+ on_primary: Color
129
+ primary_container: Color
130
+ on_primary_container: Color
131
+
132
+ # Secondary
133
+ secondary: Color
134
+ on_secondary: Color
135
+ secondary_container: Color
136
+ on_secondary_container: Color
137
+
138
+ # Tertiary
139
+ tertiary: Color
140
+ on_tertiary: Color
141
+ tertiary_container: Color
142
+ on_tertiary_container: Color
143
+
144
+ # Error
145
+ error: Color
146
+ on_error: Color
147
+ error_container: Color
148
+ on_error_container: Color
149
+
150
+ # Surface hierarchy (M3 2023+ spec)
151
+ surface_dim: Color
152
+ surface: Color
153
+ surface_bright: Color
154
+ surface_container_lowest: Color
155
+ surface_container_low: Color
156
+ surface_container: Color
157
+ surface_container_high: Color
158
+ surface_container_highest: Color
159
+ on_surface: Color
160
+ on_surface_variant: Color
161
+
162
+ # Outline & Utility
163
+ outline: Color
164
+ outline_variant: Color
165
+ inverse_surface: Color
166
+ inverse_on_surface: Color
167
+ inverse_primary: Color
168
+ shadow: Color
169
+ scrim: Color
170
+ surface_tint: Color
171
+
172
+ @classmethod
173
+ def light(cls, palette: CorePalette, contrast: ContrastLevel = "standard") -> ColorScheme:
174
+ p, s, t, n, nv, e = (
175
+ palette.primary,
176
+ palette.secondary,
177
+ palette.tertiary,
178
+ palette.neutral,
179
+ palette.neutral_variant,
180
+ palette.error,
181
+ )
182
+ if contrast == "high":
183
+ return cls(
184
+ brightness="light",
185
+ primary=p.tone(18),
186
+ on_primary=p.tone(100),
187
+ primary_container=p.tone(28),
188
+ on_primary_container=p.tone(100),
189
+ secondary=s.tone(18),
190
+ on_secondary=s.tone(100),
191
+ secondary_container=s.tone(28),
192
+ on_secondary_container=s.tone(100),
193
+ tertiary=t.tone(18),
194
+ on_tertiary=t.tone(100),
195
+ tertiary_container=t.tone(28),
196
+ on_tertiary_container=t.tone(100),
197
+ error=e.tone(18),
198
+ on_error=e.tone(100),
199
+ error_container=e.tone(28),
200
+ on_error_container=e.tone(100),
201
+ surface_dim=n.tone(82),
202
+ surface=n.tone(99),
203
+ surface_bright=n.tone(100),
204
+ surface_container_lowest=n.tone(100),
205
+ surface_container_low=n.tone(96),
206
+ surface_container=n.tone(92),
207
+ surface_container_high=n.tone(88),
208
+ surface_container_highest=n.tone(84),
209
+ on_surface=n.tone(0),
210
+ on_surface_variant=nv.tone(12),
211
+ outline=nv.tone(18),
212
+ outline_variant=nv.tone(30),
213
+ inverse_surface=n.tone(14),
214
+ inverse_on_surface=n.tone(100),
215
+ inverse_primary=p.tone(90),
216
+ shadow=n.tone(0),
217
+ scrim=n.tone(0),
218
+ surface_tint=p.tone(18),
219
+ )
220
+ if contrast == "medium":
221
+ return cls(
222
+ brightness="light",
223
+ primary=p.tone(30),
224
+ on_primary=p.tone(100),
225
+ primary_container=p.tone(45),
226
+ on_primary_container=p.tone(100),
227
+ secondary=s.tone(30),
228
+ on_secondary=s.tone(100),
229
+ secondary_container=s.tone(45),
230
+ on_secondary_container=s.tone(100),
231
+ tertiary=t.tone(30),
232
+ on_tertiary=t.tone(100),
233
+ tertiary_container=t.tone(45),
234
+ on_tertiary_container=t.tone(100),
235
+ error=e.tone(30),
236
+ on_error=e.tone(100),
237
+ error_container=e.tone(45),
238
+ on_error_container=e.tone(100),
239
+ surface_dim=n.tone(85),
240
+ surface=n.tone(98),
241
+ surface_bright=n.tone(99),
242
+ surface_container_lowest=n.tone(100),
243
+ surface_container_low=n.tone(95),
244
+ surface_container=n.tone(92),
245
+ surface_container_high=n.tone(89),
246
+ surface_container_highest=n.tone(86),
247
+ on_surface=n.tone(5),
248
+ on_surface_variant=nv.tone(20),
249
+ outline=nv.tone(35),
250
+ outline_variant=nv.tone(55),
251
+ inverse_surface=n.tone(18),
252
+ inverse_on_surface=n.tone(98),
253
+ inverse_primary=p.tone(85),
254
+ shadow=n.tone(0),
255
+ scrim=n.tone(0),
256
+ surface_tint=p.tone(30),
257
+ )
258
+ return cls(
259
+ brightness="light",
260
+ primary=p.tone(40),
261
+ on_primary=p.tone(100),
262
+ primary_container=p.tone(90),
263
+ on_primary_container=p.tone(10),
264
+ secondary=s.tone(40),
265
+ on_secondary=s.tone(100),
266
+ secondary_container=s.tone(90),
267
+ on_secondary_container=s.tone(10),
268
+ tertiary=t.tone(40),
269
+ on_tertiary=t.tone(100),
270
+ tertiary_container=t.tone(90),
271
+ on_tertiary_container=t.tone(10),
272
+ error=e.tone(40),
273
+ on_error=e.tone(100),
274
+ error_container=e.tone(90),
275
+ on_error_container=e.tone(10),
276
+ surface_dim=n.tone(87),
277
+ surface=n.tone(98),
278
+ surface_bright=n.tone(98),
279
+ surface_container_lowest=n.tone(100),
280
+ surface_container_low=n.tone(96),
281
+ surface_container=n.tone(94),
282
+ surface_container_high=n.tone(92),
283
+ surface_container_highest=n.tone(90),
284
+ on_surface=n.tone(10),
285
+ on_surface_variant=nv.tone(30),
286
+ outline=nv.tone(50),
287
+ outline_variant=nv.tone(80),
288
+ inverse_surface=n.tone(20),
289
+ inverse_on_surface=n.tone(95),
290
+ inverse_primary=p.tone(80),
291
+ shadow=n.tone(0),
292
+ scrim=n.tone(0),
293
+ surface_tint=p.tone(40),
294
+ )
295
+
296
+ @classmethod
297
+ def dark(cls, palette: CorePalette, contrast: ContrastLevel = "standard") -> ColorScheme:
298
+ p, s, t, n, nv, e = (
299
+ palette.primary,
300
+ palette.secondary,
301
+ palette.tertiary,
302
+ palette.neutral,
303
+ palette.neutral_variant,
304
+ palette.error,
305
+ )
306
+ if contrast == "high":
307
+ return cls(
308
+ brightness="dark",
309
+ primary=p.tone(95),
310
+ on_primary=p.tone(0),
311
+ primary_container=p.tone(82),
312
+ on_primary_container=p.tone(0),
313
+ secondary=s.tone(95),
314
+ on_secondary=s.tone(0),
315
+ secondary_container=s.tone(82),
316
+ on_secondary_container=s.tone(0),
317
+ tertiary=t.tone(95),
318
+ on_tertiary=t.tone(0),
319
+ tertiary_container=t.tone(82),
320
+ on_tertiary_container=t.tone(0),
321
+ error=e.tone(95),
322
+ on_error=e.tone(0),
323
+ error_container=e.tone(82),
324
+ on_error_container=e.tone(0),
325
+ surface_dim=n.tone(4),
326
+ surface=n.tone(4),
327
+ surface_bright=n.tone(30),
328
+ surface_container_lowest=n.tone(0),
329
+ surface_container_low=n.tone(10),
330
+ surface_container=n.tone(14),
331
+ surface_container_high=n.tone(20),
332
+ surface_container_highest=n.tone(26),
333
+ on_surface=n.tone(100),
334
+ on_surface_variant=nv.tone(94),
335
+ outline=nv.tone(86),
336
+ outline_variant=nv.tone(70),
337
+ inverse_surface=n.tone(96),
338
+ inverse_on_surface=n.tone(0),
339
+ inverse_primary=p.tone(25),
340
+ shadow=n.tone(0),
341
+ scrim=n.tone(0),
342
+ surface_tint=p.tone(95),
343
+ )
344
+ if contrast == "medium":
345
+ return cls(
346
+ brightness="dark",
347
+ primary=p.tone(87),
348
+ on_primary=p.tone(12),
349
+ primary_container=p.tone(62),
350
+ on_primary_container=p.tone(0),
351
+ secondary=s.tone(87),
352
+ on_secondary=s.tone(12),
353
+ secondary_container=s.tone(62),
354
+ on_secondary_container=s.tone(0),
355
+ tertiary=t.tone(87),
356
+ on_tertiary=t.tone(12),
357
+ tertiary_container=t.tone(62),
358
+ on_tertiary_container=t.tone(0),
359
+ error=e.tone(87),
360
+ on_error=e.tone(12),
361
+ error_container=e.tone(62),
362
+ on_error_container=e.tone(0),
363
+ surface_dim=n.tone(6),
364
+ surface=n.tone(6),
365
+ surface_bright=n.tone(26),
366
+ surface_container_lowest=n.tone(2),
367
+ surface_container_low=n.tone(10),
368
+ surface_container=n.tone(13),
369
+ surface_container_high=n.tone(18),
370
+ surface_container_highest=n.tone(24),
371
+ on_surface=n.tone(98),
372
+ on_surface_variant=nv.tone(88),
373
+ outline=nv.tone(72),
374
+ outline_variant=nv.tone(52),
375
+ inverse_surface=n.tone(92),
376
+ inverse_on_surface=n.tone(12),
377
+ inverse_primary=p.tone(32),
378
+ shadow=n.tone(0),
379
+ scrim=n.tone(0),
380
+ surface_tint=p.tone(87),
381
+ )
382
+ return cls(
383
+ brightness="dark",
384
+ primary=p.tone(80),
385
+ on_primary=p.tone(20),
386
+ primary_container=p.tone(30),
387
+ on_primary_container=p.tone(90),
388
+ secondary=s.tone(80),
389
+ on_secondary=s.tone(20),
390
+ secondary_container=s.tone(30),
391
+ on_secondary_container=s.tone(90),
392
+ tertiary=t.tone(80),
393
+ on_tertiary=t.tone(20),
394
+ tertiary_container=t.tone(30),
395
+ on_tertiary_container=t.tone(90),
396
+ error=e.tone(80),
397
+ on_error=e.tone(20),
398
+ error_container=e.tone(30),
399
+ on_error_container=e.tone(90),
400
+ surface_dim=n.tone(6),
401
+ surface=n.tone(6),
402
+ surface_bright=n.tone(24),
403
+ surface_container_lowest=n.tone(4),
404
+ surface_container_low=n.tone(10),
405
+ surface_container=n.tone(12),
406
+ surface_container_high=n.tone(17),
407
+ surface_container_highest=n.tone(22),
408
+ on_surface=n.tone(90),
409
+ on_surface_variant=nv.tone(80),
410
+ outline=nv.tone(60),
411
+ outline_variant=nv.tone(30),
412
+ inverse_surface=n.tone(90),
413
+ inverse_on_surface=n.tone(20),
414
+ inverse_primary=p.tone(40),
415
+ shadow=n.tone(0),
416
+ scrim=n.tone(0),
417
+ surface_tint=p.tone(80),
418
+ )
419
+
420
+ def surface_at_elevation(self, level: int) -> Color:
421
+ """Apply M3 tonal elevation tint (levels 0..5) onto surface."""
422
+ idx = max(0, min(5, int(level)))
423
+ return self.surface.blend(self.surface_tint, ELEVATION_TINT[idx])