statstudio 0.1.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 (110) hide show
  1. statstudio/__init__.py +9 -0
  2. statstudio/__main__.py +3 -0
  3. statstudio/app.py +83 -0
  4. statstudio/cli.py +116 -0
  5. statstudio/core/__init__.py +3 -0
  6. statstudio/core/archive.py +27 -0
  7. statstudio/core/commands.py +67 -0
  8. statstudio/core/formula_catalog.py +74 -0
  9. statstudio/core/formulas.py +605 -0
  10. statstudio/core/joins.py +123 -0
  11. statstudio/core/project.py +358 -0
  12. statstudio/core/runtime.py +321 -0
  13. statstudio/core/scripting.py +594 -0
  14. statstudio/core/table.py +796 -0
  15. statstudio/core/transform.py +450 -0
  16. statstudio/feature_help.py +595 -0
  17. statstudio/io/__init__.py +3 -0
  18. statstudio/io/docx.py +201 -0
  19. statstudio/io/export.py +99 -0
  20. statstudio/io/file_import.py +199 -0
  21. statstudio/io/odbc.py +334 -0
  22. statstudio/io/sample_data.py +164 -0
  23. statstudio/io/table_io.py +118 -0
  24. statstudio/plots/__init__.py +19 -0
  25. statstudio/plots/advanced.py +651 -0
  26. statstudio/plots/basic.py +957 -0
  27. statstudio/plots/bayesian_plots.py +94 -0
  28. statstudio/plots/common.py +334 -0
  29. statstudio/plots/diagnostics.py +214 -0
  30. statstudio/plots/doe_plots.py +235 -0
  31. statstudio/plots/plotly_builders.py +719 -0
  32. statstudio/plots/predictive_plots.py +72 -0
  33. statstudio/plots/registry.py +251 -0
  34. statstudio/plugins.py +111 -0
  35. statstudio/resources/help_topics.json +13195 -0
  36. statstudio/resources/logo.ico +0 -0
  37. statstudio/resources/logo.png +0 -0
  38. statstudio/resources/statstudio.svg +8 -0
  39. statstudio/stats/__init__.py +42 -0
  40. statstudio/stats/bayesian.py +1094 -0
  41. statstudio/stats/bayesian_optimization.py +590 -0
  42. statstudio/stats/common.py +140 -0
  43. statstudio/stats/correlation.py +135 -0
  44. statstudio/stats/custom_doe.py +1714 -0
  45. statstudio/stats/descriptive.py +200 -0
  46. statstudio/stats/desirability.py +132 -0
  47. statstudio/stats/distributions.py +331 -0
  48. statstudio/stats/doe.py +1070 -0
  49. statstudio/stats/hypothesis.py +1305 -0
  50. statstudio/stats/multivariate.py +307 -0
  51. statstudio/stats/optimal_doe.py +264 -0
  52. statstudio/stats/power.py +194 -0
  53. statstudio/stats/predictive.py +605 -0
  54. statstudio/stats/profiler.py +379 -0
  55. statstudio/stats/quality.py +1218 -0
  56. statstudio/stats/regression.py +1600 -0
  57. statstudio/stats/results.py +235 -0
  58. statstudio/stats/simulator.py +95 -0
  59. statstudio/stats/survival.py +637 -0
  60. statstudio/stats/timeseries.py +643 -0
  61. statstudio/stats/tolerance.py +154 -0
  62. statstudio/ui/__init__.py +0 -0
  63. statstudio/ui/analysis_hub.py +271 -0
  64. statstudio/ui/command_catalog.py +460 -0
  65. statstudio/ui/command_palette.py +55 -0
  66. statstudio/ui/console.py +239 -0
  67. statstudio/ui/dialogs/__init__.py +0 -0
  68. statstudio/ui/dialogs/advanced_dialogs.py +392 -0
  69. statstudio/ui/dialogs/base.py +537 -0
  70. statstudio/ui/dialogs/bayesian_dialogs.py +488 -0
  71. statstudio/ui/dialogs/bayesian_optimization_dialog.py +299 -0
  72. statstudio/ui/dialogs/custom_doe_dialog.py +467 -0
  73. statstudio/ui/dialogs/doe_dialogs.py +220 -0
  74. statstudio/ui/dialogs/extended_dialogs.py +665 -0
  75. statstudio/ui/dialogs/graph_builder.py +139 -0
  76. statstudio/ui/dialogs/help_dialog.py +207 -0
  77. statstudio/ui/dialogs/help_topics.py +280 -0
  78. statstudio/ui/dialogs/lazy.py +184 -0
  79. statstudio/ui/dialogs/odbc_dialog.py +311 -0
  80. statstudio/ui/dialogs/plot_dialog.py +1385 -0
  81. statstudio/ui/dialogs/report_composer.py +218 -0
  82. statstudio/ui/dialogs/script_dialogs.py +267 -0
  83. statstudio/ui/dialogs/stats_dialogs.py +1688 -0
  84. statstudio/ui/dialogs/table_dialogs.py +997 -0
  85. statstudio/ui/dialogs/window.py +58 -0
  86. statstudio/ui/docks/__init__.py +0 -0
  87. statstudio/ui/formula_editor.py +121 -0
  88. statstudio/ui/icons.py +257 -0
  89. statstudio/ui/jobs.py +179 -0
  90. statstudio/ui/main_window.py +3934 -0
  91. statstudio/ui/plot_interaction.py +178 -0
  92. statstudio/ui/profiler_widget.py +437 -0
  93. statstudio/ui/recent.py +82 -0
  94. statstudio/ui/reports/__init__.py +0 -0
  95. statstudio/ui/reports/report_view.py +1632 -0
  96. statstudio/ui/script_jobs.py +35 -0
  97. statstudio/ui/scripts_panel.py +271 -0
  98. statstudio/ui/table_document.py +233 -0
  99. statstudio/ui/table_model.py +285 -0
  100. statstudio/ui/table_view.py +285 -0
  101. statstudio/ui/theme.py +645 -0
  102. statstudio/ui/welcome.py +453 -0
  103. statstudio/ui/window_controls.py +53 -0
  104. statstudio/ui/workers.py +53 -0
  105. statstudio-0.1.0.dist-info/METADATA +261 -0
  106. statstudio-0.1.0.dist-info/RECORD +110 -0
  107. statstudio-0.1.0.dist-info/WHEEL +5 -0
  108. statstudio-0.1.0.dist-info/entry_points.txt +5 -0
  109. statstudio-0.1.0.dist-info/licenses/LICENSE +674 -0
  110. statstudio-0.1.0.dist-info/top_level.txt +1 -0
statstudio/ui/theme.py ADDED
@@ -0,0 +1,645 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+ from PySide6.QtCore import QSettings
6
+ from PySide6.QtGui import QColor, QFont, QPalette
7
+ from PySide6.QtWidgets import QApplication
8
+
9
+ SETTINGS_ORGANIZATION = "StatStudio"
10
+ SETTINGS_APPLICATION = "StatStudio"
11
+ THEME_KEY = "appearance/theme"
12
+ VALID_THEMES = ("light", "dark")
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class ThemeColors:
17
+ name: str
18
+ background: str
19
+ surface: str
20
+ surface_alt: str
21
+ chrome: str
22
+ chrome_alt: str
23
+ border: str
24
+ border_strong: str
25
+ text: str
26
+ text_muted: str
27
+ text_subtle: str
28
+ accent: str
29
+ accent_hover: str
30
+ accent_pressed: str
31
+ accent_soft: str
32
+ accent_text: str
33
+ success: str
34
+ warning: str
35
+ danger: str
36
+ selection: str
37
+ selection_text: str
38
+
39
+
40
+ LIGHT = ThemeColors(
41
+ name="light",
42
+ background="#f4f6f9",
43
+ surface="#ffffff",
44
+ surface_alt="#f8fafc",
45
+ chrome="#eef2f7",
46
+ chrome_alt="#e5ebf2",
47
+ border="#d8dee7",
48
+ border_strong="#c2cbd6",
49
+ text="#1f2937",
50
+ text_muted="#5f6b7a",
51
+ text_subtle="#8792a2",
52
+ accent="#2f6fed",
53
+ accent_hover="#245ed0",
54
+ accent_pressed="#1d4fb0",
55
+ accent_soft="#e8f0ff",
56
+ accent_text="#ffffff",
57
+ success="#1f8a5b",
58
+ warning="#a86a10",
59
+ danger="#b42318",
60
+ selection="#dbe8ff",
61
+ selection_text="#12284f",
62
+ )
63
+
64
+ DARK = ThemeColors(
65
+ name="dark",
66
+ background="#14181f",
67
+ surface="#1b212b",
68
+ surface_alt="#202733",
69
+ chrome="#202733",
70
+ chrome_alt="#27303d",
71
+ border="#313b4a",
72
+ border_strong="#435064",
73
+ text="#e6ebf2",
74
+ text_muted="#a6b2c1",
75
+ text_subtle="#7f8b9c",
76
+ accent="#5b9bff",
77
+ accent_hover="#76abff",
78
+ accent_pressed="#4388ef",
79
+ accent_soft="#20324f",
80
+ accent_text="#08111f",
81
+ success="#4ac38b",
82
+ warning="#f0b45b",
83
+ danger="#ff7b72",
84
+ selection="#29466f",
85
+ selection_text="#f2f7ff",
86
+ )
87
+
88
+ _THEMES = {"light": LIGHT, "dark": DARK}
89
+ _active = "light"
90
+
91
+
92
+ def theme_colors(name: str | None = None) -> ThemeColors:
93
+ return _THEMES.get(name or _active, LIGHT)
94
+
95
+
96
+ def current_theme() -> str:
97
+ return _active
98
+
99
+
100
+ def is_dark(name: str | None = None) -> bool:
101
+ return theme_colors(name).name == "dark"
102
+
103
+
104
+ def settings() -> QSettings:
105
+ return QSettings(SETTINGS_ORGANIZATION, SETTINGS_APPLICATION)
106
+
107
+
108
+ def load_saved_theme() -> str:
109
+ value = str(settings().value(THEME_KEY, "light") or "light").lower()
110
+ return value if value in VALID_THEMES else "light"
111
+
112
+
113
+ def save_theme(name: str) -> None:
114
+ if name in VALID_THEMES:
115
+ settings().setValue(THEME_KEY, name)
116
+
117
+
118
+ def _palette(colors: ThemeColors) -> QPalette:
119
+ palette = QPalette()
120
+ palette.setColor(QPalette.ColorRole.Window, QColor(colors.background))
121
+ palette.setColor(QPalette.ColorRole.WindowText, QColor(colors.text))
122
+ palette.setColor(QPalette.ColorRole.Base, QColor(colors.surface))
123
+ palette.setColor(QPalette.ColorRole.AlternateBase, QColor(colors.surface_alt))
124
+ palette.setColor(QPalette.ColorRole.ToolTipBase, QColor(colors.surface))
125
+ palette.setColor(QPalette.ColorRole.ToolTipText, QColor(colors.text))
126
+ palette.setColor(QPalette.ColorRole.Text, QColor(colors.text))
127
+ palette.setColor(QPalette.ColorRole.Button, QColor(colors.chrome))
128
+ palette.setColor(QPalette.ColorRole.ButtonText, QColor(colors.text))
129
+ palette.setColor(QPalette.ColorRole.BrightText, QColor(colors.danger))
130
+ palette.setColor(QPalette.ColorRole.Link, QColor(colors.accent))
131
+ palette.setColor(QPalette.ColorRole.Highlight, QColor(colors.selection))
132
+ palette.setColor(QPalette.ColorRole.HighlightedText, QColor(colors.selection_text))
133
+ palette.setColor(QPalette.ColorRole.PlaceholderText, QColor(colors.text_subtle))
134
+ palette.setColor(QPalette.ColorRole.Mid, QColor(colors.border))
135
+ palette.setColor(QPalette.ColorRole.Dark, QColor(colors.border_strong))
136
+ palette.setColor(QPalette.ColorRole.Light, QColor(colors.surface))
137
+ for group in (QPalette.ColorGroup.Disabled,):
138
+ palette.setColor(group, QPalette.ColorRole.Text, QColor(colors.text_subtle))
139
+ palette.setColor(group, QPalette.ColorRole.WindowText, QColor(colors.text_subtle))
140
+ palette.setColor(group, QPalette.ColorRole.ButtonText, QColor(colors.text_subtle))
141
+ return palette
142
+
143
+
144
+ def _font() -> QFont:
145
+ font = QFont()
146
+ font.setFamilies(["Inter", "Segoe UI", "Noto Sans", "DejaVu Sans", "Sans Serif"])
147
+ font.setPointSize(10)
148
+ return font
149
+
150
+
151
+ def stylesheet(name: str | None = None) -> str:
152
+ c = theme_colors(name)
153
+ return f"""
154
+ QMainWindow, QDialog, QWidget#homePage {{
155
+ background: {c.background};
156
+ color: {c.text};
157
+ }}
158
+ QWidget {{
159
+ color: {c.text};
160
+ }}
161
+ QLabel {{
162
+ background: transparent;
163
+ }}
164
+ QLabel[role="muted"], QLabel#mutedLabel {{
165
+ color: {c.text_muted};
166
+ }}
167
+ QLabel[role="subtle"] {{
168
+ color: {c.text_subtle};
169
+ }}
170
+ QLabel[role="h2"] {{
171
+ font-size: 17px;
172
+ font-weight: 700;
173
+ }}
174
+ QLabel[role="h3"] {{
175
+ font-size: 14px;
176
+ font-weight: 700;
177
+ }}
178
+ QLabel[role="heroTitle"] {{
179
+ font-size: 30px;
180
+ font-weight: 700;
181
+ }}
182
+ QLabel[role="heroSubtitle"] {{
183
+ font-size: 14px;
184
+ color: {c.text_muted};
185
+ }}
186
+ QLabel[role="eyebrow"] {{
187
+ color: {c.accent};
188
+ font-size: 11px;
189
+ font-weight: 700;
190
+ }}
191
+ QLabel#documentTitle {{
192
+ font-size: 13px;
193
+ font-weight: 700;
194
+ }}
195
+ QLabel#documentMeta {{
196
+ color: {c.text_muted};
197
+ font-size: 11px;
198
+ }}
199
+ QLabel#statusBadge {{
200
+ background: {c.accent_soft};
201
+ color: {c.accent};
202
+ border-radius: 7px;
203
+ padding: 1px 7px;
204
+ font-size: 10px;
205
+ font-weight: 700;
206
+ }}
207
+ QMenuBar {{
208
+ background: {c.chrome};
209
+ border-bottom: 1px solid {c.border};
210
+ padding: 2px 4px;
211
+ }}
212
+ QMenuBar::item {{
213
+ background: transparent;
214
+ padding: 5px 9px;
215
+ border-radius: 4px;
216
+ }}
217
+ QMenuBar::item:selected, QMenuBar::item:pressed {{
218
+ background: {c.accent_soft};
219
+ color: {c.text};
220
+ }}
221
+ QMenu {{
222
+ background: {c.surface};
223
+ border: 1px solid {c.border};
224
+ padding: 5px;
225
+ }}
226
+ QMenu::item {{
227
+ padding: 6px 28px 6px 24px;
228
+ border-radius: 4px;
229
+ background: transparent;
230
+ }}
231
+ QMenu::item:selected {{
232
+ background: {c.accent_soft};
233
+ color: {c.text};
234
+ }}
235
+ QMenu::item:disabled {{
236
+ color: {c.text_subtle};
237
+ }}
238
+ QMenu::separator {{
239
+ height: 1px;
240
+ background: {c.border};
241
+ margin: 5px 8px;
242
+ }}
243
+ QToolBar {{
244
+ background: {c.chrome};
245
+ border: none;
246
+ border-bottom: 1px solid {c.border};
247
+ spacing: 2px;
248
+ padding: 2px 6px;
249
+ }}
250
+ QToolBar QToolButton {{
251
+ padding: 3px 6px;
252
+ }}
253
+ QToolBar::separator {{
254
+ width: 1px;
255
+ background: {c.border};
256
+ margin: 5px 6px;
257
+ }}
258
+ QToolButton {{
259
+ background: transparent;
260
+ border: 1px solid transparent;
261
+ border-radius: 5px;
262
+ padding: 4px 7px;
263
+ color: {c.text};
264
+ }}
265
+ QToolButton:hover {{
266
+ background: {c.surface};
267
+ border-color: {c.border};
268
+ }}
269
+ QToolButton:pressed, QToolButton:checked {{
270
+ background: {c.accent_soft};
271
+ border-color: {c.accent};
272
+ }}
273
+ QToolButton:disabled {{
274
+ color: {c.text_subtle};
275
+ }}
276
+ QToolButton[windowControl="true"] {{
277
+ padding: 2px;
278
+ border-radius: 4px;
279
+ }}
280
+ QToolButton[windowControl="true"]:hover {{
281
+ background: {c.accent_soft};
282
+ border-color: transparent;
283
+ }}
284
+ QPushButton {{
285
+ background: {c.surface};
286
+ border: 1px solid {c.border_strong};
287
+ border-radius: 6px;
288
+ padding: 5px 12px;
289
+ min-height: 20px;
290
+ color: {c.text};
291
+ }}
292
+ QPushButton:hover {{
293
+ background: {c.surface_alt};
294
+ border-color: {c.accent};
295
+ }}
296
+ QPushButton:pressed {{
297
+ background: {c.chrome_alt};
298
+ }}
299
+ QPushButton:disabled {{
300
+ color: {c.text_subtle};
301
+ border-color: {c.border};
302
+ }}
303
+ QPushButton[primary="true"] {{
304
+ background: {c.accent};
305
+ color: {c.accent_text};
306
+ border-color: {c.accent};
307
+ font-weight: 700;
308
+ }}
309
+ QPushButton[primary="true"]:hover {{
310
+ background: {c.accent_hover};
311
+ border-color: {c.accent_hover};
312
+ }}
313
+ QPushButton[primary="true"]:pressed {{
314
+ background: {c.accent_pressed};
315
+ border-color: {c.accent_pressed};
316
+ }}
317
+ QPushButton[quiet="true"], QPushButton[role="link"] {{
318
+ background: transparent;
319
+ border-color: transparent;
320
+ color: {c.accent};
321
+ text-align: left;
322
+ padding: 3px 4px;
323
+ }}
324
+ QPushButton[quiet="true"]:hover, QPushButton[role="link"]:hover {{
325
+ background: {c.accent_soft};
326
+ border-color: transparent;
327
+ }}
328
+ QLineEdit, QComboBox, QSpinBox, QDoubleSpinBox, QPlainTextEdit, QTextEdit, QTextBrowser {{
329
+ background: {c.surface};
330
+ border: 1px solid {c.border_strong};
331
+ border-radius: 5px;
332
+ padding: 4px 7px;
333
+ selection-background-color: {c.selection};
334
+ selection-color: {c.selection_text};
335
+ }}
336
+ QLineEdit:focus, QComboBox:focus, QSpinBox:focus, QDoubleSpinBox:focus,
337
+ QPlainTextEdit:focus, QTextEdit:focus, QTextBrowser:focus {{
338
+ border-color: {c.accent};
339
+ }}
340
+ QLineEdit:disabled, QComboBox:disabled, QSpinBox:disabled, QDoubleSpinBox:disabled {{
341
+ background: {c.chrome};
342
+ color: {c.text_subtle};
343
+ }}
344
+ QComboBox::drop-down {{
345
+ border: none;
346
+ width: 20px;
347
+ }}
348
+ QComboBox QAbstractItemView {{
349
+ background: {c.surface};
350
+ border: 1px solid {c.border};
351
+ selection-background-color: {c.accent_soft};
352
+ selection-color: {c.text};
353
+ }}
354
+ QAbstractItemView {{
355
+ background: {c.surface};
356
+ border: 1px solid {c.border};
357
+ alternate-background-color: {c.surface_alt};
358
+ selection-background-color: {c.selection};
359
+ selection-color: {c.selection_text};
360
+ outline: 0;
361
+ }}
362
+ QTreeView, QListView, QTableView {{
363
+ background: {c.surface};
364
+ border: 1px solid {c.border};
365
+ border-radius: 6px;
366
+ }}
367
+ QTreeView::item, QListView::item, QTableView::item {{
368
+ padding: 3px 4px;
369
+ }}
370
+ QTreeView::item:hover, QListView::item:hover, QTableView::item:hover {{
371
+ background: {c.surface_alt};
372
+ }}
373
+ QHeaderView::section {{
374
+ background: {c.chrome};
375
+ color: {c.text_muted};
376
+ border: none;
377
+ border-right: 1px solid {c.border};
378
+ border-bottom: 1px solid {c.border};
379
+ padding: 5px 7px;
380
+ font-weight: 700;
381
+ }}
382
+ QTableView QTableCornerButton::section {{
383
+ background: {c.chrome};
384
+ border: 1px solid {c.border};
385
+ }}
386
+ QTabWidget::pane {{
387
+ border: 1px solid {c.border};
388
+ border-radius: 6px;
389
+ background: {c.surface};
390
+ top: -1px;
391
+ }}
392
+ QTabBar::tab {{
393
+ background: transparent;
394
+ color: {c.text_muted};
395
+ border: 1px solid transparent;
396
+ padding: 6px 12px;
397
+ margin-right: 2px;
398
+ border-top-left-radius: 5px;
399
+ border-top-right-radius: 5px;
400
+ }}
401
+ QTabBar::tab:selected {{
402
+ background: {c.surface};
403
+ color: {c.text};
404
+ border-color: {c.border};
405
+ border-bottom-color: {c.surface};
406
+ }}
407
+ QTabBar::tab:hover {{
408
+ color: {c.text};
409
+ background: {c.surface_alt};
410
+ }}
411
+ QDockWidget {{
412
+ color: {c.text};
413
+ titlebar-close-icon: none;
414
+ titlebar-normal-icon: none;
415
+ }}
416
+ QDockWidget::title {{
417
+ background: {c.chrome};
418
+ border-bottom: 1px solid {c.border};
419
+ padding: 6px 8px;
420
+ font-weight: 700;
421
+ }}
422
+ QFrame[card="true"], QWidget[card="true"] {{
423
+ background: {c.surface};
424
+ border: 1px solid {c.border};
425
+ border-radius: 10px;
426
+ }}
427
+ QFrame#documentHeader {{
428
+ background: {c.chrome};
429
+ border-bottom: 1px solid {c.border};
430
+ }}
431
+ QFrame#subToolbar {{
432
+ background: {c.surface_alt};
433
+ border-bottom: 1px solid {c.border};
434
+ }}
435
+ QFrame#questionCard {{
436
+ background: {c.surface};
437
+ border: 1px solid {c.border};
438
+ border-left: 4px solid {c.accent};
439
+ border-radius: 8px;
440
+ }}
441
+ QFrame#homeHero {{
442
+ background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
443
+ stop:0 {c.accent_soft}, stop:0.55 {c.surface}, stop:1 {c.surface_alt});
444
+ border: 1px solid {c.border};
445
+ border-radius: 14px;
446
+ }}
447
+ QFrame#dropZone {{
448
+ background: {c.surface_alt};
449
+ border: 1px dashed {c.border_strong};
450
+ border-radius: 10px;
451
+ }}
452
+ QFrame#dropZone[dragActive="true"] {{
453
+ border: 2px solid {c.accent};
454
+ background: {c.accent_soft};
455
+ }}
456
+ QFrame#emptyState {{
457
+ background: {c.surface_alt};
458
+ border: 1px dashed {c.border};
459
+ border-radius: 10px;
460
+ }}
461
+ QProgressBar {{
462
+ background: {c.chrome};
463
+ border: 1px solid {c.border};
464
+ border-radius: 4px;
465
+ text-align: center;
466
+ min-height: 8px;
467
+ }}
468
+ QProgressBar::chunk {{
469
+ background: {c.accent};
470
+ border-radius: 3px;
471
+ }}
472
+ QScrollBar:vertical {{
473
+ background: transparent;
474
+ width: 12px;
475
+ margin: 2px;
476
+ }}
477
+ QScrollBar::handle:vertical {{
478
+ background: {c.border_strong};
479
+ min-height: 26px;
480
+ border-radius: 4px;
481
+ }}
482
+ QScrollBar::handle:vertical:hover {{
483
+ background: {c.text_subtle};
484
+ }}
485
+ QScrollBar:horizontal {{
486
+ background: transparent;
487
+ height: 12px;
488
+ margin: 2px;
489
+ }}
490
+ QScrollBar::handle:horizontal {{
491
+ background: {c.border_strong};
492
+ min-width: 26px;
493
+ border-radius: 4px;
494
+ }}
495
+ QScrollBar::add-line, QScrollBar::sub-line {{
496
+ width: 0;
497
+ height: 0;
498
+ }}
499
+ QScrollBar::add-page, QScrollBar::sub-page {{
500
+ background: transparent;
501
+ }}
502
+ QStatusBar {{
503
+ background: {c.chrome};
504
+ border-top: 1px solid {c.border};
505
+ color: {c.text_muted};
506
+ }}
507
+ QStatusBar QLabel {{
508
+ color: {c.text_muted};
509
+ padding: 0 6px;
510
+ }}
511
+ QStatusBar::item {{
512
+ border: none;
513
+ }}
514
+ QToolTip {{
515
+ background: {c.surface};
516
+ color: {c.text};
517
+ border: 1px solid {c.border_strong};
518
+ padding: 4px 6px;
519
+ }}
520
+ QGroupBox {{
521
+ border: 1px solid {c.border};
522
+ border-radius: 6px;
523
+ margin-top: 10px;
524
+ padding-top: 8px;
525
+ font-weight: 700;
526
+ }}
527
+ QGroupBox::title {{
528
+ subcontrol-origin: margin;
529
+ left: 8px;
530
+ padding: 0 4px;
531
+ color: {c.text_muted};
532
+ }}
533
+ QCheckBox, QRadioButton {{
534
+ spacing: 6px;
535
+ }}
536
+ QCheckBox::indicator, QRadioButton::indicator {{
537
+ width: 15px;
538
+ height: 15px;
539
+ }}
540
+ QSplitter::handle {{
541
+ background: {c.border};
542
+ }}
543
+ QMdiArea {{
544
+ background: {c.background};
545
+ }}
546
+ QMdiSubWindow {{
547
+ background: {c.surface};
548
+ border: 1px solid {c.border};
549
+ }}
550
+ """ + _component_styles(c)
551
+
552
+
553
+ def apply_theme(app: QApplication, name: str | None = None) -> str:
554
+ global _active
555
+ selected = name if name in VALID_THEMES else _active
556
+ _active = selected
557
+ app.setStyle("Fusion")
558
+ app.setPalette(_palette(theme_colors(selected)))
559
+ app.setFont(_font())
560
+ app.setStyleSheet(stylesheet(selected))
561
+ try:
562
+ from statstudio.ui.icons import set_icon_theme
563
+
564
+ set_icon_theme(selected)
565
+ except Exception:
566
+ pass
567
+ return selected
568
+
569
+ # Additional component styles are appended here to keep the token block readable.
570
+ def _component_styles(colors: ThemeColors) -> str:
571
+ c = colors
572
+ return f"""
573
+ QFrame[cardAction="true"] {{
574
+ background: {c.surface};
575
+ border: 1px solid {c.border};
576
+ border-radius: 9px;
577
+ }}
578
+ QFrame[cardAction="true"]:hover, QFrame[cardAction="true"][active="true"] {{
579
+ background: {c.accent_soft};
580
+ border-color: {c.accent};
581
+ }}
582
+ QFrame[cardAction="true"] QLabel {{
583
+ background: transparent;
584
+ }}
585
+ QPushButton[recentProject="true"] {{
586
+ text-align: left;
587
+ background: transparent;
588
+ border: 1px solid transparent;
589
+ padding: 7px 9px;
590
+ }}
591
+ QPushButton[recentProject="true"]:hover {{
592
+ background: {c.surface_alt};
593
+ border-color: {c.border};
594
+ }}
595
+ QPushButton[sample="true"] {{
596
+ background: {c.surface_alt};
597
+ border-color: {c.border};
598
+ text-align: left;
599
+ padding: 7px 10px;
600
+ }}
601
+ QPushButton[sample="true"]:hover {{
602
+ background: {c.accent_soft};
603
+ border-color: {c.accent};
604
+ }}
605
+ QPushButton[commandChip="true"] {{
606
+ background: {c.surface_alt};
607
+ border-color: {c.border};
608
+ border-radius: 12px;
609
+ padding: 3px 10px;
610
+ }}
611
+ QPushButton[commandChip="true"]:hover {{
612
+ background: {c.accent_soft};
613
+ border-color: {c.accent};
614
+ }}
615
+ QListWidget#hubCategories {{
616
+ background: {c.chrome};
617
+ border: 1px solid {c.border};
618
+ border-radius: 7px;
619
+ padding: 4px;
620
+ }}
621
+ QListWidget#hubCategories::item {{
622
+ padding: 7px 9px;
623
+ border-radius: 5px;
624
+ }}
625
+ QListWidget#hubCategories::item:selected {{
626
+ background: {c.accent_soft};
627
+ color: {c.text};
628
+ }}
629
+ QTreeWidget#hubCommands {{
630
+ border: 1px solid {c.border};
631
+ border-radius: 7px;
632
+ }}
633
+ QTreeWidget#hubCommands::item {{
634
+ padding: 5px 4px;
635
+ }}
636
+ QLineEdit#hubSearch {{
637
+ min-height: 24px;
638
+ font-size: 14px;
639
+ padding: 6px 10px;
640
+ }}
641
+ QLabel#emptyStateTitle {{
642
+ font-size: 15px;
643
+ font-weight: 700;
644
+ }}
645
+ """