ms-components 0.5.8__tar.gz → 0.6.0__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 (150) hide show
  1. {ms_components-0.5.8 → ms_components-0.6.0}/PKG-INFO +1 -1
  2. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/base.qss +3 -3
  3. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/chips.py +11 -1
  4. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_dockwidget/widget.py +20 -1
  5. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/detail.py +28 -13
  6. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/jobs.py +5 -0
  7. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/models.py +5 -0
  8. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_projects/browser.py +36 -16
  9. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_projects/widget.py +2 -2
  10. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/widget.py +7 -5
  11. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/action_header.py +2 -2
  12. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/pagination_control.py +1 -1
  13. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/smart_table_view.py +2 -2
  14. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/table_config.py +5 -0
  15. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/table_model.py +5 -0
  16. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components.egg-info/PKG-INFO +1 -1
  17. ms_components-0.6.0/src/ms_components.egg-info/scm_version.json +8 -0
  18. ms_components-0.6.0/tests/test_chips.py +81 -0
  19. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_dock_window.py +30 -0
  20. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_molsuite_monitor_widgets.py +21 -0
  21. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_ms_projects_widget.py +30 -0
  22. ms_components-0.5.8/src/ms_components.egg-info/scm_version.json +0 -8
  23. ms_components-0.5.8/tests/test_chips.py +0 -16
  24. {ms_components-0.5.8 → ms_components-0.6.0}/.github/workflows/docs.yml +0 -0
  25. {ms_components-0.5.8 → ms_components-0.6.0}/.github/workflows/publish.yml +0 -0
  26. {ms_components-0.5.8 → ms_components-0.6.0}/.gitignore +0 -0
  27. {ms_components-0.5.8 → ms_components-0.6.0}/LICENSE +0 -0
  28. {ms_components-0.5.8 → ms_components-0.6.0}/MANIFEST.in +0 -0
  29. {ms_components-0.5.8 → ms_components-0.6.0}/README.md +0 -0
  30. {ms_components-0.5.8 → ms_components-0.6.0}/examples/tutorial_demo.py +0 -0
  31. {ms_components-0.5.8 → ms_components-0.6.0}/examples/tutorial_demo.toml +0 -0
  32. {ms_components-0.5.8 → ms_components-0.6.0}/licenses/lucide-LICENSE.txt +0 -0
  33. {ms_components-0.5.8 → ms_components-0.6.0}/licenses/qt-themes-LICENSE.txt +0 -0
  34. {ms_components-0.5.8 → ms_components-0.6.0}/pyproject.toml +0 -0
  35. {ms_components-0.5.8 → ms_components-0.6.0}/setup.cfg +0 -0
  36. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/__init__.py +0 -0
  37. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/backdrop.py +0 -0
  38. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ketcher.py +0 -0
  39. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/labels.py +0 -0
  40. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/listview.py +0 -0
  41. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_dockwidget/__init__.py +0 -0
  42. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_dockwidget/resources/__init__.py +0 -0
  43. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_dockwidget/resources/icons/__init__.py +0 -0
  44. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_dockwidget/resources/icons/folder.svg +0 -0
  45. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_executors.py +0 -0
  46. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/__init__.py +0 -0
  47. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/bridge.py +0 -0
  48. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/config.py +0 -0
  49. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/formatting.py +0 -0
  50. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/icons/cpu.svg +0 -0
  51. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/icons/gpu.svg +0 -0
  52. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/icons/memory.svg +0 -0
  53. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/palette.py +0 -0
  54. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/polling.py +0 -0
  55. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/resources.py +0 -0
  56. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_monitor/widget.py +0 -0
  57. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_projects/__init__.py +0 -0
  58. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_projects/app.py +0 -0
  59. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_projects/backend.py +0 -0
  60. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_projects/scratch.py +0 -0
  61. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/__init__.py +0 -0
  62. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/command_line.py +0 -0
  63. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/actions.svg +0 -0
  64. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/box.svg +0 -0
  65. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/center.svg +0 -0
  66. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/display.svg +0 -0
  67. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/export.svg +0 -0
  68. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/hide.svg +0 -0
  69. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/hydrogens-polar.svg +0 -0
  70. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/hydrogens.svg +0 -0
  71. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/menu.svg +0 -0
  72. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/orient.svg +0 -0
  73. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/presets.svg +0 -0
  74. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/rock.svg +0 -0
  75. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/save.svg +0 -0
  76. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/selection.svg +0 -0
  77. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/settings.svg +0 -0
  78. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/style.svg +0 -0
  79. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/icons/zoom.svg +0 -0
  80. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/plugins.py +0 -0
  81. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_pymol/scene.py +0 -0
  82. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_settings/__init__.py +0 -0
  83. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_settings/panel.py +0 -0
  84. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_stepper.py +0 -0
  85. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/__init__.py +0 -0
  86. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/cell_delegate.py +0 -0
  87. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/column_panel.py +0 -0
  88. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/example_usage.py +0 -0
  89. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/filter_panel.py +0 -0
  90. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/columns.svg +0 -0
  91. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/export.svg +0 -0
  92. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/filter.svg +0 -0
  93. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/menu.svg +0 -0
  94. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/reload.svg +0 -0
  95. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/search.svg +0 -0
  96. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/settings.svg +0 -0
  97. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/sort-asc.svg +0 -0
  98. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/sort-desc.svg +0 -0
  99. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/icons/sort.svg +0 -0
  100. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/metric_filter_bar.py +0 -0
  101. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/query_builder.py +0 -0
  102. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/session_provider.py +0 -0
  103. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/sort_panel.py +0 -0
  104. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/table_interaction.py +0 -0
  105. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/test_external_filters.py +0 -0
  106. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_table/test_toolbar.py +0 -0
  107. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_tutorial/__init__.py +0 -0
  108. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_tutorial/bindings.py +0 -0
  109. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_tutorial/controller.py +0 -0
  110. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_tutorial/models.py +0 -0
  111. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/ms_tutorial/overlay.py +0 -0
  112. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/opengl.py +0 -0
  113. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/pagination.py +0 -0
  114. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/palettes.py +0 -0
  115. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/step_dialog.py +0 -0
  116. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/theme.py +0 -0
  117. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/tool_panel.py +0 -0
  118. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components/wheel.py +0 -0
  119. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components.egg-info/SOURCES.txt +0 -0
  120. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components.egg-info/dependency_links.txt +0 -0
  121. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components.egg-info/requires.txt +0 -0
  122. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components.egg-info/scm_file_list.json +0 -0
  123. {ms_components-0.5.8 → ms_components-0.6.0}/src/ms_components.egg-info/top_level.txt +0 -0
  124. {ms_components-0.5.8 → ms_components-0.6.0}/tests/conftest.py +0 -0
  125. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_app_settings.py +0 -0
  126. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_executors_ui.py +0 -0
  127. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_ketcher.py +0 -0
  128. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_molsuite_monitor_bridge.py +0 -0
  129. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_monitor_config.py +0 -0
  130. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_opengl.py +0 -0
  131. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_optional_integrations.py +0 -0
  132. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_progress_column.py +0 -0
  133. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_project_browser.py +0 -0
  134. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_pymol_command_line.py +0 -0
  135. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_pymol_grid.py +0 -0
  136. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_pymol_scene.py +0 -0
  137. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_pymol_toolbar.py +0 -0
  138. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_query_builder_keyset.py +0 -0
  139. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_shift_hscroll.py +0 -0
  140. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_split_button_style.py +0 -0
  141. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_step_dialog.py +0 -0
  142. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_table_autofill_lifecycle.py +0 -0
  143. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_table_interaction.py +0 -0
  144. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_table_toolbar.py +0 -0
  145. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_table_view_state.py +0 -0
  146. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_theme_contrast.py +0 -0
  147. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_theme_menu.py +0 -0
  148. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_tool_panel.py +0 -0
  149. {ms_components-0.5.8 → ms_components-0.6.0}/tests/test_tutorial.py +0 -0
  150. {ms_components-0.5.8 → ms_components-0.6.0}/zensical.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ms_components
3
- Version: 0.5.8
3
+ Version: 0.6.0
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
@@ -295,9 +295,9 @@ QLabel#PymolSceneContext {
295
295
  color: palette(placeholder-text);
296
296
  }
297
297
 
298
- /* Botón de extensión de las toolbars embebidas. Los componentes le asignan un
299
- SVG hamburguesa y abren su menú al entrar con el cursor. La regla va al final
300
- para vencer la especificidad de las reglas particulares de cada toolbar. */
298
+ /* Overflow (extension) button of the embedded toolbars. Components give it a
299
+ hamburger SVG and open its menu when the cursor enters. The rule comes last
300
+ to win over the specificity of each toolbar's own rules. */
301
301
  QToolButton#qt_toolbar_ext_button,
302
302
  #SmartTableToolbar QToolButton#qt_toolbar_ext_button,
303
303
  #PymolControlBar QToolButton#qt_toolbar_ext_button {
@@ -122,13 +122,20 @@ class ChipsSelect(QWidget):
122
122
  if editable:
123
123
  self._combo.setEditable(True)
124
124
  self._combo.setInsertPolicy(QComboBox.InsertPolicy.NoInsert)
125
- self._combo.lineEdit().setPlaceholderText("+ type")
125
+ self._combo.lineEdit().setPlaceholderText("+ Add")
126
+ self._combo.lineEdit().setAlignment(Qt.AlignmentFlag.AlignCenter)
126
127
  self._combo.lineEdit().returnPressed.connect(self._on_typed)
127
128
  self._combo.currentIndexChanged.connect(self._on_add)
128
129
  layout.addWidget(self._combo, 0, Qt.AlignmentFlag.AlignTop)
129
130
  self._options: list[str] = []
130
131
  self._selected: list[str] = []
131
132
  self._last_height = 0
133
+ # Enter in the typed field means "add this chip". QLineEdit emits returnPressed and then
134
+ # *ignores* the key, which hands it up the parent chain to a dialog that clicks its
135
+ # default button - an import submitted mid-edit. The key passes through the combo on its
136
+ # way up, so the combo is where it stops.
137
+ if editable:
138
+ self._combo.installEventFilter(self)
132
139
 
133
140
  def sizeHint(self) -> QSize:
134
141
  # The table sizes rows from the cell widget's sizeHint, so report the wrapped height.
@@ -228,6 +235,9 @@ class ChipsSelect(QWidget):
228
235
  # --- Drag a chip onto another to reorder ------------------------------------------
229
236
  def eventFilter(self, chip, event) -> bool:
230
237
  kind = event.type()
238
+ if chip is self._combo:
239
+ # Only ever installed on an editable combo: see __init__.
240
+ return kind == QEvent.Type.KeyPress and event.key() in (Qt.Key.Key_Return, Qt.Key.Key_Enter)
231
241
  if kind == QEvent.Type.MouseButtonPress and event.button() == Qt.MouseButton.LeftButton:
232
242
  self._press = event.position().toPoint()
233
243
  elif kind == QEvent.Type.MouseMove and self._press is not None:
@@ -3,7 +3,7 @@ from dataclasses import dataclass
3
3
  from enum import Enum, auto
4
4
  from typing import Dict, List, Optional
5
5
 
6
- from PySide6.QtCore import Qt, QSize, QMimeData, QPoint, QByteArray, QObject, QEvent, QTimer, QtMsgType, \
6
+ from PySide6.QtCore import Qt, QSize, QMimeData, QPoint, QRect, QByteArray, QObject, QEvent, QTimer, QtMsgType, \
7
7
  qInstallMessageHandler
8
8
  from PySide6.QtGui import QAction, QDrag, QIcon
9
9
  from PySide6.QtWidgets import (QDockWidget, QFrame, QMainWindow, QMenu, QSizePolicy, QToolBar, QToolButton, QVBoxLayout,
@@ -795,6 +795,7 @@ class DockManager:
795
795
  # the region it came from. This lets users keep (for example) PyMOL on a
796
796
  # second monitor while opening another tool in the original side panel.
797
797
  self._windowed: set[str] = set()
798
+ self._window_geometry: dict[str, QRect] = {} # where each window was when docked back
798
799
 
799
800
  # ── FIX P2: single flag that blocks ALL reactive handlers ──
800
801
  # While True, _on_dock_visibility_changed and
@@ -991,9 +992,25 @@ class DockManager:
991
992
  self._windowed.add(dock_id)
992
993
  self._remove_region_visible(entry.region, dock_id)
993
994
  self._make_native_window(dock_id)
995
+ dock.setGeometry(self._window_geometry.get(dock_id) or self._default_window_geometry(dock))
994
996
  QTimer.singleShot(0, dock.activateWindow)
995
997
  self.sync_buttons()
996
998
 
999
+ WINDOW_SCREEN_FRACTION = (0.6, 0.7) # width, height of the available screen
1000
+
1001
+ def _default_window_geometry(self, dock: QWidget) -> QRect:
1002
+ """A first-time window: a good share of the main window's screen, centred on it, and
1003
+ never narrower than its contents ask for (a toolbar with every action showing). The
1004
+ docked size is a strip of the main window, too small to work in on its own."""
1005
+ screen = (self.mw.screen() or QApplication.primaryScreen()).availableGeometry()
1006
+ fw, fh = self.WINDOW_SCREEN_FRACTION
1007
+ wanted = max(dock.width(), int(screen.width() * fw), dock.sizeHint().width())
1008
+ width = min(screen.width(), wanted)
1009
+ height = min(screen.height(), max(dock.height(), int(screen.height() * fh)))
1010
+ rect = QRect(0, 0, width, height)
1011
+ rect.moveCenter(screen.center())
1012
+ return rect
1013
+
997
1014
  def _make_native_window(self, dock_id: str) -> None:
998
1015
  """Detach directly, clearing any prior QDockWidget utility-window mode."""
999
1016
  dock = self.docks.get(dock_id)
@@ -1038,6 +1055,8 @@ class DockManager:
1038
1055
  if dock is None:
1039
1056
  return
1040
1057
  entry = self.entries[dock_id]
1058
+ if dock_id in self._windowed and dock.isWindow():
1059
+ self._window_geometry[dock_id] = dock.geometry() # reopens where the user left it
1041
1060
  self._updating = True
1042
1061
  try:
1043
1062
  self._windowed.discard(dock_id)
@@ -406,6 +406,7 @@ class JobDetail(QWidget):
406
406
  side_box.addWidget(self._tabs)
407
407
 
408
408
  self._tasks = QTreeWidget(side)
409
+ self._task_rows: list[tuple] = [] # what each row shows now, so a snapshot touches only what changed
409
410
  self._tasks.setHeaderLabels(["Input", "Host", "Attempt", "Elapsed", "Progress"])
410
411
  self._tasks.setRootIsDecorated(False)
411
412
  self._tasks.setUniformRowHeights(True)
@@ -466,6 +467,7 @@ class JobDetail(QWidget):
466
467
  self._bar.parts, self._trend.values = (0, 0, 0, 0), []
467
468
  self._show_grid(None)
468
469
  self._tasks.clear()
470
+ self._task_rows = []
469
471
  self._tabs.setTabText(self._tabs.indexOf(self._tasks), "Running")
470
472
  self._tab_meta.setText("")
471
473
  self.set_failures([], 0)
@@ -615,22 +617,35 @@ class JobDetail(QWidget):
615
617
  seconds=max(0.0, datetime.now().timestamp() - since))]
616
618
  median = statistics.median(task.seconds for task in tasks) if len(tasks) >= 3 else None
617
619
  warn = QColor(P["warn"])
618
- while self._tasks.topLevelItemCount() > len(tasks):
619
- self._tasks.takeTopLevelItem(self._tasks.topLevelItemCount() - 1)
620
- while self._tasks.topLevelItemCount() < len(tasks):
621
- self._tasks.addTopLevelItem(QTreeWidgetItem())
622
- slow = 0
623
- for at, task in enumerate(tasks):
624
- item = self._tasks.topLevelItem(at)
620
+ plain = self._tasks.palette().color(QPalette.ColorRole.Text)
621
+ rows, slow = [], 0
622
+ for task in tasks:
625
623
  what = task.input + (f" +{task.chunks - 1}" if task.chunks > 1 else "")
626
- for column, text in enumerate((what, task.host or "", str(task.attempt), format_duration(task.seconds),
627
- "—" if task.progress is None else f"{task.progress:.0f}%")):
628
- item.setText(column, text)
629
624
  late = median is not None and median > 0 and task.seconds > SLOW * median
630
625
  slow += late
631
- for column in range(5):
632
- item.setForeground(column, warn if late else self._tasks.palette().color(QPalette.ColorRole.Text))
633
- item.setToolTip(0, f"slow: {task.seconds / median:.1f}× the median" if late else task.input)
626
+ rows.append(((what, task.host or "", str(task.attempt), format_duration(task.seconds),
627
+ "—" if task.progress is None else f"{task.progress:.0f}%"),
628
+ warn if late else plain,
629
+ f"slow: {task.seconds / median:.1f}× the median" if late else task.input))
630
+ # Every Qt call from Python waits for the GIL, which the engine's threads keep busy on a
631
+ # big machine: rewrite only the cells that changed (mostly just the elapsed time).
632
+ while self._tasks.topLevelItemCount() > len(rows):
633
+ self._tasks.takeTopLevelItem(self._tasks.topLevelItemCount() - 1)
634
+ while self._tasks.topLevelItemCount() < len(rows):
635
+ self._tasks.addTopLevelItem(QTreeWidgetItem())
636
+ before = self._task_rows
637
+ for at, (texts, color, tip) in enumerate(rows):
638
+ item = self._tasks.topLevelItem(at)
639
+ old_texts, old_color, old_tip = before[at] if at < len(before) else ((None,) * 5, None, None)
640
+ for column, (text, old_text) in enumerate(zip(texts, old_texts)):
641
+ if text != old_text:
642
+ item.setText(column, text)
643
+ if color != old_color:
644
+ for column in range(5):
645
+ item.setForeground(column, color)
646
+ if tip != old_tip:
647
+ item.setToolTip(0, tip)
648
+ self._task_rows = rows
634
649
  self._tabs.setTabText(self._tabs.indexOf(self._tasks), f"Running {len(tasks)}" if tasks else "Running")
635
650
  said = [f"{len(tasks)} running"] if tasks else []
636
651
  if median is not None:
@@ -30,6 +30,9 @@ def status_color(status: str, default: str | None = None) -> str:
30
30
 
31
31
  def counts_label(job: JobMonitorState) -> str:
32
32
  """`done/total · time left`, or `· took` once it ended."""
33
+ if job.nothing_to_do:
34
+ took = (job.finished_at - job.started_at).total_seconds() if job.finished_at and job.started_at else None
35
+ return "0 chunks" + ("" if took is None else f" · took {format_duration(took)}")
33
36
  total = f"{job.chunks_total:,}" if job.chunks_total else "?"
34
37
  left = job.seconds_left
35
38
  if job.is_terminal:
@@ -50,6 +53,8 @@ def badge_of(job) -> tuple[str, str]:
50
53
  return "WAITING FOR HOST", P["warn"]
51
54
  if job.canceling and not job.is_terminal:
52
55
  return "CANCELING", P["warn"]
56
+ if job.nothing_to_do: # not a success with no work: there was nothing to run
57
+ return "NOTHING TO DO", P["text_muted"]
53
58
  return job.status.replace("_", " ").upper(), status_color(job.status)
54
59
 
55
60
 
@@ -85,6 +85,11 @@ class JobMonitorState:
85
85
  def is_terminal(self) -> bool:
86
86
  return self.status in TERMINAL_JOB_STATUSES
87
87
 
88
+ @property
89
+ def nothing_to_do(self) -> bool:
90
+ """It completed without a chunk to run (its source had no work: everything was skipped)."""
91
+ return self.status == "completed" and not (self.chunks_total or self.chunks_settled)
92
+
88
93
 
89
94
  @dataclass(slots=True)
90
95
  class JobDetailState:
@@ -10,7 +10,7 @@ from PySide6.QtCore import (
10
10
  )
11
11
  from PySide6.QtGui import (
12
12
  QAction, QFont, QPainter, QColor, QPen, QBrush, QPainterPath, QMouseEvent,
13
- QKeySequence, QPalette, QShortcut,
13
+ QFontMetrics, QKeySequence, QPalette, QShortcut,
14
14
  )
15
15
  from PySide6.QtWidgets import (
16
16
  QAbstractItemView, QApplication, QComboBox, QDialog, QDialogButtonBox,
@@ -354,7 +354,10 @@ class ProjectItem:
354
354
 
355
355
  # ── ProjectTableModel ─────────────────────────────────────────────────────────
356
356
 
357
- _COL_NAME = 0 # avatar + name + id
357
+ # ISO: unambiguous ("10/11/2026" is October or November), and it sorts by date as text.
358
+ PROJECT_DATE_FORMAT = "%Y-%m-%d %H:%M"
359
+
360
+ _COL_NAME = 0 # avatar + name + tags
358
361
  _COL_META = 1 # description
359
362
  _COL_PATH = 2 # path (stretch)
360
363
  _COL_DATE = 3 # last_modified
@@ -366,7 +369,7 @@ _COL_COUNT = 6
366
369
  class ProjectTableModel(QAbstractTableModel):
367
370
  """All projects in memory. Scope/filter/search/sort are pure Python."""
368
371
 
369
- HEADERS = ["", "Description", "Modified", "Path", "", ""]
372
+ HEADERS = ["Name", "Description", "Path", "Modified", "", ""]
370
373
 
371
374
  def __init__(self, parent=None):
372
375
  super().__init__(parent)
@@ -561,6 +564,8 @@ class ProjectRowDelegate(QStyledItemDelegate):
561
564
  painter.setPen(QPen(palette.color(role)))
562
565
  painter.setFont(self._font(option.font, 9 if col == _COL_META else 8))
563
566
  text = index.data(Qt.DisplayRole) or ""
567
+ if col == _COL_PATH: # the full path is in the tooltip
568
+ text = painter.fontMetrics().elidedText(text, Qt.ElideMiddle, max(0, rect.width() - 12))
564
569
  flags = Qt.AlignLeft | Qt.AlignVCenter
565
570
  if col == _COL_META:
566
571
  flags = Qt.AlignLeft | Qt.TextWordWrap
@@ -600,17 +605,20 @@ class ProjectRowDelegate(QStyledItemDelegate):
600
605
  tx = av_x + self._AVATAR + 10
601
606
  painter.setFont(self._font(base_font, 11, QFont.Bold))
602
607
  painter.setPen(palette.color(QPalette.ColorRole.Text))
603
- painter.drawText(QRect(tx, rect.top()+8, rect.width()-tx-8, 20),
608
+ # The tags under the name, or the name alone, centred. The raw UUID that sat here told a
609
+ # user nothing; it stays in the name's tooltip.
610
+ tags = ", ".join(project.tags)
611
+ name_top = rect.top() + 8 if tags else rect.center().y() - 10
612
+ painter.drawText(QRect(tx, name_top, rect.width()-tx-8, 20),
604
613
  Qt.AlignLeft | Qt.AlignVCenter, project.name or "")
605
-
606
- # Project id
607
- painter.setFont(self._font(base_font, 8))
608
- painter.setPen(palette.color(QPalette.ColorRole.PlaceholderText))
609
- painter.drawText(
610
- QRect(tx, rect.top() + 30, rect.width() - tx - 8, 16),
611
- Qt.AlignLeft | Qt.AlignVCenter,
612
- f"ID: {project.id}",
613
- )
614
+ if tags:
615
+ painter.setFont(self._font(base_font, 8))
616
+ painter.setPen(palette.color(QPalette.ColorRole.PlaceholderText))
617
+ painter.drawText(
618
+ QRect(tx, rect.top() + 30, rect.width() - tx - 8, 16),
619
+ Qt.AlignLeft | Qt.AlignVCenter,
620
+ tags,
621
+ )
614
622
 
615
623
  @staticmethod
616
624
  def _font(base_font: QFont, point_size: int, weight: QFont.Weight | None = None) -> QFont:
@@ -798,7 +806,9 @@ class ProjectTreeWidget(QWidget):
798
806
  hdr.setSectionResizeMode(_COL_MENU, QHeaderView.Fixed)
799
807
  hdr.setStretchLastSection(False)
800
808
  hdr.resizeSection(_COL_NAME, 300)
801
- hdr.resizeSection(_COL_DATE, 100)
809
+ # As wide as a date in the row font (8 pt, see the delegate) plus its 6 px side padding.
810
+ date_font = ProjectRowDelegate._font(self.view.font(), 8)
811
+ hdr.resizeSection(_COL_DATE, QFontMetrics(date_font).horizontalAdvance("2026-12-31 23:59") + 16)
802
812
  hdr.resizeSection(_COL_STAR, 30)
803
813
  hdr.resizeSection(_COL_MENU, 30)
804
814
  hdr.setSortIndicatorShown(True)
@@ -1023,7 +1033,13 @@ class ProjectFormDialog(QDialog):
1023
1033
  self.name_input = QLineEdit(self.initial_data.get("name", ""))
1024
1034
  self.name_input.editingFinished.connect(lambda: self.name_committed.emit(self.name_input.text().strip()))
1025
1035
  self.path_input = QLineEdit(str(self.initial_data.get("path", "")))
1026
- self.path_input.setReadOnly(True)
1036
+ # A new project's folder can be typed or browsed; an existing one's cannot move, and the
1037
+ # field looks it (greyed like App) instead of a read-only box that ignores typing.
1038
+ self.path_input.setEnabled(not is_edit)
1039
+ self.path_input.setToolTip(
1040
+ "The project is stored in this folder." if is_edit else
1041
+ "Folder for the project: type or paste a path, or Browse. A folder named after the "
1042
+ "project is created inside it unless the path already ends with that name.")
1027
1043
  self.description_input = QTextEdit(self.initial_data.get("description", ""))
1028
1044
  self.description_input.setMinimumHeight(120)
1029
1045
  self.tags_input = QLineEdit(
@@ -1074,6 +1090,10 @@ class ProjectFormDialog(QDialog):
1074
1090
  if not self.path_input.text().strip():
1075
1091
  QMessageBox.warning(self, "Invalid data", "The path cannot be empty.")
1076
1092
  return
1093
+ if not Path(self.path_input.text().strip()).expanduser().is_absolute():
1094
+ QMessageBox.warning(self, "Invalid data",
1095
+ "The path must be a full folder path, e.g. ~/molsuite_projects.")
1096
+ return
1077
1097
  if self.app_combo.currentData() is None:
1078
1098
  QMessageBox.warning(self, "Invalid data", "You must select an app.")
1079
1099
  return
@@ -1156,7 +1176,7 @@ class ProjectBrowserPanel(QWidget):
1156
1176
  name = p.name,
1157
1177
  description = p.description or "",
1158
1178
  path = str(p.path),
1159
- last_modified= p.updated_at.strftime("%d/%m/%Y %H:%M"),
1179
+ last_modified= p.updated_at.strftime(PROJECT_DATE_FORMAT),
1160
1180
  app_id = (getattr(p, "app_id", "") or "").strip(),
1161
1181
  favorite = bool(p.favorite),
1162
1182
  language = self._manifest_name(p.app_id),
@@ -18,7 +18,7 @@ from PySide6.QtWidgets import (
18
18
  )
19
19
 
20
20
  from ms_components.ms_projects.backend import create_catalog_backend
21
- from ms_components.ms_projects.browser import ProjectFormDialog, ProjectItem, ProjectTreeWidget
21
+ from ms_components.ms_projects.browser import PROJECT_DATE_FORMAT, ProjectFormDialog, ProjectItem, ProjectTreeWidget
22
22
 
23
23
  if TYPE_CHECKING:
24
24
  from ms_flow.core.project.catalog import ProjectCatalogBackend
@@ -144,7 +144,7 @@ class ProjectsMenuWidget(QFrame):
144
144
  name=project.name,
145
145
  description=project.description or "",
146
146
  path=str(project.path),
147
- last_modified=project.updated_at.strftime("%d/%m/%Y %H:%M"),
147
+ last_modified=project.updated_at.strftime(PROJECT_DATE_FORMAT),
148
148
  app_id=(getattr(project, "app_id", "") or "").strip(),
149
149
  favorite=bool(project.favorite),
150
150
  language=self._manifest_name(project.app_id),
@@ -979,6 +979,7 @@ class PymolControlBar(QFrame):
979
979
 
980
980
  class PymolDockWidget(MSDockWidget):
981
981
  side_panel_visibility_changed = Signal(bool)
982
+ _VIEWER_MIN_WIDTH = 240
982
983
 
983
984
  def __init__(self, title: str, manager, parent=None):
984
985
  super().__init__(title, manager, parent)
@@ -1000,13 +1001,12 @@ class PymolDockWidget(MSDockWidget):
1000
1001
  self._side_panel_widget: QWidget | None = None
1001
1002
  self._splitter = QSplitter(Qt.Horizontal, self)
1002
1003
  self._splitter.setChildrenCollapsible(False)
1003
- # The side container has a 220px minimum and the viewer had none, so in a narrow dock
1004
- # the panel took everything and the 3D view vanished. Floor the viewer instead.
1005
- self.pymol_widget.setMinimumWidth(240)
1004
+ # Floor the viewer, or a narrow dock gives everything to the side panel and the 3D view
1005
+ # vanishes; while the panel is open the floor rises to the panel's own width.
1006
+ self.pymol_widget.setMinimumWidth(self._VIEWER_MIN_WIDTH)
1006
1007
  self._splitter.addWidget(self.pymol_widget)
1007
1008
 
1008
1009
  self._side_container = QWidget(self)
1009
- self._side_container.setMinimumWidth(220)
1010
1010
  self._side_container.setMaximumWidth(360)
1011
1011
  self._side_container.hide()
1012
1012
  self._side_layout = QVBoxLayout(self._side_container)
@@ -1094,6 +1094,8 @@ class PymolDockWidget(MSDockWidget):
1094
1094
  self._side_container.setVisible(visible)
1095
1095
  if self._side_panel_widget is not None:
1096
1096
  self._side_panel_widget.setVisible(visible)
1097
+ panel_width = self._side_container.minimumSizeHint().width() if visible else 0
1098
+ self.pymol_widget.setMinimumWidth(max(self._VIEWER_MIN_WIDTH, panel_width))
1097
1099
  if visible:
1098
1100
  self._splitter.setSizes([max(480, self.width() - 280), 280])
1099
1101
  else:
@@ -1102,7 +1104,7 @@ class PymolDockWidget(MSDockWidget):
1102
1104
  self.side_panel_visibility_changed.emit(visible)
1103
1105
 
1104
1106
  def is_side_panel_visible(self) -> bool:
1105
- return bool(self._side_container.isVisible())
1107
+ return not self._side_container.isHidden() # own state; isVisible() is False while the dock is hidden
1106
1108
 
1107
1109
  def eventFilter(self, watched, event):
1108
1110
  if watched is self.pymol_widget and event.type() == QEvent.Type.MouseButtonRelease:
@@ -36,7 +36,7 @@ _ICON_FILES: dict[str, str] = {
36
36
 
37
37
  @lru_cache(maxsize=128)
38
38
  def _svg_pixmap(name: str, color_hex: str, size: int, dpr: float) -> QPixmap:
39
- """SVG → QPixmap, recoloreado (currentColor → color_hex), cacheado."""
39
+ """SVG → QPixmap, recolored (currentColor → color_hex), cached."""
40
40
  svg = (_ICONS / _ICON_FILES[name]).read_bytes().replace(b"currentColor", color_hex.encode())
41
41
  renderer = QSvgRenderer(QByteArray(svg))
42
42
  actual = max(1, int(size * dpr))
@@ -348,7 +348,7 @@ class FilterPopup(QFrame):
348
348
  layout = QVBoxLayout(self)
349
349
  layout.setContentsMargins(10, 10, 10, 10)
350
350
  layout.setSpacing(8)
351
- layout.addWidget(QLabel(f"Filtrar {col_def.label}"))
351
+ layout.addWidget(QLabel(f"Filter {col_def.label}"))
352
352
 
353
353
  self._checkboxes: list[QCheckBox] = []
354
354
  self._op_combo: QComboBox | None = None
@@ -101,7 +101,7 @@ class PaginationControl(QWidget):
101
101
  layout.addItem(QSpacerItem(16, 0, QSizePolicy.Fixed, QSizePolicy.Minimum))
102
102
 
103
103
  # Items/page
104
- layout.addWidget(QLabel("Filas:"))
104
+ layout.addWidget(QLabel("Rows:"))
105
105
 
106
106
  self.items_per_page_combo = QComboBox()
107
107
  self.items_per_page_combo.setObjectName("PageSizeCombo")
@@ -355,7 +355,7 @@ class SmartTableView(QWidget):
355
355
  self._header = ActionHeader(self._config, self._table)
356
356
  self._table.setHorizontalHeader(self._header)
357
357
  self._header.setSectionResizeMode(QHeaderView.Interactive)
358
- self._header.setStretchLastSection(True)
358
+ self._header.setStretchLastSection(self._config.stretch_last_column)
359
359
  if self._config.allow_column_reorder:
360
360
  self._header.setSectionsMovable(True)
361
361
 
@@ -1161,7 +1161,7 @@ class SmartTableView(QWidget):
1161
1161
  if self._config.context_menu_actions:
1162
1162
  menu.addSeparator()
1163
1163
 
1164
- copy_action = menu.addAction("Copiar celda")
1164
+ copy_action = menu.addAction("Copy cell")
1165
1165
  copy_action.triggered.connect(lambda: self._copy_cell(index))
1166
1166
 
1167
1167
  copy_row_action = menu.addAction("Copy row")
@@ -105,6 +105,7 @@ class ColumnDef:
105
105
  formatter: Function (raw_value) → str used for display.
106
106
  delegate: Name of a custom Qt delegate (for editors).
107
107
  tooltip: Static tooltip, or callable(row_data) → str.
108
+ header_tooltip: Tooltip on the column header (what the column means).
108
109
  db_column: Override for the real DB column name (when it differs from field).
109
110
  expr: SQLAlchemy expression producing the column value, for anything
110
111
  that is not a model attribute (JSON_EXTRACT, CASE, func.*).
@@ -133,6 +134,7 @@ class ColumnDef:
133
134
  formatter: Optional[Callable] = None
134
135
  delegate: Optional[str] = None
135
136
  tooltip: Any = None # str | Callable
137
+ header_tooltip: Optional[str] = None
136
138
  db_column: Optional[str] = None
137
139
  expr: Any = None # SQLAlchemy ColumnElement
138
140
  progress_max: Optional[str] = None
@@ -315,6 +317,8 @@ class TableConfig:
315
317
  show_vertical_header: Show Qt's native vertical header.
316
318
  show_checkboxes: Show the selection checkbox column.
317
319
  alternating_rows: Alternate row colours.
320
+ stretch_last_column: The last column fills the table's spare width. Off, columns keep
321
+ their widths and the spare width stays empty.
318
322
  allow_column_reorder: The user may reorder columns by dragging.
319
323
  allow_column_resize: The user may resize columns.
320
324
  allow_row_resize: The user may resize row heights.
@@ -346,6 +350,7 @@ class TableConfig:
346
350
  show_vertical_header: bool = False
347
351
  show_checkboxes: bool = False
348
352
  alternating_rows: bool = True
353
+ stretch_last_column: bool = True
349
354
  allow_column_reorder: bool = True
350
355
  allow_column_resize: bool = True
351
356
  allow_row_resize: bool = False
@@ -193,6 +193,11 @@ class SmartTableModel(QAbstractTableModel):
193
193
  section -= 1
194
194
  if 0 <= section < len(self._visible_cols):
195
195
  return self._visible_cols[section].label
196
+ if role == Qt.ToolTipRole:
197
+ if self._config.show_row_numbers:
198
+ section -= 1
199
+ if 0 <= section < len(self._visible_cols):
200
+ return self._visible_cols[section].header_tooltip
196
201
  if role == Qt.TextAlignmentRole:
197
202
  return Qt.AlignCenter
198
203
  if role == Qt.FontRole:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ms_components
3
- Version: 0.5.8
3
+ Version: 0.6.0
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
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.6.0",
3
+ "distance": 0,
4
+ "node": "gcce127cbfb35cdedcf2421b3cdc916d3c609d85a",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-11-14"
8
+ }
@@ -0,0 +1,81 @@
1
+ """ChipsSelect: typed values become chips only when editable; chips reorder."""
2
+ from PySide6.QtWidgets import QApplication
3
+
4
+ from ms_components.chips import ChipsSelect
5
+
6
+
7
+ def test_typing_adds_a_chip_only_when_editable_and_chips_reorder():
8
+ QApplication.instance() or QApplication(["chips-test"])
9
+ chips = ChipsSelect(editable=True, reorderable=True, normalize=lambda text: text.strip().upper())
10
+ chips.set_items(["ZN", "FE"], selected=["ZN", "FE"])
11
+ chips._combo.lineEdit().setText(" mn ")
12
+ chips._combo.lineEdit().returnPressed.emit()
13
+ assert chips.selected_items() == ["ZN", "FE", "MN"]
14
+ chips.move_item("MN", 0)
15
+ assert chips.selected_items() == ["MN", "ZN", "FE"]
16
+ assert not ChipsSelect()._combo.isEditable() # a closed set (chains, ligands): nothing typed in
17
+
18
+
19
+ def _dialog_with_default_button(chips):
20
+ """A dialog the way hosts build one: an Import button that Return activates by default."""
21
+ from PySide6.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout
22
+
23
+ dialog = QDialog()
24
+ layout = QVBoxLayout(dialog)
25
+ layout.addWidget(chips)
26
+ buttons = QDialogButtonBox(dialog)
27
+ buttons.addButton("Import", QDialogButtonBox.ButtonRole.AcceptRole)
28
+ buttons.accepted.connect(dialog.accept)
29
+ layout.addWidget(buttons)
30
+ return dialog
31
+
32
+
33
+ def test_enter_in_the_typed_field_adds_a_chip_and_does_not_submit_the_dialog():
34
+ """Enter means "add this chip" in the field, never "accept the dialog around it".
35
+
36
+ QLineEdit ignores Return after emitting returnPressed, so the key used to travel on to the
37
+ dialog and click its default button: typing a metal code and pressing Enter submitted the
38
+ whole receptor import before the user had finished choosing options.
39
+ """
40
+ from PySide6.QtCore import Qt
41
+ from PySide6.QtTest import QTest
42
+ from PySide6.QtWidgets import QDialog
43
+
44
+ app = QApplication.instance() or QApplication(["chips-test"])
45
+ chips = ChipsSelect(editable=True, normalize=lambda text: text.strip().upper())
46
+ chips.set_items(["ZN"], selected=["ZN"])
47
+ dialog = _dialog_with_default_button(chips)
48
+ accepted = []
49
+ dialog.accepted.connect(lambda: accepted.append(True))
50
+ dialog.show()
51
+ field = chips._combo.lineEdit()
52
+ field.setFocus()
53
+ app.processEvents()
54
+
55
+ QTest.keyClicks(field, "cd")
56
+ QTest.keyClick(field, Qt.Key.Key_Return)
57
+ assert chips.selected_items() == ["ZN", "CD"]
58
+ QTest.keyClicks(field, "mn")
59
+ QTest.keyClick(field, Qt.Key.Key_Enter) # the keypad Enter, too
60
+ assert chips.selected_items() == ["ZN", "CD", "MN"]
61
+ assert not accepted and dialog.isVisible() and dialog.result() != QDialog.DialogCode.Accepted
62
+ dialog.close()
63
+
64
+
65
+ def test_enter_in_a_closed_set_still_reaches_the_dialog():
66
+ """Only the typed field claims Enter: a closed set (chains) has nothing to type, so Enter
67
+ keeps its usual meaning there."""
68
+ from PySide6.QtCore import Qt
69
+ from PySide6.QtTest import QTest
70
+
71
+ app = QApplication.instance() or QApplication(["chips-test"])
72
+ chips = ChipsSelect()
73
+ chips.set_items(["A", "B"], selected=["A"])
74
+ dialog = _dialog_with_default_button(chips)
75
+ accepted = []
76
+ dialog.accepted.connect(lambda: accepted.append(True))
77
+ dialog.show()
78
+ chips._combo.setFocus()
79
+ app.processEvents()
80
+ QTest.keyClick(chips._combo, Qt.Key.Key_Return)
81
+ assert accepted
@@ -174,3 +174,33 @@ def test_action_separator_sits_by_order_and_survives_a_rebuild(app):
174
174
  assert widgets[0] is manager.action_buttons["a"]["button"]
175
175
  assert widgets[2] is manager.action_buttons["b"]["button"]
176
176
  window.close()
177
+
178
+
179
+ def test_window_opens_large_and_centred_then_reopens_where_left(app):
180
+ """A docked strip is too small to work in: the first window takes a good share of the
181
+ screen, centred; once moved/resized and docked back, it reopens where the user left it."""
182
+ window = QMainWindow()
183
+ manager = DockManager(window)
184
+ dock = _add_dock(manager, window, "diagram", visible=True)
185
+ manager.build()
186
+ window.resize(1200, 800)
187
+ window.show()
188
+ app.processEvents()
189
+
190
+ manager.open_in_window("diagram")
191
+ app.processEvents()
192
+ screen = window.screen().availableGeometry()
193
+ fw, fh = DockManager.WINDOW_SCREEN_FRACTION
194
+ assert dock.width() >= int(screen.width() * fw) - 1
195
+ assert dock.height() >= int(screen.height() * fh) - 1
196
+ assert abs(dock.geometry().center().x() - screen.center().x()) <= 3
197
+ assert abs(dock.geometry().center().y() - screen.center().y()) <= 3
198
+
199
+ dock.setGeometry(40, 50, 500, 400)
200
+ app.processEvents()
201
+ manager.dock_to_main_window("diagram")
202
+ app.processEvents()
203
+ manager.open_in_window("diagram")
204
+ app.processEvents()
205
+ assert dock.geometry().size() == QSize(500, 400)
206
+ assert (dock.geometry().x(), dock.geometry().y()) == (40, 50)
@@ -73,6 +73,27 @@ def test_the_throughput_card_leads_with_chunks_and_says_the_items_under_them():
73
73
  assert detail._speed.unit.text() == "chunks/s" and "tasks" in detail._speed.sub.text()
74
74
 
75
75
 
76
+ def test_a_job_that_completed_with_nothing_to_run_says_so_and_not_completed():
77
+ from datetime import timedelta
78
+
79
+ from ms_components.ms_monitor.jobs import badge_of, counts_label
80
+ QApplication.instance() or QApplication([])
81
+ start = datetime.now()
82
+ empty = _job(status="completed", chunks_total=0, chunks_done=0, chunks_failed=0, chunks_running=0,
83
+ started_at=start, finished_at=start, items_unit="ligands")
84
+ assert badge_of(empty)[0] == "NOTHING TO DO"
85
+ assert counts_label(empty) == "0 chunks · took 0s"
86
+ detail = JobDetail()
87
+ detail.set_job(empty)
88
+ assert detail._badge.text() == "NOTHING TO DO"
89
+ # A job with work keeps its status, and so does a job that ran nothing because it failed.
90
+ done = _job(status="completed", chunks_total=2, chunks_done=2, chunks_failed=0, chunks_running=0,
91
+ started_at=start, finished_at=start + timedelta(seconds=5))
92
+ assert badge_of(done)[0] == "COMPLETED" and counts_label(done) == "2/2 · took 5s"
93
+ assert badge_of(_job(status="failed", chunks_total=0, chunks_done=0, chunks_failed=0))[0] == "FAILED"
94
+ assert badge_of(_job(status="running", chunks_total=0, chunks_done=0, chunks_failed=0))[0] == "RUNNING"
95
+
96
+
76
97
  def test_the_detail_shows_the_numbers_the_tasks_and_the_failures_grouped():
77
98
  QApplication.instance() or QApplication([])
78
99
  detail = JobDetail()