ms-components 0.3.5__tar.gz → 0.4.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.
- ms_components-0.4.0/MANIFEST.in +3 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/PKG-INFO +39 -9
- ms_components-0.4.0/README.md +50 -0
- ms_components-0.4.0/licenses/qt-themes-LICENSE.txt +24 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/pyproject.toml +8 -6
- ms_components-0.4.0/src/ms_components/ketcher.py +156 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_projects/app.py +8 -2
- ms_components-0.4.0/src/ms_components/ms_projects/backend.py +15 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_projects/browser.py +12 -10
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_projects/widget.py +6 -3
- ms_components-0.4.0/src/ms_components/ms_pymol/__init__.py +49 -0
- ms_components-0.4.0/src/ms_components/ms_pymol/icons/style.svg +1 -0
- ms_components-0.4.0/src/ms_components/ms_pymol/scene.py +470 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/widget.py +8 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_settings/panel.py +3 -2
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components.egg-info/PKG-INFO +39 -9
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components.egg-info/SOURCES.txt +10 -6
- ms_components-0.4.0/src/ms_components.egg-info/requires.txt +23 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components.egg-info/scm_file_list.json +13 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components.egg-info/scm_version.json +2 -2
- ms_components-0.4.0/tests/conftest.py +1 -0
- ms_components-0.4.0/tests/test_ketcher.py +39 -0
- ms_components-0.4.0/tests/test_pymol_scene.py +153 -0
- ms_components-0.4.0/tests/test_tool_panel.py +177 -0
- ms_components-0.3.5/README.md +0 -29
- ms_components-0.3.5/docs/api_reference.md +0 -102
- ms_components-0.3.5/docs/examples.md +0 -139
- ms_components-0.3.5/docs/index.md +0 -60
- ms_components-0.3.5/docs/ms_tutorial.md +0 -180
- ms_components-0.3.5/docs/project_form_events.md +0 -17
- ms_components-0.3.5/docs/usage.md +0 -201
- ms_components-0.3.5/src/ms_components/ms_pymol/__init__.py +0 -17
- ms_components-0.3.5/src/ms_components.egg-info/requires.txt +0 -8
- {ms_components-0.3.5 → ms_components-0.4.0}/.github/workflows/docs.yml +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/.github/workflows/publish.yml +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/.gitignore +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/LICENSE +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/examples/tutorial_demo.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/examples/tutorial_demo.toml +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/setup.cfg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/backdrop.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/base.qss +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/chips.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/listview.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_dockwidget/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_dockwidget/resources/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_dockwidget/resources/icons/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_dockwidget/resources/icons/folder.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_dockwidget/widget.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_executors.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/bridge.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/cards.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/config.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/detail_panel.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/formatting.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/job_cards.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/models.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/palette.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/polling.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_monitor/widget.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_projects/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_projects/scratch.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/actions.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/box.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/center.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/display.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/hide.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/hydrogens-polar.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/hydrogens.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/menu.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/orient.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/presets.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/rock.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/selection.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/settings.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/icons/zoom.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_pymol/plugins.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_settings/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_stepper.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/action_header.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/cell_delegate.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/column_panel.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/example_usage.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/filter_panel.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/columns.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/export.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/filter.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/menu.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/reload.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/search.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/settings.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/sort-asc.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/sort-desc.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/icons/sort.svg +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/metric_filter_bar.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/pagination_control.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/query_builder.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/session_provider.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/smart_table_view.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/sort_panel.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/table_config.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/table_interaction.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/table_model.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/test_external_filters.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_table/test_toolbar.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_tutorial/__init__.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_tutorial/bindings.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_tutorial/controller.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_tutorial/models.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/ms_tutorial/overlay.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/opengl.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/pagination.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/palettes.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/step_dialog.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/theme.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/tool_panel.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components/wheel.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components.egg-info/dependency_links.txt +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/src/ms_components.egg-info/top_level.txt +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_app_settings.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_chips.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_dock_window.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_executors_ui.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_molsuite_monitor_bridge.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_molsuite_monitor_widgets.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_monitor_config.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_ms_projects_widget.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_opengl.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_progress_column.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_project_browser.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_pymol_grid.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_pymol_toolbar.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_query_builder_keyset.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_shift_hscroll.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_split_button_style.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_step_dialog.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_table_interaction.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_table_toolbar.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_table_view_state.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_theme_contrast.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/tests/test_tutorial.py +0 -0
- {ms_components-0.3.5 → ms_components-0.4.0}/zensical.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ms_components
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.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
|
|
@@ -17,12 +17,21 @@ Classifier: Environment :: X11 Applications :: Qt
|
|
|
17
17
|
Requires-Python: >=3.12
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: ms_env>=0.2.0
|
|
21
|
-
Requires-Dist: ms_flow>=0.2.0
|
|
22
20
|
Requires-Dist: PySide6>=6.5
|
|
23
|
-
|
|
24
|
-
Requires-Dist:
|
|
21
|
+
Provides-Extra: monitor
|
|
22
|
+
Requires-Dist: pydantic>=2.0; extra == "monitor"
|
|
23
|
+
Provides-Extra: projects
|
|
24
|
+
Requires-Dist: ms_flow>=0.2.0; extra == "projects"
|
|
25
|
+
Provides-Extra: pymol
|
|
26
|
+
Requires-Dist: pymol-open-source>=3.2.0a0; extra == "pymol"
|
|
27
|
+
Provides-Extra: steps
|
|
28
|
+
Requires-Dist: ms_env>=0.2.0; extra == "steps"
|
|
29
|
+
Provides-Extra: table
|
|
30
|
+
Requires-Dist: sqlmodel>=0.0.14; extra == "table"
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: ms_components[monitor,projects,pymol,steps,table]; extra == "all"
|
|
25
33
|
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: ms_components[all]; extra == "dev"
|
|
26
35
|
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
36
|
Dynamic: license-file
|
|
28
37
|
|
|
@@ -35,18 +44,39 @@ PyMOL dock, steppers and the shared theming (`themes/` + `base.qss`).
|
|
|
35
44
|
Python binds existing widgets/signals, while content can be defined in Python or
|
|
36
45
|
TOML. Try `PYTHONPATH=src python examples/tutorial_demo.py` from a source checkout.
|
|
37
46
|
|
|
38
|
-
Part of the [MolSuite](https://molsuite.github.io/) stack.
|
|
39
|
-
[`ms_flow`](https://github.com/MolSuite/ms_flow).
|
|
47
|
+
Part of the [MolSuite](https://molsuite.github.io/) stack. The project catalog integrates
|
|
48
|
+
with [`ms_flow`](https://github.com/MolSuite/ms_flow) when that backend is needed.
|
|
40
49
|
|
|
41
50
|
## Install
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
PyPI (`>=3.2.0a0`):
|
|
52
|
+
The base installation provides Qt widgets and themes:
|
|
45
53
|
|
|
46
54
|
```bash
|
|
47
55
|
pip install ms_components
|
|
48
56
|
```
|
|
49
57
|
|
|
58
|
+
Choose the integrations your application uses, or install all of them:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install "ms_components[table,pymol]"
|
|
62
|
+
pip install "ms_components[all]"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
| Extra | Dependency / use |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `table` | SQLModel tables |
|
|
68
|
+
| `monitor` | Pydantic monitor configuration |
|
|
69
|
+
| `projects` | `ms_flow` project catalog and standalone project browser |
|
|
70
|
+
| `pymol` | `pymol-open-source` alpha wheels (`>=3.2.0a0`) |
|
|
71
|
+
| `steps` | `ms_env` provisioning steps |
|
|
72
|
+
| `dev` | All integrations and pytest |
|
|
73
|
+
|
|
74
|
+
Extras select dependencies; all component source files remain in the package.
|
|
75
|
+
Project widgets accept a supplied backend without importing `ms_flow`. When no backend is
|
|
76
|
+
supplied, they use the optional MolSuite catalog, which creates its database on first use.
|
|
77
|
+
Run the standalone browser with `python -m ms_components.ms_projects.app` after installing
|
|
78
|
+
`ms_components[projects]`.
|
|
79
|
+
|
|
50
80
|
## Documentation
|
|
51
81
|
|
|
52
82
|
<https://molsuite.github.io/ms_components/>: a guide to each component, examples,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# ms_components
|
|
2
|
+
|
|
3
|
+
PySide6 UI components for MolSuite: smart table, project browser, job monitor,
|
|
4
|
+
PyMOL dock, steppers and the shared theming (`themes/` + `base.qss`).
|
|
5
|
+
|
|
6
|
+
[`ms_tutorial`](docs/ms_tutorial.md) provides informative and interactive tours:
|
|
7
|
+
Python binds existing widgets/signals, while content can be defined in Python or
|
|
8
|
+
TOML. Try `PYTHONPATH=src python examples/tutorial_demo.py` from a source checkout.
|
|
9
|
+
|
|
10
|
+
Part of the [MolSuite](https://molsuite.github.io/) stack. The project catalog integrates
|
|
11
|
+
with [`ms_flow`](https://github.com/MolSuite/ms_flow) when that backend is needed.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
The base installation provides Qt widgets and themes:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install ms_components
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Choose the integrations your application uses, or install all of them:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install "ms_components[table,pymol]"
|
|
25
|
+
pip install "ms_components[all]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| Extra | Dependency / use |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `table` | SQLModel tables |
|
|
31
|
+
| `monitor` | Pydantic monitor configuration |
|
|
32
|
+
| `projects` | `ms_flow` project catalog and standalone project browser |
|
|
33
|
+
| `pymol` | `pymol-open-source` alpha wheels (`>=3.2.0a0`) |
|
|
34
|
+
| `steps` | `ms_env` provisioning steps |
|
|
35
|
+
| `dev` | All integrations and pytest |
|
|
36
|
+
|
|
37
|
+
Extras select dependencies; all component source files remain in the package.
|
|
38
|
+
Project widgets accept a supplied backend without importing `ms_flow`. When no backend is
|
|
39
|
+
supplied, they use the optional MolSuite catalog, which creates its database on first use.
|
|
40
|
+
Run the standalone browser with `python -m ms_components.ms_projects.app` after installing
|
|
41
|
+
`ms_components[projects]`.
|
|
42
|
+
|
|
43
|
+
## Documentation
|
|
44
|
+
|
|
45
|
+
<https://molsuite.github.io/ms_components/>: a guide to each component, examples,
|
|
46
|
+
and the API reference.
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT — see [LICENSE](LICENSE). Third-party icon/asset licenses live in `licenses/`.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
qt-themes — https://github.com/beatreichenbach/qt-themes
|
|
2
|
+
Palette values in src/ms_components/theme.py are derived from this project.
|
|
3
|
+
|
|
4
|
+
MIT License
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2024 Beat Reichenbach
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
@@ -24,18 +24,20 @@ classifiers = [
|
|
|
24
24
|
"Environment :: X11 Applications :: Qt",
|
|
25
25
|
]
|
|
26
26
|
|
|
27
|
-
#
|
|
27
|
+
# Shared widgets need Qt; each integration declares its own dependencies below.
|
|
28
28
|
dependencies = [
|
|
29
|
-
"ms_env>=0.2.0",
|
|
30
|
-
"ms_flow>=0.2.0",
|
|
31
29
|
"PySide6>=6.5",
|
|
32
|
-
"pymol-open-source>=3.2.0a0",
|
|
33
|
-
"sqlmodel>=0.0.14",
|
|
34
30
|
]
|
|
35
31
|
|
|
36
32
|
[project.optional-dependencies]
|
|
33
|
+
monitor = ["pydantic>=2.0"]
|
|
34
|
+
projects = ["ms_flow>=0.2.0"]
|
|
35
|
+
pymol = ["pymol-open-source>=3.2.0a0"]
|
|
36
|
+
steps = ["ms_env>=0.2.0"]
|
|
37
|
+
table = ["sqlmodel>=0.0.14"]
|
|
38
|
+
all = ["ms_components[monitor,projects,pymol,steps,table]"]
|
|
37
39
|
# Test + development tooling.
|
|
38
|
-
dev = ["pytest>=7.0"]
|
|
40
|
+
dev = ["ms_components[all]", "pytest>=7.0"]
|
|
39
41
|
|
|
40
42
|
[project.urls]
|
|
41
43
|
Homepage = "https://github.com/MolSuite/ms_components"
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"""Draw or edit a small molecule in Ketcher (EPAM's web editor), embedded in a QWebEngineView.
|
|
2
|
+
|
|
3
|
+
`folder` is an unpacked Ketcher standalone build (the folder holding its index.html); the
|
|
4
|
+
application installs it. Ketcher's JS API answers with Promises, which runJavaScript cannot
|
|
5
|
+
await: the settled value is parked in a window variable and polled from here.
|
|
6
|
+
|
|
7
|
+
`run_editor` opens the dialog in its own process (`python -m ms_components.ketcher`): in an
|
|
8
|
+
application's process, PySide 6.10 segfaults as soon as the pointer hovers a QWebEngineView
|
|
9
|
+
while any Python application-wide event filter is installed. It also keeps Chromium's memory
|
|
10
|
+
and GPU use away from the rest of the application (an embedded PyMOL, for one)."""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
import tempfile
|
|
17
|
+
from collections.abc import Callable
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
from PySide6.QtCore import QCoreApplication, Qt, QTimer, QUrl, QUrlQuery
|
|
21
|
+
from PySide6.QtWidgets import QApplication, QDialog, QDialogButtonBox, QLabel, QMessageBox, QVBoxLayout
|
|
22
|
+
|
|
23
|
+
# Resolves once Ketcher has built `window.ketcher`, some time after the page itself loads.
|
|
24
|
+
_READY = "new Promise(r => { const t = setInterval(() => { if (window.ketcher) { clearInterval(t); r(true); } }, 100); })"
|
|
25
|
+
|
|
26
|
+
# Ketcher 3.18 standalone's URL options configure the editor before it mounts.
|
|
27
|
+
_HIDDEN_CONTROLS = (
|
|
28
|
+
"open", "save", "arrows", "reaction-plus", "reaction-mapping-tools", "reaction-map", "reaction-unmap",
|
|
29
|
+
"rgroup", "rgroup-label", "rgroup-fragment", "rgroup-attpoints", "sgroup", "create-monomer",
|
|
30
|
+
"shapes", "shape-ellipse", "shape-rectangle", "shape-line", "text", "images",
|
|
31
|
+
"recognize", "analyse", "miew", "settings", "help", "about", "fullscreen",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class KetcherDialog(QDialog):
|
|
36
|
+
"""Ketcher opened on `molblock`; after exec() == Accepted, `molblock` holds the drawing.
|
|
37
|
+
`note` is shown under the editor (e.g. what Apply will do)."""
|
|
38
|
+
|
|
39
|
+
def __init__(self, folder: Path, molblock: str, *, title: str, note: str = "", parent=None):
|
|
40
|
+
from PySide6.QtWebEngineWidgets import QWebEngineView # heavy: only when someone edits
|
|
41
|
+
|
|
42
|
+
super().__init__(parent)
|
|
43
|
+
self.setWindowTitle(title)
|
|
44
|
+
self.resize(1100, 750)
|
|
45
|
+
self.molblock = molblock
|
|
46
|
+
self._done: Callable[[dict], None] | None = None
|
|
47
|
+
self._poll = QTimer(self, interval=100)
|
|
48
|
+
# As JSON: a JS object comes back to Python empty, a string intact.
|
|
49
|
+
self._poll.timeout.connect(
|
|
50
|
+
lambda: self._view.page().runJavaScript("JSON.stringify(window.__ketcher ?? null)", 0, self._polled)
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
self._view = QWebEngineView(self)
|
|
54
|
+
self._view.loadFinished.connect(self._loaded)
|
|
55
|
+
url = QUrl.fromLocalFile(str(Path(folder) / "index.html"))
|
|
56
|
+
query = QUrlQuery()
|
|
57
|
+
query.addQueryItem("hiddenControls", ",".join(_HIDDEN_CONTROLS))
|
|
58
|
+
query.addQueryItem("disableMacromoleculesEditor", "true") # initialize without waiting for macromolecules
|
|
59
|
+
url.setQuery(query)
|
|
60
|
+
self._view.load(url)
|
|
61
|
+
self._buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Apply | QDialogButtonBox.StandardButton.Cancel, self)
|
|
62
|
+
self._buttons.button(QDialogButtonBox.StandardButton.Apply).clicked.connect(self._apply)
|
|
63
|
+
self._buttons.button(QDialogButtonBox.StandardButton.Apply).setEnabled(False)
|
|
64
|
+
self._buttons.rejected.connect(self.reject)
|
|
65
|
+
layout = QVBoxLayout(self)
|
|
66
|
+
layout.addWidget(self._view, 1)
|
|
67
|
+
if note:
|
|
68
|
+
label = QLabel(note, self)
|
|
69
|
+
label.setWordWrap(True)
|
|
70
|
+
layout.addWidget(label)
|
|
71
|
+
layout.addWidget(self._buttons)
|
|
72
|
+
|
|
73
|
+
def _call(self, promise: str, done: Callable[[dict], None]) -> None:
|
|
74
|
+
"""Evaluate a JS Promise; `done({"ok": value} | {"error": text})` once it settles."""
|
|
75
|
+
self._done = done
|
|
76
|
+
self._view.page().runJavaScript(
|
|
77
|
+
"window.__ketcher = undefined;"
|
|
78
|
+
f"Promise.resolve({promise}).then(v => window.__ketcher = {{ok: v ?? ''}},"
|
|
79
|
+
" e => window.__ketcher = {error: String(e)});"
|
|
80
|
+
)
|
|
81
|
+
self._poll.start()
|
|
82
|
+
|
|
83
|
+
def _polled(self, value) -> None:
|
|
84
|
+
result = json.loads(value or "null")
|
|
85
|
+
if not result or self._done is None:
|
|
86
|
+
return
|
|
87
|
+
self._poll.stop()
|
|
88
|
+
done, self._done = self._done, None
|
|
89
|
+
done(result)
|
|
90
|
+
|
|
91
|
+
def _loaded(self, ok: bool) -> None:
|
|
92
|
+
if not ok:
|
|
93
|
+
QMessageBox.critical(self, "Ketcher", "Ketcher could not be loaded.")
|
|
94
|
+
return
|
|
95
|
+
self._call(f"{_READY}.then(() => window.ketcher.setMolecule({json.dumps(self.molblock)}))", self._ready)
|
|
96
|
+
|
|
97
|
+
def _ready(self, result: dict) -> None:
|
|
98
|
+
if "error" in result:
|
|
99
|
+
QMessageBox.warning(self, "Ketcher", f"Ketcher could not open the molecule:\n{result['error']}")
|
|
100
|
+
return
|
|
101
|
+
self._buttons.button(QDialogButtonBox.StandardButton.Apply).setEnabled(True)
|
|
102
|
+
|
|
103
|
+
def _apply(self) -> None:
|
|
104
|
+
self._buttons.setEnabled(False)
|
|
105
|
+
self._call("window.ketcher.getMolfile()", self._got)
|
|
106
|
+
|
|
107
|
+
def _got(self, result: dict) -> None:
|
|
108
|
+
self._buttons.setEnabled(True)
|
|
109
|
+
if "error" in result:
|
|
110
|
+
QMessageBox.critical(self, "Ketcher", f"Could not read the drawing:\n{result['error']}")
|
|
111
|
+
return
|
|
112
|
+
self.molblock = str(result.get("ok") or "")
|
|
113
|
+
self.accept()
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def run_editor(
|
|
117
|
+
folder: Path,
|
|
118
|
+
molblock: str,
|
|
119
|
+
title: str,
|
|
120
|
+
*,
|
|
121
|
+
note: str = "",
|
|
122
|
+
theme: str = "auto",
|
|
123
|
+
base_font_pt: float | None = None,
|
|
124
|
+
) -> str | None:
|
|
125
|
+
"""Open a KetcherDialog in a child process and wait; the drawing after Apply, None on Cancel.
|
|
126
|
+
Blocking: call it off the GUI thread. `theme`/`base_font_pt` go to ms_components.theme."""
|
|
127
|
+
options = {"folder": str(folder), "title": title, "note": note, "theme": theme, "base_font_pt": base_font_pt}
|
|
128
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
129
|
+
out = Path(tmp) / "edited.mol"
|
|
130
|
+
proc = subprocess.run(
|
|
131
|
+
[sys.executable, "-m", __name__, json.dumps(options), str(out)],
|
|
132
|
+
input=molblock, capture_output=True, text=True,
|
|
133
|
+
)
|
|
134
|
+
if proc.returncode != 0:
|
|
135
|
+
raise RuntimeError(f"The editor stopped (exit code {proc.returncode}):\n{proc.stderr[-2000:]}")
|
|
136
|
+
return out.read_text() if out.exists() else None
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def _main(options: str, out: str) -> int:
|
|
140
|
+
"""The child process: molblock on stdin; the drawing is written to `out` only on Apply."""
|
|
141
|
+
from ms_components.theme import apply_theme
|
|
142
|
+
|
|
143
|
+
opts = json.loads(options)
|
|
144
|
+
QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts) # QtWebEngine wants it before the app
|
|
145
|
+
app = QApplication(["ms-ketcher"])
|
|
146
|
+
apply_theme(opts.get("theme") or "auto", app, base_font_pt=opts.get("base_font_pt"))
|
|
147
|
+
dialog = KetcherDialog(Path(opts["folder"]), sys.stdin.read(), title=opts["title"], note=opts.get("note", ""))
|
|
148
|
+
if dialog.exec() == QDialog.DialogCode.Accepted:
|
|
149
|
+
Path(out).write_text(dialog.molblock)
|
|
150
|
+
return 0
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
__all__ = ["KetcherDialog", "run_editor"]
|
|
154
|
+
|
|
155
|
+
if __name__ == "__main__":
|
|
156
|
+
sys.exit(_main(*sys.argv[1:3]))
|
|
@@ -2,14 +2,20 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
|
|
5
|
-
from PySide6.QtWidgets import QApplication
|
|
5
|
+
from PySide6.QtWidgets import QApplication, QMessageBox
|
|
6
6
|
|
|
7
7
|
from ms_components.ms_projects.browser import ProjectBrowserWindow
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def main(argv: list[str] | None = None) -> int:
|
|
11
11
|
app = QApplication(list(sys.argv[1:] if argv is None else argv))
|
|
12
|
-
|
|
12
|
+
try:
|
|
13
|
+
window = ProjectBrowserWindow()
|
|
14
|
+
except ModuleNotFoundError as exc:
|
|
15
|
+
if exc.name != "ms_flow":
|
|
16
|
+
raise
|
|
17
|
+
QMessageBox.critical(None, "Projects", str(exc))
|
|
18
|
+
return 1
|
|
13
19
|
window.show()
|
|
14
20
|
return app.exec()
|
|
15
21
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Load MolSuite's default catalog only when a caller has not supplied a backend."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def create_catalog_backend(*, app_id_filter: str | None = None):
|
|
6
|
+
try:
|
|
7
|
+
from ms_flow.core.project.catalog import ProjectCatalogBackend
|
|
8
|
+
except ModuleNotFoundError as exc:
|
|
9
|
+
if exc.name != "ms_flow":
|
|
10
|
+
raise
|
|
11
|
+
raise ModuleNotFoundError(
|
|
12
|
+
'The project catalog requires ms_flow. Install it with: pip install "ms_components[projects]"',
|
|
13
|
+
name="ms_flow",
|
|
14
|
+
) from exc
|
|
15
|
+
return ProjectCatalogBackend(app_id_filter=app_id_filter)
|
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import sys
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Any, List, Optional
|
|
6
|
+
from typing import TYPE_CHECKING, Any, List, Optional
|
|
7
7
|
|
|
8
8
|
from PySide6.QtCore import (
|
|
9
9
|
Qt, Signal, QRect, QSize, QAbstractTableModel, QModelIndex, QEvent,
|
|
@@ -21,11 +21,14 @@ from PySide6.QtWidgets import (
|
|
|
21
21
|
QTreeView, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget,
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
from
|
|
25
|
-
from ms_flow.core.settings.manager import SettingsManager
|
|
26
|
-
from ms_flow.core.settings.models import Settings
|
|
24
|
+
from ms_components.ms_projects.backend import create_catalog_backend
|
|
27
25
|
from ms_components.theme import color as theme_color
|
|
28
26
|
|
|
27
|
+
if TYPE_CHECKING:
|
|
28
|
+
from ms_flow.core.project.catalog import ProjectCatalogBackend
|
|
29
|
+
from ms_flow.core.settings.manager import SettingsManager
|
|
30
|
+
from ms_flow.core.settings.models import Settings
|
|
31
|
+
|
|
29
32
|
|
|
30
33
|
# ── Palette ───────────────────────────────────────────────────────────────────
|
|
31
34
|
_TOOL_COLORS: list[str] = [
|
|
@@ -1108,7 +1111,7 @@ class ProjectBrowserPanel(QWidget):
|
|
|
1108
1111
|
_backend: ProjectCatalogBackend | None = None, parent=None):
|
|
1109
1112
|
super().__init__(parent)
|
|
1110
1113
|
self.app_id = (app_id or "").strip() or None
|
|
1111
|
-
self.backend = _backend
|
|
1114
|
+
self.backend = _backend if _backend is not None else create_catalog_backend()
|
|
1112
1115
|
self.header_title = header_title
|
|
1113
1116
|
self.hint_text = hint_text
|
|
1114
1117
|
self.allow_app_selection = (
|
|
@@ -2002,7 +2005,7 @@ class ProjectBrowserWindow(QMainWindow):
|
|
|
2002
2005
|
close_on_launch: bool = True, _backend: ProjectCatalogBackend | None = None):
|
|
2003
2006
|
super().__init__()
|
|
2004
2007
|
self.app_id = (app_id or "").strip() or None
|
|
2005
|
-
self.backend = _backend
|
|
2008
|
+
self.backend = _backend if _backend is not None else create_catalog_backend()
|
|
2006
2009
|
self.window_title = window_title or "MolSuite Control Center"
|
|
2007
2010
|
self.close_on_launch = close_on_launch
|
|
2008
2011
|
eff_header = header_title or (self.app_id or "MolSuite Projects")
|
|
@@ -2082,7 +2085,6 @@ class ProjectBrowserWindow(QMainWindow):
|
|
|
2082
2085
|
|
|
2083
2086
|
|
|
2084
2087
|
if __name__ == "__main__":
|
|
2085
|
-
app
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
sys.exit(app.exec())
|
|
2088
|
+
from ms_components.ms_projects.app import main
|
|
2089
|
+
|
|
2090
|
+
sys.exit(main())
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Optional
|
|
4
|
+
from typing import TYPE_CHECKING, Optional
|
|
5
5
|
|
|
6
6
|
from PySide6.QtCore import Qt, Signal
|
|
7
7
|
from PySide6.QtWidgets import (
|
|
@@ -16,9 +16,12 @@ from PySide6.QtWidgets import (
|
|
|
16
16
|
QWidget,
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
from
|
|
19
|
+
from ms_components.ms_projects.backend import create_catalog_backend
|
|
20
20
|
from ms_components.ms_projects.browser import ProjectFormDialog, ProjectItem, ProjectTreeWidget
|
|
21
21
|
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from ms_flow.core.project.catalog import ProjectCatalogBackend
|
|
24
|
+
|
|
22
25
|
_PROJECT_MENU_COLORS = [
|
|
23
26
|
"#4e95ff",
|
|
24
27
|
"#a259ff",
|
|
@@ -56,7 +59,7 @@ class ProjectsMenuWidget(QFrame):
|
|
|
56
59
|
):
|
|
57
60
|
super().__init__(parent)
|
|
58
61
|
self.app_id = (app_id or "").strip() or None
|
|
59
|
-
self.backend = backend
|
|
62
|
+
self.backend = backend if backend is not None else create_catalog_backend(app_id_filter=self.app_id)
|
|
60
63
|
self.title = title
|
|
61
64
|
self.hint_text = hint_text
|
|
62
65
|
self.allow_create = allow_create
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from .scene import (
|
|
2
|
+
SceneMemory,
|
|
3
|
+
add_scene_actions,
|
|
4
|
+
clear_scene,
|
|
5
|
+
color_atoms,
|
|
6
|
+
color_by_residue_nature,
|
|
7
|
+
frame,
|
|
8
|
+
install_scene_memory,
|
|
9
|
+
is_additive,
|
|
10
|
+
is_interacting,
|
|
11
|
+
menu_action,
|
|
12
|
+
object_list,
|
|
13
|
+
prepare_scene,
|
|
14
|
+
select_atoms,
|
|
15
|
+
set_additive,
|
|
16
|
+
set_scene_context,
|
|
17
|
+
)
|
|
18
|
+
from .widget import (
|
|
19
|
+
COMPARISON_COLORS,
|
|
20
|
+
associate_scene_objects,
|
|
21
|
+
PymolControlBar,
|
|
22
|
+
PymolDockWidget,
|
|
23
|
+
PymolPresetSpec,
|
|
24
|
+
PymolSceneContext,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"COMPARISON_COLORS",
|
|
29
|
+
"SceneMemory",
|
|
30
|
+
"add_scene_actions",
|
|
31
|
+
"associate_scene_objects",
|
|
32
|
+
"clear_scene",
|
|
33
|
+
"color_atoms",
|
|
34
|
+
"color_by_residue_nature",
|
|
35
|
+
"frame",
|
|
36
|
+
"install_scene_memory",
|
|
37
|
+
"is_additive",
|
|
38
|
+
"is_interacting",
|
|
39
|
+
"menu_action",
|
|
40
|
+
"object_list",
|
|
41
|
+
"prepare_scene",
|
|
42
|
+
"select_atoms",
|
|
43
|
+
"set_additive",
|
|
44
|
+
"set_scene_context",
|
|
45
|
+
"PymolControlBar",
|
|
46
|
+
"PymolDockWidget",
|
|
47
|
+
"PymolPresetSpec",
|
|
48
|
+
"PymolSceneContext",
|
|
49
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-paintbrush-icon lucide-paintbrush"><path d="m14.622 17.897-10.68-2.913"/><path d="M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z"/><path d="M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15"/></svg>
|