ms-components 0.5.6__tar.gz → 0.5.7__tar.gz

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 (145) hide show
  1. {ms_components-0.5.6 → ms_components-0.5.7}/PKG-INFO +1 -1
  2. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/bridge.py +7 -1
  3. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/detail.py +12 -4
  4. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/models.py +6 -0
  5. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/polling.py +36 -6
  6. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_settings/panel.py +5 -1
  7. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/palettes.py +49 -0
  8. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/theme.py +48 -3
  9. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components.egg-info/PKG-INFO +1 -1
  10. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components.egg-info/SOURCES.txt +1 -0
  11. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components.egg-info/scm_file_list.json +2 -0
  12. ms_components-0.5.7/src/ms_components.egg-info/scm_version.json +8 -0
  13. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_molsuite_monitor_bridge.py +37 -0
  14. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_molsuite_monitor_widgets.py +18 -0
  15. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_theme_contrast.py +32 -3
  16. ms_components-0.5.7/tests/test_theme_menu.py +72 -0
  17. ms_components-0.5.6/src/ms_components.egg-info/scm_version.json +0 -8
  18. {ms_components-0.5.6 → ms_components-0.5.7}/.github/workflows/docs.yml +0 -0
  19. {ms_components-0.5.6 → ms_components-0.5.7}/.github/workflows/publish.yml +0 -0
  20. {ms_components-0.5.6 → ms_components-0.5.7}/.gitignore +0 -0
  21. {ms_components-0.5.6 → ms_components-0.5.7}/LICENSE +0 -0
  22. {ms_components-0.5.6 → ms_components-0.5.7}/MANIFEST.in +0 -0
  23. {ms_components-0.5.6 → ms_components-0.5.7}/README.md +0 -0
  24. {ms_components-0.5.6 → ms_components-0.5.7}/examples/tutorial_demo.py +0 -0
  25. {ms_components-0.5.6 → ms_components-0.5.7}/examples/tutorial_demo.toml +0 -0
  26. {ms_components-0.5.6 → ms_components-0.5.7}/licenses/qt-themes-LICENSE.txt +0 -0
  27. {ms_components-0.5.6 → ms_components-0.5.7}/pyproject.toml +0 -0
  28. {ms_components-0.5.6 → ms_components-0.5.7}/setup.cfg +0 -0
  29. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/__init__.py +0 -0
  30. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/backdrop.py +0 -0
  31. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/base.qss +0 -0
  32. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/chips.py +0 -0
  33. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ketcher.py +0 -0
  34. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/labels.py +0 -0
  35. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/listview.py +0 -0
  36. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_dockwidget/__init__.py +0 -0
  37. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_dockwidget/resources/__init__.py +0 -0
  38. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_dockwidget/resources/icons/__init__.py +0 -0
  39. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_dockwidget/resources/icons/folder.svg +0 -0
  40. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_dockwidget/widget.py +0 -0
  41. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_executors.py +0 -0
  42. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/__init__.py +0 -0
  43. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/config.py +0 -0
  44. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/formatting.py +0 -0
  45. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/jobs.py +0 -0
  46. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/palette.py +0 -0
  47. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/resources.py +0 -0
  48. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_monitor/widget.py +0 -0
  49. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_projects/__init__.py +0 -0
  50. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_projects/app.py +0 -0
  51. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_projects/backend.py +0 -0
  52. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_projects/browser.py +0 -0
  53. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_projects/scratch.py +0 -0
  54. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_projects/widget.py +0 -0
  55. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/__init__.py +0 -0
  56. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/command_line.py +0 -0
  57. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/actions.svg +0 -0
  58. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/box.svg +0 -0
  59. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/center.svg +0 -0
  60. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/display.svg +0 -0
  61. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/export.svg +0 -0
  62. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/hide.svg +0 -0
  63. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/hydrogens-polar.svg +0 -0
  64. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/hydrogens.svg +0 -0
  65. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/menu.svg +0 -0
  66. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/orient.svg +0 -0
  67. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/presets.svg +0 -0
  68. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/rock.svg +0 -0
  69. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/save.svg +0 -0
  70. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/selection.svg +0 -0
  71. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/settings.svg +0 -0
  72. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/style.svg +0 -0
  73. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/icons/zoom.svg +0 -0
  74. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/plugins.py +0 -0
  75. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/scene.py +0 -0
  76. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_pymol/widget.py +0 -0
  77. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_settings/__init__.py +0 -0
  78. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_stepper.py +0 -0
  79. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/__init__.py +0 -0
  80. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/action_header.py +0 -0
  81. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/cell_delegate.py +0 -0
  82. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/column_panel.py +0 -0
  83. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/example_usage.py +0 -0
  84. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/filter_panel.py +0 -0
  85. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/columns.svg +0 -0
  86. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/export.svg +0 -0
  87. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/filter.svg +0 -0
  88. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/menu.svg +0 -0
  89. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/reload.svg +0 -0
  90. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/search.svg +0 -0
  91. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/settings.svg +0 -0
  92. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/sort-asc.svg +0 -0
  93. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/sort-desc.svg +0 -0
  94. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/icons/sort.svg +0 -0
  95. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/metric_filter_bar.py +0 -0
  96. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/pagination_control.py +0 -0
  97. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/query_builder.py +0 -0
  98. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/session_provider.py +0 -0
  99. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/smart_table_view.py +0 -0
  100. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/sort_panel.py +0 -0
  101. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/table_config.py +0 -0
  102. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/table_interaction.py +0 -0
  103. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/table_model.py +0 -0
  104. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/test_external_filters.py +0 -0
  105. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_table/test_toolbar.py +0 -0
  106. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_tutorial/__init__.py +0 -0
  107. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_tutorial/bindings.py +0 -0
  108. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_tutorial/controller.py +0 -0
  109. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_tutorial/models.py +0 -0
  110. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/ms_tutorial/overlay.py +0 -0
  111. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/opengl.py +0 -0
  112. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/pagination.py +0 -0
  113. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/step_dialog.py +0 -0
  114. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/tool_panel.py +0 -0
  115. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components/wheel.py +0 -0
  116. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components.egg-info/dependency_links.txt +0 -0
  117. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components.egg-info/requires.txt +0 -0
  118. {ms_components-0.5.6 → ms_components-0.5.7}/src/ms_components.egg-info/top_level.txt +0 -0
  119. {ms_components-0.5.6 → ms_components-0.5.7}/tests/conftest.py +0 -0
  120. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_app_settings.py +0 -0
  121. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_chips.py +0 -0
  122. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_dock_window.py +0 -0
  123. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_executors_ui.py +0 -0
  124. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_ketcher.py +0 -0
  125. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_monitor_config.py +0 -0
  126. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_ms_projects_widget.py +0 -0
  127. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_opengl.py +0 -0
  128. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_optional_integrations.py +0 -0
  129. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_progress_column.py +0 -0
  130. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_project_browser.py +0 -0
  131. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_pymol_command_line.py +0 -0
  132. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_pymol_grid.py +0 -0
  133. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_pymol_scene.py +0 -0
  134. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_pymol_toolbar.py +0 -0
  135. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_query_builder_keyset.py +0 -0
  136. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_shift_hscroll.py +0 -0
  137. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_split_button_style.py +0 -0
  138. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_step_dialog.py +0 -0
  139. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_table_autofill_lifecycle.py +0 -0
  140. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_table_interaction.py +0 -0
  141. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_table_toolbar.py +0 -0
  142. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_table_view_state.py +0 -0
  143. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_tool_panel.py +0 -0
  144. {ms_components-0.5.6 → ms_components-0.5.7}/tests/test_tutorial.py +0 -0
  145. {ms_components-0.5.6 → ms_components-0.5.7}/zensical.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ms_components
3
- Version: 0.5.6
3
+ Version: 0.5.7
4
4
  Summary: PySide6 UI components for MolSuite: smart table, project browser, job monitor, PyMOL dock, steppers.
5
5
  Author: Mario S. Valdés-Tresanco, Mario E. Valdés-Tresanco
6
6
  License-Expression: MIT
@@ -36,11 +36,16 @@ class MolSuiteMonitorBridge(QObject):
36
36
  max_recent_jobs: int = MonitorConfig.model_fields["max_recent_jobs"].default,
37
37
  resume=None,
38
38
  destinations=None,
39
+ measure=None,
39
40
  parent: QObject | None = None,
40
41
  ) -> None:
41
42
  """`resume(job_id, executor or None)` and `destinations(job_id) -> names` are for an
42
43
  application that keeps its own rules of where a job may go: left out, the workspace
43
- continues the job and every active executor is offered."""
44
+ continues the job and every active executor is offered.
45
+ `measure(job_id) -> {"done": int, "total": int, "unit": str} | None` is what the
46
+ application counts in a job besides its chunks (the records a chunk holds, say): the
47
+ monitor shows its rate in that unit. Called on the polling thread, every poll while the
48
+ job runs and once after it ends; None for a job it does not measure."""
44
49
  super().__init__(parent)
45
50
  self._workspace = workspace
46
51
  self._resume = resume or self._workspace_resume
@@ -52,6 +57,7 @@ class MolSuiteMonitorBridge(QObject):
52
57
  workspace=workspace,
53
58
  poll_ms=poll_ms,
54
59
  max_recent_jobs=max_recent_jobs,
60
+ measure=measure,
55
61
  )
56
62
  self._sync_state = MonitorSyncState()
57
63
  self._connect_poller(self._poller)
@@ -507,9 +507,16 @@ class JobDetail(QWidget):
507
507
  self._bar.update()
508
508
  speed = format_speed(job.throughput_eps)
509
509
  number, _, unit = speed.partition("/")
510
- cpu = f" · {job.cpu_used:,} CPUs" if job.cpu_used else ""
511
- self._speed.set(number, f"{job.tasks_running:,} tasks{cpu}" if not job.is_terminal else "mean over the run",
512
- accent, unit=f"chunks/{unit}" if unit else "")
510
+ if job.items_unit:
511
+ # Chunks lead: they are what every job has. What they hold is the line under it, in
512
+ # the application's unit (tasks and CPUs are in the header already).
513
+ items = format_speed(job.items_eps).replace("/", f" {job.items_unit}/")
514
+ done = f"{job.items_done:,}" + (f" / {job.items_total:,}" if job.items_total else "")
515
+ sub = f"{items} · {done}" + (" · mean" if job.is_terminal else "")
516
+ else:
517
+ cpu = f" · {job.cpu_used:,} CPUs" if job.cpu_used else ""
518
+ sub = f"{job.tasks_running:,} tasks{cpu}" if not job.is_terminal else "mean over the run"
519
+ self._speed.set(number, sub, accent, unit=f"chunks/{unit}" if unit else "")
513
520
  self._trend.values = job.throughput_history
514
521
  self._trend.update()
515
522
  self._set_failed_kpi()
@@ -702,7 +709,8 @@ class JobDetail(QWidget):
702
709
  format_duration((end - job.started_at).total_seconds()) if job.started_at else "—",
703
710
  f"{job.chunks_done:,} done · {job.chunks_failed:,} failed · {job.chunks_total:,} in all",
704
711
  f"{job.chunks_retried:,}",
705
- format_speed(job.throughput_eps) + ("" if job.is_terminal else " · last 5 min"),
712
+ format_speed(job.throughput_eps) + (f" · {format_speed(job.items_eps)} {job.items_unit}" if job.items_unit else "")
713
+ + ("" if job.is_terminal else " · last 5 min"),
706
714
  *_used(job, (end - job.started_at).total_seconds() if job.started_at else 0.0),
707
715
  f"{job.tasks_running:,} tasks · {job.cpu_used:,} CPUs" if not job.is_terminal else "—",
708
716
  f"{self._error_types:,} types" if self._error_types else "none",
@@ -57,6 +57,12 @@ class JobMonitorState:
57
57
  usage: dict = field(default_factory=dict) # what it used, kept once it ended: see ms_flow's JobSnapshot.usage
58
58
  throughput_eps: float = 0.0 # chunks settled per second over the last minutes; since it began once it ended
59
59
  throughput_history: list[float] = field(default_factory=list) # the same, one value per few seconds
60
+ # What the application counts in the job besides its chunks (records, files, frames...), when it
61
+ # says: see `MolSuiteMonitorBridge(measure=...)`. `items_unit` is "" for a job it does not measure.
62
+ items_unit: str = ""
63
+ items_done: int = 0
64
+ items_total: int = 0 # 0 when it does not say
65
+ items_eps: float = 0.0 # per second over the last minutes, like `throughput_eps`
60
66
  started_at: datetime | None = None
61
67
  finished_at: datetime | None = None
62
68
  tasks: list[TaskMonitorState] = field(default_factory=list) # read only for the selected job
@@ -45,7 +45,8 @@ def job_state(job, now: float) -> JobMonitorState:
45
45
 
46
46
 
47
47
  class _Speeds:
48
- """What each running job settled over the last minutes: `(time, settled)` every few seconds."""
48
+ """What each running job settled over the last minutes: `(time, chunks settled, items done)`
49
+ every few seconds. The history is of the chunks."""
49
50
 
50
51
  def __init__(self) -> None:
51
52
  self._seen: dict[str, deque] = {}
@@ -55,13 +56,14 @@ class _Speeds:
55
56
  self._seen.pop(job.job_id, None)
56
57
  return
57
58
  seen = self._seen.setdefault(job.job_id, deque(maxlen=SPEED_WINDOW_S // _SPEED_STEP_S + 1))
59
+ point = (now, job.chunks_settled, job.items_done)
58
60
  if not seen or now - seen[-1][0] >= _SPEED_STEP_S:
59
- seen.append((now, job.chunks_settled))
60
- points = [*seen, (now, job.chunks_settled)]
61
- (t0, s0), (t1, s1) = points[0], points[-1]
61
+ seen.append(point)
62
+ (t0, c0, i0), (t1, c1, i1) = seen[0], point
62
63
  if t1 - t0 >= _SPEED_STEP_S: # until then the mean since it began stands
63
- job.throughput_eps = (s1 - s0) / (t1 - t0)
64
- job.throughput_history = [(b - a) / (u - t) for (t, a), (u, b) in zip(seen, list(seen)[1:]) if u > t]
64
+ job.throughput_eps = (c1 - c0) / (t1 - t0)
65
+ job.items_eps = (i1 - i0) / (t1 - t0)
66
+ job.throughput_history = [(b[1] - a[1]) / (b[0] - a[0]) for a, b in zip(seen, list(seen)[1:]) if b[0] > a[0]]
65
67
 
66
68
  def keep(self, job_ids) -> None:
67
69
  for job_id in self._seen.keys() - set(job_ids):
@@ -83,10 +85,13 @@ class MolSuiteMonitorPoller(QObject):
83
85
  workspace,
84
86
  poll_ms: int = 500,
85
87
  max_recent_jobs: int = 20,
88
+ measure=None,
86
89
  parent: QObject | None = None,
87
90
  ) -> None:
88
91
  super().__init__(parent)
89
92
  self._workspace = workspace
93
+ self._measure = measure
94
+ self._measured: dict[str, dict] = {} # the last word on a job that ended: asked no more
90
95
  # Only poll fast while jobs are active; back off hard when idle.
91
96
  self._active_poll_ms = max(100, poll_ms)
92
97
  self._idle_poll_ms = max(self._active_poll_ms, 3000)
@@ -155,6 +160,28 @@ class MolSuiteMonitorPoller(QObject):
155
160
  self._last_snapshot = snapshot
156
161
  self.project_snapshot_updated.emit(snapshot)
157
162
 
163
+ def _apply_measure(self, job: JobMonitorState, now: float) -> None:
164
+ """What the application counts in `job`, from `measure(job_id)`: `{"done", "total", "unit"}`
165
+ or None. A job that ended is asked once more and then kept."""
166
+ if self._measure is None:
167
+ return
168
+ said = self._measured.get(job.job_id)
169
+ if said is None:
170
+ try:
171
+ said = self._measure(job.job_id)
172
+ except Exception: # noqa: BLE001 — a figure of the application must never stop the monitor
173
+ said = None
174
+ if not said or not said.get("unit"):
175
+ return
176
+ if job.is_terminal:
177
+ self._measured[job.job_id] = said
178
+ job.items_unit = str(said["unit"])
179
+ job.items_done = max(0, int(said.get("done") or 0))
180
+ job.items_total = max(0, int(said.get("total") or 0))
181
+ end = job.finished_at.timestamp() if job.finished_at else now
182
+ elapsed = end - job.started_at.timestamp() if job.started_at else 0.0
183
+ job.items_eps = job.items_done / elapsed if elapsed > 0 else 0.0 # the mean; `_Speeds` gives the recent one
184
+
158
185
  def _build_snapshot(self) -> ProjectMonitorState:
159
186
  workspace = self._workspace
160
187
  context = workspace.active_context
@@ -165,7 +192,10 @@ class MolSuiteMonitorPoller(QObject):
165
192
  jobs = [job_state(job, now) for job in workspace.jobs(self._max_recent_jobs)][::-1]
166
193
  jobs.sort(key=lambda job: job.is_terminal) # stable: active first, newest first in each
167
194
  self._speeds.keep(job.job_id for job in jobs)
195
+ shown = {job.job_id for job in jobs}
196
+ self._measured = {job_id: said for job_id, said in self._measured.items() if job_id in shown}
168
197
  for job in jobs:
198
+ self._apply_measure(job, now)
169
199
  self._speeds.apply(job, now)
170
200
  if job.job_id == self.selected and not job.is_terminal:
171
201
  job.tasks = [
@@ -613,7 +613,11 @@ class AppSettingsPanel(QWidget):
613
613
  def _create_editor(entry: ConfigurationEntry, parent: QWidget) -> QWidget:
614
614
  annotation = entry.annotation
615
615
  if entry.choices:
616
- editor = QComboBox(parent)
616
+ from ms_components.theme import THEMES, ThemeComboBox
617
+
618
+ theme_choices = all(isinstance(choice, str) for choice in entry.choices)
619
+ editor_type = ThemeComboBox if theme_choices and set(entry.choices) == {"auto", *THEMES} else QComboBox
620
+ editor = editor_type(parent)
617
621
  if entry.nullable:
618
622
  editor.addItem("None", None)
619
623
  for choice in entry.choices:
@@ -3,6 +3,10 @@
3
3
  Palette data from **qt-themes** by Beat Reichenbach (MIT, see `ms_components.theme`), stored
4
4
  here per QPalette role and nudged to the contrast floors that `tests/test_theme_contrast.py`
5
5
  enforces. How the keys become a QPalette: `ms_components.theme.build_palette`.
6
+ The Spectrum family is inspired by Zensical's modern default/slate surfaces and
7
+ primary/accent colors (https://zensical.org/docs/setup/colors/). Thanks to the
8
+ Zensical contributors for the original palette design; these MolSuite adaptations
9
+ use Qt roles and adjusted contrast, and are not official Zensical themes.
6
10
 
7
11
  Keys are the QPalette roles in snake_case, so a value is exactly what `palette(role)` returns
8
12
  in a stylesheet. What MolSuite asks of the roles Qt leaves loosely defined:
@@ -40,3 +44,48 @@ THEMES: dict[str, dict[str, str]] = {
40
44
  "nord": {"window": "#3b4252", "window_text": "#eceff4", "base": "#2e3440", "alternate_base": "#3b4252", "tooltip_base": "#2e3440", "tooltip_text": "#d8dee9", "placeholder_text": "#abafb8", "text": "#eceff4", "button": "#3b4252", "button_text": "#eceff4", "bright_text": "#0b0b0b", "light": "#2e3440", "midlight": "#2e3440", "mid": "#4c566a", "dark": "#525a6b", "shadow": "#878e9b", "highlight": "#81a1c1", "highlighted_text": "#2e3440", "link": "#88c0d0", "link_visited": "#88c0d0", "accent": "#88c0d0", "disabled_text": "#7c828e", "red": "#d89fa4", "orange": "#daa18f", "yellow": "#ebcb8b", "green": "#a3be8c", "cyan": "#88c0d0", "blue": "#97b2cc", "magenta": "#c3a5be"},
41
45
  "one_dark_two": {"window": "#282c34", "window_text": "#e6e6e6", "base": "#21252b", "alternate_base": "#282c34", "tooltip_base": "#21252b", "tooltip_text": "#969dab", "placeholder_text": "#919296", "text": "#e6e6e6", "button": "#282c34", "button_text": "#e6e6e6", "bright_text": "#191919", "light": "#1d1f23", "midlight": "#21252b", "mid": "#5b626d", "dark": "#4a505a", "shadow": "#6f7583", "highlight": "#62bac6", "highlighted_text": "#1d1f23", "link": "#eac786", "link_visited": "#eac786", "accent": "#eac786", "disabled_text": "#696b71", "red": "#e27881", "orange": "#e79c7e", "yellow": "#eac786", "green": "#98c379", "cyan": "#62bac6", "blue": "#71b9f4", "magenta": "#c88bda"},
42
46
  }
47
+
48
+ # Light/dark accents adapted from Zensical's primary colors to >= 4.5:1 on Qt surfaces.
49
+ _SPECTRUM_COLORS = {
50
+ "red": ("#bf4442", "#ef5956"),
51
+ "pink": ("#d41d5a", "#ed5487"),
52
+ "purple": ("#a544b6", "#c46fd3"),
53
+ "deep_purple": ("#7e56c2", "#a47bea"),
54
+ "indigo": ("#4051b5", "#588be9"),
55
+ "blue": ("#1871ba", "#2094f3"),
56
+ "light_blue": ("#0175aa", "#02a6f2"),
57
+ "cyan": ("#007989", "#00bdd6"),
58
+ "teal": ("#007c70", "#00bda4"),
59
+ "green": ("#367c38", "#71c174"),
60
+ "light_green": ("#56782e", "#8bc34b"),
61
+ "lime": ("#6a731d", "#cbdc38"),
62
+ "yellow": ("#786f1d", "#ffec3d"),
63
+ "amber": ("#8b6903", "#ffc105"),
64
+ "orange": ("#976315", "#ffa724"),
65
+ "deep_orange": ("#b54e2f", "#ff764d"),
66
+ "brown": ("#795649", "#c27a5f"),
67
+ "grey": ("#6e6e6e", "#8c8c8c"),
68
+ "blue_grey": ("#546d78", "#7c8f97"),
69
+ "black": ("#252629", "#898c93"),
70
+ "white": ("#6d6e70", "#e6e8ed"),
71
+ }
72
+ _SPECTRUM_LIGHT = {
73
+ **THEMES["github_light"],
74
+ "window": "#f5f6f8", "button": "#f5f6f8",
75
+ "alternate_base": "#fafbfc", "tooltip_base": "#fafbfc", "midlight": "#fafbfc",
76
+ "window_text": "#252629", "text": "#252629", "button_text": "#252629",
77
+ "dark": "#c5c7cc", "highlighted_text": "#ffffff",
78
+ "red": "#df1300", "orange": "#b25300", "blue": "#006fcf", "magenta": "#9535fa",
79
+ }
80
+ _SPECTRUM_DARK = {"window": "#16171a", "window_text": "#c6c7ca", "base": "#0b0c0f", "alternate_base": "#212226", "tooltip_base": "#212226", "tooltip_text": "#a5a8b0", "placeholder_text": "#a5a8b0", "text": "#c6c7ca", "button": "#16171a", "button_text": "#c6c7ca", "bright_text": "#0b0c0f", "light": "#0b0c0f", "midlight": "#212226", "mid": "#4e525c", "dark": "#393c44", "shadow": "#888d98", "highlight": "#00bda4", "highlighted_text": "#0b0c0f", "link": "#00ccb8", "link_visited": "#00ccb8", "accent": "#00bda4", "disabled_text": "#5f626b", "red": "#ff7b72", "orange": "#ffa657", "yellow": "#e3b341", "green": "#71c174", "cyan": "#56c8d8", "blue": "#79a9f5", "magenta": "#c98cdb"}
81
+ SPECTRUM_THEMES: dict[str, dict[str, str]] = {"light": {}, "dark": {}}
82
+ for _mode, _base in (("light", _SPECTRUM_LIGHT), ("dark", _SPECTRUM_DARK)):
83
+ for _color, _accents in _SPECTRUM_COLORS.items():
84
+ _name = f"spectrum_{_mode}_{_color}"
85
+ _accent = _accents[0 if _mode == "light" else 1]
86
+ _link = "#00ccb8" if (_mode, _color) == ("dark", "teal") else _accent
87
+ THEMES[_name] = {
88
+ **_base, "highlight": _accent, "accent": _accent,
89
+ "link": _link, "link_visited": _link,
90
+ }
91
+ SPECTRUM_THEMES[_mode][_color] = _name
@@ -25,10 +25,10 @@ from __future__ import annotations
25
25
  from importlib.resources import files
26
26
 
27
27
  from PySide6.QtCore import Qt
28
- from PySide6.QtGui import QColor, QFont, QFontDatabase, QPalette, QPen
29
- from PySide6.QtWidgets import QApplication, QProxyStyle, QStyle
28
+ from PySide6.QtGui import QActionGroup, QColor, QFont, QFontDatabase, QPalette, QPen
29
+ from PySide6.QtWidgets import QApplication, QComboBox, QMenu, QProxyStyle, QStyle
30
30
 
31
- from ms_components.palettes import DEFAULT_DARK, DEFAULT_LIGHT, THEMES
31
+ from ms_components.palettes import DEFAULT_DARK, DEFAULT_LIGHT, THEMES, SPECTRUM_THEMES
32
32
 
33
33
  _current: dict[str, str] = THEMES[DEFAULT_DARK]
34
34
 
@@ -176,6 +176,10 @@ def build_palette(theme: dict[str, str]) -> QPalette:
176
176
 
177
177
  def resolve(name: str) -> str:
178
178
  """Resolve auto, retired and invalid names to an available concrete theme."""
179
+ if name == "zensical_teal":
180
+ name = "spectrum_dark_teal"
181
+ elif name.startswith("zensical_"):
182
+ name = name.replace("zensical_", "spectrum_", 1)
179
183
  if name != "auto":
180
184
  candidate = _REMOVED_THEME_FALLBACKS.get(name, name)
181
185
  return candidate if candidate in THEMES else DEFAULT_DARK
@@ -186,6 +190,47 @@ def resolve(name: str) -> str:
186
190
  return DEFAULT_DARK if scheme == Qt.ColorScheme.Dark else DEFAULT_LIGHT
187
191
 
188
192
 
193
+ def build_theme_menu(current: str = "auto", parent=None) -> QMenu:
194
+ """A single exclusive choice, with Spectrum grouped by mode and primary color."""
195
+ menu = QMenu(parent)
196
+ menu.setToolTipsVisible(True)
197
+ group = QActionGroup(menu)
198
+ group.setExclusive(True)
199
+ if current != "auto":
200
+ current = resolve(current)
201
+
202
+ def add(target, label, name):
203
+ action = target.addAction(label)
204
+ action.setData(name)
205
+ action.setCheckable(True)
206
+ action.setChecked(name == current)
207
+ group.addAction(action)
208
+
209
+ for name in ("auto", *THEMES):
210
+ if not name.startswith("spectrum_"):
211
+ add(menu, name.replace("_", " ").title(), name)
212
+ spectrum = menu.addMenu("Spectrum themes")
213
+ spectrum.menuAction().setToolTip(
214
+ "Inspired by Zensical (https://zensical.org/docs/setup/colors/). "
215
+ "Thanks to its contributors; adapted for MolSuite."
216
+ )
217
+ for mode, colors in SPECTRUM_THEMES.items():
218
+ submenu = spectrum.addMenu(mode.title())
219
+ for color_name, name in colors.items():
220
+ add(submenu, color_name.replace("_", " ").title(), name)
221
+ return menu
222
+
223
+
224
+ class ThemeComboBox(QComboBox):
225
+ """The settings combo keeps its value API, but opens the grouped theme menu."""
226
+
227
+ def showPopup(self) -> None:
228
+ menu = build_theme_menu(self.currentData(), self)
229
+ menu.triggered.connect(lambda action: self.setCurrentIndex(self.findData(action.data())))
230
+ menu.exec(self.mapToGlobal(self.rect().bottomLeft()))
231
+ menu.deleteLater()
232
+
233
+
189
234
  #: The accents a widget can wear through `setProperty("tone", name)`.
190
235
  TONES = ("green", "red")
191
236
  HUES = ("red", "orange", "yellow", "green", "cyan", "blue", "magenta")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ms_components
3
- Version: 0.5.6
3
+ Version: 0.5.7
4
4
  Summary: PySide6 UI components for MolSuite: smart table, project browser, job monitor, PyMOL dock, steppers.
5
5
  Author: Mario S. Valdés-Tresanco, Mario E. Valdés-Tresanco
6
6
  License-Expression: MIT
@@ -137,5 +137,6 @@ tests/test_table_interaction.py
137
137
  tests/test_table_toolbar.py
138
138
  tests/test_table_view_state.py
139
139
  tests/test_theme_contrast.py
140
+ tests/test_theme_menu.py
140
141
  tests/test_tool_panel.py
141
142
  tests/test_tutorial.py
@@ -14,6 +14,7 @@
14
14
  "docs/ms_monitor_state_contract.md",
15
15
  "docs/ms_tutorial.md",
16
16
  "docs/project_form_events.md",
17
+ "docs/spectrum_contrast.md",
17
18
  "docs/usage.md",
18
19
  "examples/tutorial_demo.py",
19
20
  "examples/tutorial_demo.toml",
@@ -140,6 +141,7 @@
140
141
  "tests/test_table_toolbar.py",
141
142
  "tests/test_table_view_state.py",
142
143
  "tests/test_theme_contrast.py",
144
+ "tests/test_theme_menu.py",
143
145
  "tests/test_tool_panel.py",
144
146
  "tests/test_tutorial.py",
145
147
  "zensical.toml"
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.5.7",
3
+ "distance": 0,
4
+ "node": "g5a3523ad0bb012f50cca0fbb9b0c4050a5400d73",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-11-09"
8
+ }
@@ -204,3 +204,40 @@ def test_a_job_is_moved_while_it_runs_from_the_buttons_of_the_monitor(ms, tmp_pa
204
204
  QApplication.processEvents()
205
205
  time.sleep(0.01)
206
206
  assert heard[1][0] == "resume_job" and "already ended" in heard[1][1]
207
+
208
+
209
+ def test_what_the_application_measures_is_shown_with_the_chunks(ms, tmp_path):
210
+ """`measure` names a unit and how many of it are done: asked while the job runs, once after."""
211
+ _open(ms, tmp_path)
212
+ asked, done = [], {"n": 3}
213
+
214
+ def measure(job_id):
215
+ asked.append(job_id)
216
+ return {"done": done["n"], "total": 12, "unit": "records"} if job_id == state_id[0] else None
217
+
218
+ state_id = [None]
219
+ bridge = MolSuiteMonitorBridge(workspace=ms, poll_ms=50, measure=measure)
220
+ GATE.clear()
221
+ job_id = ms.submit(halves, executor="thread")
222
+ state_id[0] = _visible(bridge).job_id
223
+ running = bridge.refresh_now().jobs[0]
224
+ assert (running.items_unit, running.items_done, running.items_total) == ("records", 3, 12)
225
+ assert running.items_eps > 0 # the mean since it began, until there are minutes to go by
226
+
227
+ GATE.set()
228
+ ms.engine.wait(job_id, 30)
229
+ done["n"] = 12
230
+ bridge.refresh_now()
231
+ calls = len(asked)
232
+ done["n"] = 99 # it ended: the last word stands
233
+ [ended] = bridge.refresh_now().jobs
234
+ assert (ended.items_done, len(asked)) == (12, calls)
235
+
236
+
237
+ def test_a_job_the_application_does_not_measure_shows_its_chunks_alone(ms, tmp_path):
238
+ _open(ms, tmp_path)
239
+ bridge = MolSuiteMonitorBridge(workspace=ms, poll_ms=50, measure=lambda job_id: 1 / 0)
240
+ GATE.set()
241
+ ms.engine.wait(ms.submit(halves, executor="thread"), 30)
242
+ [state] = bridge.refresh_now().jobs
243
+ assert (state.items_unit, state.items_done, state.status) == ("", 0, "completed_with_errors")
@@ -49,6 +49,24 @@ def test_speed_is_that_of_the_last_minutes_and_goes_once_the_job_ends():
49
49
  assert speeds._seen == {}
50
50
 
51
51
 
52
+ def test_a_measured_job_has_the_speed_of_its_items_and_its_history_in_chunks():
53
+ speeds, job = _Speeds(), _job(chunks_done=0, chunks_failed=0, items_unit="records", items_done=0)
54
+ speeds.apply(job, 1000.0)
55
+ job = _job(chunks_done=10, chunks_failed=0, items_unit="records", items_done=300)
56
+ speeds.apply(job, 1010.0)
57
+ assert (job.throughput_eps, job.items_eps, job.throughput_history) == (1.0, 30.0, [1.0])
58
+
59
+
60
+ def test_the_throughput_card_leads_with_chunks_and_says_the_items_under_them():
61
+ QApplication.instance() or QApplication([])
62
+ detail = JobDetail()
63
+ detail.set_job(_job(throughput_eps=2.0, items_unit="records", items_done=1200, items_total=5000, items_eps=64.0))
64
+ assert (detail._speed.value.text(), detail._speed.unit.text()) == ("2.0", "chunks/s")
65
+ assert detail._speed.sub.text() == "64.0 records/s · 1,200 / 5,000"
66
+ detail.set_job(_job(throughput_eps=2.0)) # one the application does not measure: as before
67
+ assert detail._speed.unit.text() == "chunks/s" and "tasks" in detail._speed.sub.text()
68
+
69
+
52
70
  def test_the_detail_shows_the_numbers_the_tasks_and_the_failures_grouped():
53
71
  QApplication.instance() or QApplication([])
54
72
  detail = JobDetail()
@@ -1,6 +1,9 @@
1
+ import pytest
1
2
  from PySide6.QtGui import QColor, QPalette
2
3
 
3
- from ms_components.theme import HUES, TONES, THEMES, base_qss, build_palette, contrast_ratio, resolve
4
+ from ms_components.theme import (
5
+ HUES, TONES, THEMES, SPECTRUM_THEMES, base_qss, build_palette, contrast_ratio, is_dark, resolve,
6
+ )
4
7
 
5
8
  def _floor(theme, key, minimum, *against):
6
9
  against = against or ("window", "base", "alternate_base")
@@ -49,6 +52,31 @@ def test_hybrid_themes_use_github_surfaces_and_the_requested_accents():
49
52
  assert abs(QColor(theme[role]).hue() - QColor(THEMES[source][source_role]).hue()) <= 2
50
53
 
51
54
 
55
+ def test_spectrum_teal_carries_the_same_roles_and_readable_header_hints():
56
+ theme = THEMES["spectrum_dark_teal"]
57
+ assert resolve("zensical_teal") == "spectrum_dark_teal"
58
+ assert theme.keys() == THEMES["catppuccin_mocha"].keys()
59
+ assert all(QColor(value).isValid() for value in theme.values())
60
+ _floor(theme, "placeholder_text", 4.5, "dark") # table toolbar metadata
61
+ _floor(theme, "shadow", 3.0, "dark")
62
+
63
+
64
+ def test_spectrum_has_both_modes_for_every_primary_color():
65
+ assert set(SPECTRUM_THEMES) == {"light", "dark"}
66
+ assert len(SPECTRUM_THEMES["light"]) == 21
67
+ assert SPECTRUM_THEMES["light"].keys() == SPECTRUM_THEMES["dark"].keys()
68
+ for mode, colors in SPECTRUM_THEMES.items():
69
+ for color_name, name in colors.items():
70
+ theme = THEMES[name]
71
+ assert name == f"spectrum_{mode}_{color_name}"
72
+ assert resolve(name) == name
73
+ assert resolve(f"zensical_{mode}_{color_name}") == name
74
+ assert theme.keys() == THEMES["catppuccin_mocha"].keys()
75
+ assert all(QColor(value).isValid() for value in theme.values())
76
+ assert is_dark(theme) == (mode == "dark")
77
+ assert not any(name.startswith("zensical_") for name in THEMES)
78
+
79
+
52
80
  def test_muted_and_disabled_text_read_as_different_levels():
53
81
  for name, theme in THEMES.items():
54
82
  window = QColor(theme["window"])
@@ -67,13 +95,14 @@ def test_the_palette_carries_every_role_and_the_disabled_text():
67
95
  assert set(TONES) <= set(theme)
68
96
 
69
97
 
70
- def test_checkbox_and_radio_edges_reach_three_to_one():
98
+ @pytest.mark.parametrize("name", ("catppuccin_mocha", "spectrum_dark_teal"))
99
+ def test_checkbox_and_radio_edges_reach_three_to_one(name):
71
100
  from PySide6.QtWidgets import QApplication, QCheckBox, QRadioButton
72
101
 
73
102
  from ms_components.theme import apply_theme
74
103
 
75
104
  app = QApplication.instance() or QApplication([])
76
- apply_theme("catppuccin_mocha", app) # Fusion alone draws these near 1.5:1
105
+ apply_theme(name, app) # Fusion alone draws these near 1.5:1
77
106
  window = app.palette().window().color()
78
107
  for box in (QCheckBox(), QRadioButton()):
79
108
  box.resize(box.sizeHint())
@@ -0,0 +1,72 @@
1
+ from types import SimpleNamespace
2
+
3
+ from PySide6.QtCore import QTimer
4
+ from PySide6.QtWidgets import QApplication, QComboBox, QWidget
5
+
6
+ from ms_components.ms_settings import AppSettingsPanel
7
+ from ms_components.theme import THEMES, SPECTRUM_THEMES, ThemeComboBox, build_theme_menu
8
+
9
+
10
+ def _leaves(menu):
11
+ return [leaf for action in menu.actions()
12
+ for leaf in (_leaves(action.menu()) if action.menu() else [action])]
13
+
14
+
15
+ def test_spectrum_menu_groups_modes_and_keeps_one_exclusive_selection():
16
+ app = QApplication.instance() or QApplication([])
17
+ menu = build_theme_menu("zensical_teal")
18
+ try:
19
+ root = menu.actions()
20
+ assert [action.data() for action in root if not action.menu()] == [
21
+ "auto", *(name for name in THEMES if not name.startswith("spectrum_")),
22
+ ]
23
+ spectrum = root[-1].menu()
24
+ assert spectrum.title() == "Spectrum themes"
25
+ assert "Zensical" in spectrum.menuAction().toolTip()
26
+ assert menu.toolTipsVisible()
27
+ assert [action.text() for action in spectrum.actions()] == ["Light", "Dark"]
28
+ for mode_action, colors in zip(spectrum.actions(), SPECTRUM_THEMES.values()):
29
+ assert [action.data() for action in mode_action.menu().actions()] == list(colors.values())
30
+ leaves = _leaves(menu)
31
+ assert [action.data() for action in leaves if action.isChecked()] == ["spectrum_dark_teal"]
32
+ picked = []
33
+ menu.triggered.connect(lambda action: picked.append(action.data()))
34
+ next(action for action in leaves if action.data() == "spectrum_light_purple").trigger()
35
+ assert picked == ["spectrum_light_purple"]
36
+ assert [action.data() for action in leaves if action.isChecked()] == picked
37
+ app.processEvents()
38
+ finally:
39
+ menu.deleteLater()
40
+
41
+
42
+ def test_settings_theme_combo_uses_the_menu_and_preserves_the_value_api():
43
+ app = QApplication.instance() or QApplication([])
44
+ parent = QWidget()
45
+ entry = SimpleNamespace(annotation=str, choices=("auto", *THEMES), nullable=False)
46
+ combo = AppSettingsPanel._create_editor(entry, parent)
47
+ assert isinstance(combo, ThemeComboBox)
48
+ combo.setCurrentIndex(combo.findData("spectrum_dark_teal"))
49
+ changed = []
50
+ combo.currentIndexChanged.connect(lambda _: changed.append(combo.currentData()))
51
+
52
+ def choose():
53
+ menu = app.activePopupWidget()
54
+ try:
55
+ next(action for action in _leaves(menu) if action.data() == "spectrum_dark_blue").trigger()
56
+ finally:
57
+ menu.close()
58
+
59
+ QTimer.singleShot(0, choose)
60
+ try:
61
+ combo.showPopup()
62
+ assert changed == ["spectrum_dark_blue"]
63
+ assert combo.currentData() == "spectrum_dark_blue"
64
+ for choices in (("one", "two"), (["one"], ["two"])):
65
+ ordinary = AppSettingsPanel._create_editor(
66
+ SimpleNamespace(annotation=str, choices=choices, nullable=False), parent,
67
+ )
68
+ assert type(ordinary) is QComboBox
69
+ assert ordinary.itemData(0) == choices[0]
70
+ app.processEvents()
71
+ finally:
72
+ parent.deleteLater()
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.5.6",
3
- "distance": 0,
4
- "node": "gfeb8dbeafe4b3e0076109438cf4fc53b2b776cc9",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-11-08"
8
- }
File without changes
File without changes
File without changes
File without changes
File without changes