moleditpy 5.2.0__tar.gz → 5.2.2__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 (100) hide show
  1. {moleditpy-5.2.0 → moleditpy-5.2.2}/PKG-INFO +4 -3
  2. {moleditpy-5.2.0 → moleditpy-5.2.2}/README.md +1 -1
  3. {moleditpy-5.2.0 → moleditpy-5.2.2}/pyproject.toml +3 -2
  4. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/MoleditPy.egg-info/PKG-INFO +4 -3
  5. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/MoleditPy.egg-info/requires.txt +2 -1
  6. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/core/project_validation.py +69 -1
  7. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/io_logic.py +9 -5
  8. {moleditpy-5.2.0 → moleditpy-5.2.2}/COPYING +0 -0
  9. {moleditpy-5.2.0 → moleditpy-5.2.2}/DISTRIBUTION.md +0 -0
  10. {moleditpy-5.2.0 → moleditpy-5.2.2}/LICENSE +0 -0
  11. {moleditpy-5.2.0 → moleditpy-5.2.2}/LICENSING.md +0 -0
  12. {moleditpy-5.2.0 → moleditpy-5.2.2}/THIRD_PARTY_NOTICES.md +0 -0
  13. {moleditpy-5.2.0 → moleditpy-5.2.2}/setup.cfg +0 -0
  14. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/MoleditPy.egg-info/SOURCES.txt +0 -0
  15. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/MoleditPy.egg-info/dependency_links.txt +0 -0
  16. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/MoleditPy.egg-info/entry_points.txt +0 -0
  17. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/MoleditPy.egg-info/top_level.txt +0 -0
  18. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/__init__.py +0 -0
  19. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/__main__.py +0 -0
  20. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/assets/file_icon.ico +0 -0
  21. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/assets/icon.icns +0 -0
  22. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/assets/icon.ico +0 -0
  23. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/assets/icon.png +0 -0
  24. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/core/__init__.py +0 -0
  25. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/core/formal_charge.py +0 -0
  26. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/core/mol_geometry.py +0 -0
  27. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/core/molecular_data.py +0 -0
  28. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/core/stereo_check.py +0 -0
  29. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/main.py +0 -0
  30. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/plugins/__init__.py +0 -0
  31. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/plugins/plugin_interface.py +0 -0
  32. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/plugins/plugin_manager.py +0 -0
  33. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/plugins/plugin_manager_window.py +0 -0
  34. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/__init__.py +0 -0
  35. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/about_dialog.py +0 -0
  36. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/align_plane_dialog.py +0 -0
  37. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/alignment_dialog.py +0 -0
  38. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/analysis_window.py +0 -0
  39. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/angle_dialog.py +0 -0
  40. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/app_state.py +0 -0
  41. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/atom_item.py +0 -0
  42. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/atom_picking.py +0 -0
  43. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/base_picking_dialog.py +0 -0
  44. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/bond_item.py +0 -0
  45. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/bond_length_dialog.py +0 -0
  46. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/calculation_worker.py +0 -0
  47. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/chain_mixin.py +0 -0
  48. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/chirality_warning_dialog.py +0 -0
  49. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/color_settings_dialog.py +0 -0
  50. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/compute_logic.py +0 -0
  51. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/constrained_optimization_dialog.py +0 -0
  52. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/custom_interactor_style.py +0 -0
  53. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/custom_qt_interactor.py +0 -0
  54. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/dialog_3d_picking_mixin.py +0 -0
  55. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/dialog_logic.py +0 -0
  56. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/dihedral_dialog.py +0 -0
  57. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/edit_3d_logic.py +0 -0
  58. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/edit_actions_logic.py +0 -0
  59. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/export_logic.py +0 -0
  60. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/geometry_base_dialog.py +0 -0
  61. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/main_window.py +0 -0
  62. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/main_window_init.py +0 -0
  63. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/menu_utils.py +0 -0
  64. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/mirror_dialog.py +0 -0
  65. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/molecular_scene_handler.py +0 -0
  66. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/molecule_scene.py +0 -0
  67. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/move_dialog_mixin.py +0 -0
  68. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/move_group_dialog.py +0 -0
  69. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/move_selected_atoms_dialog.py +0 -0
  70. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/periodic_table_dialog.py +0 -0
  71. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/planarize_dialog.py +0 -0
  72. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/plugin_menu_manager.py +0 -0
  73. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/preview_molecule.py +0 -0
  74. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/sdf_record_dialog.py +0 -0
  75. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/settings_dialog.py +0 -0
  76. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/settings_tabs/__init__.py +0 -0
  77. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/settings_tabs/settings_2d_cleanup_tab.py +0 -0
  78. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/settings_tabs/settings_2d_tab.py +0 -0
  79. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/settings_tabs/settings_3d_tabs.py +0 -0
  80. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/settings_tabs/settings_labels_tab.py +0 -0
  81. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/settings_tabs/settings_other_tab.py +0 -0
  82. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/settings_tabs/settings_tab_base.py +0 -0
  83. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/string_importers.py +0 -0
  84. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/template_preview_item.py +0 -0
  85. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/template_preview_view.py +0 -0
  86. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/translation_dialog.py +0 -0
  87. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/ui_manager.py +0 -0
  88. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/user_template_dialog.py +0 -0
  89. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/view_3d_logic.py +0 -0
  90. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/ui/zoomable_view.py +0 -0
  91. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/__init__.py +0 -0
  92. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/constants.py +0 -0
  93. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/default_settings.py +0 -0
  94. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/finite_float.py +0 -0
  95. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/hit_radius.py +0 -0
  96. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/label_style.py +0 -0
  97. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/sdf_records.py +0 -0
  98. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/sip_isdeleted_safe.py +0 -0
  99. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/suppress_log.py +0 -0
  100. {moleditpy-5.2.0 → moleditpy-5.2.2}/src/moleditpy/utils/system_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MoleditPy
3
- Version: 5.2.0
3
+ Version: 5.2.2
4
4
  Summary: A cross-platform, simple, and intuitive molecular structure editor built in Python. It allows 2D molecular drawing and 3D structure visualization. It supports exporting structure files for input to DFT calculation software.
5
5
  Author-email: HiroYokoyama <titech.yoko.hiro@gmail.com>
6
6
  License-Expression: LGPL-3.0-or-later
@@ -27,7 +27,8 @@ Requires-Dist: numpy
27
27
  Requires-Dist: pyside6-essentials<6.10,>=6.9; python_version < "3.10"
28
28
  Requires-Dist: pyside6-essentials<6.12,>=6.10; python_version >= "3.10"
29
29
  Requires-Dist: pyvista<0.50
30
- Requires-Dist: pyvistaqt<0.14
30
+ Requires-Dist: pyvistaqt<0.12; python_version < "3.10"
31
+ Requires-Dist: pyvistaqt<0.14,>=0.13; python_version >= "3.10"
31
32
  Requires-Dist: rdkit<2026.10
32
33
  Dynamic: license-file
33
34
 
@@ -72,7 +73,7 @@ moleditpy
72
73
 
73
74
  The first launch can take a while as RDKit and the other libraries initialize. A [Windows installer](https://hiroyokoyama.github.io/python_molecular_editor/windows-installer/windows_installer), a [macOS app bundle](https://hiroyokoyama.github.io/python_molecular_editor/macos-installer/macos_installer), and a [Docker image](https://github.com/HiroYokoyama/python_molecular_editor_docker) are also available.
74
75
 
75
- > **Security note:** the legacy `.pmeraw` project format uses Python pickle, which can execute arbitrary code when loaded. Only open `.pmeraw` files you created yourself, and use the JSON-based `.pmeprj` format for sharing.
76
+ > **Security note:** the legacy `.pmeraw` project format uses Python pickle. MoleditPy loads it with a restricted unpickler that rejects any code embedded in the file, but only open `.pmeraw` files you created yourself, and use the JSON-based `.pmeprj` format for sharing.
76
77
 
77
78
  To install the application directly without the shortcut helper:
78
79
 
@@ -39,7 +39,7 @@ moleditpy
39
39
 
40
40
  The first launch can take a while as RDKit and the other libraries initialize. A [Windows installer](https://hiroyokoyama.github.io/python_molecular_editor/windows-installer/windows_installer), a [macOS app bundle](https://hiroyokoyama.github.io/python_molecular_editor/macos-installer/macos_installer), and a [Docker image](https://github.com/HiroYokoyama/python_molecular_editor_docker) are also available.
41
41
 
42
- > **Security note:** the legacy `.pmeraw` project format uses Python pickle, which can execute arbitrary code when loaded. Only open `.pmeraw` files you created yourself, and use the JSON-based `.pmeprj` format for sharing.
42
+ > **Security note:** the legacy `.pmeraw` project format uses Python pickle. MoleditPy loads it with a restricted unpickler that rejects any code embedded in the file, but only open `.pmeraw` files you created yourself, and use the JSON-based `.pmeprj` format for sharing.
43
43
 
44
44
  To install the application directly without the shortcut helper:
45
45
 
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "MoleditPy"
7
7
 
8
- version = "5.2.0"
8
+ version = "5.2.2"
9
9
 
10
10
  license = "LGPL-3.0-or-later"
11
11
  license-files = ["LICENSE", "COPYING", "THIRD_PARTY_NOTICES.md", "DISTRIBUTION.md", "LICENSING.md"]
@@ -38,7 +38,8 @@ dependencies = [
38
38
  "pyside6-essentials >= 6.9, < 6.10; python_version < '3.10'",
39
39
  "pyside6-essentials >= 6.10, < 6.12; python_version >= '3.10'",
40
40
  "pyvista < 0.50",
41
- "pyvistaqt < 0.14",
41
+ "pyvistaqt < 0.12; python_version < '3.10'",
42
+ "pyvistaqt >= 0.13, < 0.14; python_version >= '3.10'",
42
43
  "rdkit < 2026.10"
43
44
  ]
44
45
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MoleditPy
3
- Version: 5.2.0
3
+ Version: 5.2.2
4
4
  Summary: A cross-platform, simple, and intuitive molecular structure editor built in Python. It allows 2D molecular drawing and 3D structure visualization. It supports exporting structure files for input to DFT calculation software.
5
5
  Author-email: HiroYokoyama <titech.yoko.hiro@gmail.com>
6
6
  License-Expression: LGPL-3.0-or-later
@@ -27,7 +27,8 @@ Requires-Dist: numpy
27
27
  Requires-Dist: pyside6-essentials<6.10,>=6.9; python_version < "3.10"
28
28
  Requires-Dist: pyside6-essentials<6.12,>=6.10; python_version >= "3.10"
29
29
  Requires-Dist: pyvista<0.50
30
- Requires-Dist: pyvistaqt<0.14
30
+ Requires-Dist: pyvistaqt<0.12; python_version < "3.10"
31
+ Requires-Dist: pyvistaqt<0.14,>=0.13; python_version >= "3.10"
31
32
  Requires-Dist: rdkit<2026.10
32
33
  Dynamic: license-file
33
34
 
@@ -72,7 +73,7 @@ moleditpy
72
73
 
73
74
  The first launch can take a while as RDKit and the other libraries initialize. A [Windows installer](https://hiroyokoyama.github.io/python_molecular_editor/windows-installer/windows_installer), a [macOS app bundle](https://hiroyokoyama.github.io/python_molecular_editor/macos-installer/macos_installer), and a [Docker image](https://github.com/HiroYokoyama/python_molecular_editor_docker) are also available.
74
75
 
75
- > **Security note:** the legacy `.pmeraw` project format uses Python pickle, which can execute arbitrary code when loaded. Only open `.pmeraw` files you created yourself, and use the JSON-based `.pmeprj` format for sharing.
76
+ > **Security note:** the legacy `.pmeraw` project format uses Python pickle. MoleditPy loads it with a restricted unpickler that rejects any code embedded in the file, but only open `.pmeraw` files you created yourself, and use the JSON-based `.pmeprj` format for sharing.
76
77
 
77
78
  To install the application directly without the shortcut helper:
78
79
 
@@ -1,10 +1,11 @@
1
1
  numpy
2
2
  pyvista<0.50
3
- pyvistaqt<0.14
4
3
  rdkit<2026.10
5
4
 
6
5
  [:python_version < "3.10"]
7
6
  pyside6-essentials<6.10,>=6.9
7
+ pyvistaqt<0.12
8
8
 
9
9
  [:python_version >= "3.10"]
10
10
  pyside6-essentials<6.12,>=6.10
11
+ pyvistaqt<0.14,>=0.13
@@ -3,12 +3,17 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import base64
6
+ import io
6
7
  import math
7
- from typing import Any
8
+ import pickle
9
+ import pickletools
10
+ from typing import Any, BinaryIO
8
11
 
9
12
  import numpy as np
10
13
  from rdkit import Chem
11
14
 
15
+ from .molecular_data import PointTuple
16
+
12
17
 
13
18
  def _integer(value: Any, minimum: int = 0) -> int:
14
19
  if not isinstance(value, int) or isinstance(value, bool) or value < minimum:
@@ -95,6 +100,69 @@ def validate_project_data(data: dict[str, Any]) -> None:
95
100
  _coordinate(atom.get(axis, 0.0))
96
101
 
97
102
 
103
+ # The only non-builtin type a raw snapshot contains: 2D atom positions are
104
+ # PointTuple, a plain tuple subclass whose reconstruction runs no user code.
105
+ _RAW_PROJECT_CLASSES: dict[tuple[str, str], type] = {
106
+ ("moleditpy.core.molecular_data", "PointTuple"): PointTuple,
107
+ }
108
+
109
+
110
+ class _RestrictedUnpickler(pickle.Unpickler):
111
+ """Unpickler that refuses every global reference except PointTuple.
112
+
113
+ A raw project snapshot is otherwise built from dicts, lists, tuples,
114
+ strings, bytes and numbers, none of which needs ``find_class``. Any other
115
+ reference is a pickle trying to import a callable, which is the
116
+ arbitrary-code-execution vector of the format.
117
+ """
118
+
119
+ def find_class(self, module: str, name: str) -> Any:
120
+ try:
121
+ return _RAW_PROJECT_CLASSES[(module, name)]
122
+ except KeyError:
123
+ raise pickle.UnpicklingError(
124
+ f"Raw project files may not reference {module}.{name}"
125
+ ) from None
126
+
127
+
128
+ # Everything a snapshot needs: data, containers, memo and framing, plus the
129
+ # global lookup and NEWOBJ that rebuild a PointTuple. Left out on purpose are
130
+ # the opcodes that call or configure an object (REDUCE, BUILD, INST, OBJ,
131
+ # NEWOBJ_EX), persistent IDs, out-of-band buffers and the EXT opcodes: a cached
132
+ # copyreg extension is returned without ever reaching find_class.
133
+ _RAW_PROJECT_OPCODES = frozenset(
134
+ {
135
+ "PROTO", "FRAME", "STOP", "MARK", "POP", "POP_MARK", "DUP",
136
+ "MEMOIZE", "GET", "BINGET", "LONG_BINGET", "PUT", "BINPUT", "LONG_BINPUT",
137
+ "NONE", "NEWTRUE", "NEWFALSE",
138
+ "INT", "BININT", "BININT1", "BININT2", "LONG", "LONG1", "LONG4",
139
+ "FLOAT", "BINFLOAT",
140
+ "STRING", "BINSTRING", "SHORT_BINSTRING",
141
+ "UNICODE", "SHORT_BINUNICODE", "BINUNICODE", "BINUNICODE8",
142
+ "BINBYTES", "SHORT_BINBYTES", "BINBYTES8", "BYTEARRAY8",
143
+ "EMPTY_LIST", "LIST", "APPEND", "APPENDS",
144
+ "EMPTY_TUPLE", "TUPLE", "TUPLE1", "TUPLE2", "TUPLE3",
145
+ "EMPTY_DICT", "DICT", "SETITEM", "SETITEMS",
146
+ "EMPTY_SET", "ADDITEMS", "FROZENSET",
147
+ "GLOBAL", "STACK_GLOBAL", "NEWOBJ",
148
+ }
149
+ ) # fmt: skip
150
+
151
+
152
+ def load_raw_project(stream: BinaryIO) -> Any:
153
+ """Unpickle a .pmeraw stream without allowing any imports or calls."""
154
+ data = stream.read()
155
+ try:
156
+ for opcode, _argument, _position in pickletools.genops(data):
157
+ if opcode.name not in _RAW_PROJECT_OPCODES:
158
+ raise pickle.UnpicklingError(
159
+ f"Raw project files may not use the {opcode.name} pickle opcode"
160
+ )
161
+ except (ValueError, OverflowError, IndexError, TypeError) as exc:
162
+ raise pickle.UnpicklingError(f"Malformed raw project file: {exc}") from exc
163
+ return _RestrictedUnpickler(io.BytesIO(data)).load()
164
+
165
+
98
166
  def validate_raw_project_data(data: Any) -> None:
99
167
  """Validate legacy pickle geometry before any live state is cleared."""
100
168
  if not isinstance(data, dict):
@@ -50,7 +50,11 @@ from rdkit.Chem import (
50
50
 
51
51
  from ..utils.sdf_records import read_sdf_records
52
52
  from ..utils.finite_float import finite_float
53
- from ..core.project_validation import validate_project_data, validate_raw_project_data
53
+ from ..core.project_validation import (
54
+ load_raw_project,
55
+ validate_project_data,
56
+ validate_raw_project_data,
57
+ )
54
58
  from .sdf_record_dialog import SdfRecordDialog
55
59
  from ..utils.constants import (
56
60
  COVALENT_RADII,
@@ -1286,9 +1290,9 @@ class IOManager:
1286
1290
  box.setText("This file is in the legacy raw (pickle) format.")
1287
1291
  box.setInformativeText(
1288
1292
  f"{os.path.basename(file_path)}\n\n"
1289
- "Raw project files can execute arbitrary code when opened. "
1290
- "Only open .pmeraw files that you created yourself or received "
1291
- "from a source you trust.\n\n"
1293
+ "Raw project files are a legacy binary format. MoleditPy refuses "
1294
+ "any code embedded in them, but only open .pmeraw files that you "
1295
+ "created yourself or received from a source you trust.\n\n"
1292
1296
  "The .pmeprj format is safe and is recommended instead."
1293
1297
  )
1294
1298
  open_button = box.addButton("Open", QMessageBox.ButtonRole.AcceptRole)
@@ -1324,7 +1328,7 @@ class IOManager:
1324
1328
  try:
1325
1329
  # Unpickle before clearing, so an unreadable file keeps the document.
1326
1330
  with open(file_path, "rb") as f:
1327
- loaded_data = pickle.load(f)
1331
+ loaded_data = load_raw_project(f)
1328
1332
  validate_raw_project_data(loaded_data)
1329
1333
  if not self.host.edit_actions_manager.clear_all(skip_check=True):
1330
1334
  return
File without changes
File without changes
File without changes
File without changes
File without changes