moleditpy 5.1.3__tar.gz → 5.2.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 (100) hide show
  1. {moleditpy-5.1.3 → moleditpy-5.2.0}/PKG-INFO +1 -1
  2. {moleditpy-5.1.3 → moleditpy-5.2.0}/pyproject.toml +1 -1
  3. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/MoleditPy.egg-info/PKG-INFO +1 -1
  4. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/__main__.py +0 -4
  5. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/main.py +19 -1
  6. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/plugins/plugin_interface.py +16 -2
  7. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/main_window_init.py +4 -2
  8. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/plugin_menu_manager.py +6 -1
  9. {moleditpy-5.1.3 → moleditpy-5.2.0}/COPYING +0 -0
  10. {moleditpy-5.1.3 → moleditpy-5.2.0}/DISTRIBUTION.md +0 -0
  11. {moleditpy-5.1.3 → moleditpy-5.2.0}/LICENSE +0 -0
  12. {moleditpy-5.1.3 → moleditpy-5.2.0}/LICENSING.md +0 -0
  13. {moleditpy-5.1.3 → moleditpy-5.2.0}/README.md +0 -0
  14. {moleditpy-5.1.3 → moleditpy-5.2.0}/THIRD_PARTY_NOTICES.md +0 -0
  15. {moleditpy-5.1.3 → moleditpy-5.2.0}/setup.cfg +0 -0
  16. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/MoleditPy.egg-info/SOURCES.txt +0 -0
  17. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/MoleditPy.egg-info/dependency_links.txt +0 -0
  18. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/MoleditPy.egg-info/entry_points.txt +0 -0
  19. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/MoleditPy.egg-info/requires.txt +0 -0
  20. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/MoleditPy.egg-info/top_level.txt +0 -0
  21. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/__init__.py +0 -0
  22. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/assets/file_icon.ico +0 -0
  23. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/assets/icon.icns +0 -0
  24. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/assets/icon.ico +0 -0
  25. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/assets/icon.png +0 -0
  26. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/core/__init__.py +0 -0
  27. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/core/formal_charge.py +0 -0
  28. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/core/mol_geometry.py +0 -0
  29. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/core/molecular_data.py +0 -0
  30. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/core/project_validation.py +0 -0
  31. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/core/stereo_check.py +0 -0
  32. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/plugins/__init__.py +0 -0
  33. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/plugins/plugin_manager.py +0 -0
  34. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/plugins/plugin_manager_window.py +0 -0
  35. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/__init__.py +0 -0
  36. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/about_dialog.py +0 -0
  37. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/align_plane_dialog.py +0 -0
  38. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/alignment_dialog.py +0 -0
  39. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/analysis_window.py +0 -0
  40. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/angle_dialog.py +0 -0
  41. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/app_state.py +0 -0
  42. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/atom_item.py +0 -0
  43. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/atom_picking.py +0 -0
  44. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/base_picking_dialog.py +0 -0
  45. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/bond_item.py +0 -0
  46. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/bond_length_dialog.py +0 -0
  47. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/calculation_worker.py +0 -0
  48. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/chain_mixin.py +0 -0
  49. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/chirality_warning_dialog.py +0 -0
  50. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/color_settings_dialog.py +0 -0
  51. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/compute_logic.py +0 -0
  52. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/constrained_optimization_dialog.py +0 -0
  53. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/custom_interactor_style.py +0 -0
  54. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/custom_qt_interactor.py +0 -0
  55. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/dialog_3d_picking_mixin.py +0 -0
  56. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/dialog_logic.py +0 -0
  57. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/dihedral_dialog.py +0 -0
  58. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/edit_3d_logic.py +0 -0
  59. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/edit_actions_logic.py +0 -0
  60. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/export_logic.py +0 -0
  61. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/geometry_base_dialog.py +0 -0
  62. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/io_logic.py +0 -0
  63. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/main_window.py +0 -0
  64. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/menu_utils.py +0 -0
  65. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/mirror_dialog.py +0 -0
  66. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/molecular_scene_handler.py +0 -0
  67. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/molecule_scene.py +0 -0
  68. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/move_dialog_mixin.py +0 -0
  69. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/move_group_dialog.py +0 -0
  70. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/move_selected_atoms_dialog.py +0 -0
  71. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/periodic_table_dialog.py +0 -0
  72. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/planarize_dialog.py +0 -0
  73. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/preview_molecule.py +0 -0
  74. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/sdf_record_dialog.py +0 -0
  75. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/settings_dialog.py +0 -0
  76. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/settings_tabs/__init__.py +0 -0
  77. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/settings_tabs/settings_2d_cleanup_tab.py +0 -0
  78. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/settings_tabs/settings_2d_tab.py +0 -0
  79. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/settings_tabs/settings_3d_tabs.py +0 -0
  80. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/settings_tabs/settings_labels_tab.py +0 -0
  81. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/settings_tabs/settings_other_tab.py +0 -0
  82. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/settings_tabs/settings_tab_base.py +0 -0
  83. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/string_importers.py +0 -0
  84. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/template_preview_item.py +0 -0
  85. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/template_preview_view.py +0 -0
  86. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/translation_dialog.py +0 -0
  87. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/ui_manager.py +0 -0
  88. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/user_template_dialog.py +0 -0
  89. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/view_3d_logic.py +0 -0
  90. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/ui/zoomable_view.py +0 -0
  91. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/__init__.py +0 -0
  92. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/constants.py +0 -0
  93. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/default_settings.py +0 -0
  94. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/finite_float.py +0 -0
  95. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/hit_radius.py +0 -0
  96. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/label_style.py +0 -0
  97. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/sdf_records.py +0 -0
  98. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/sip_isdeleted_safe.py +0 -0
  99. {moleditpy-5.1.3 → moleditpy-5.2.0}/src/moleditpy/utils/suppress_log.py +0 -0
  100. {moleditpy-5.1.3 → moleditpy-5.2.0}/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.1.3
3
+ Version: 5.2.0
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
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "MoleditPy"
7
7
 
8
- version = "5.1.3"
8
+ version = "5.2.0"
9
9
 
10
10
  license = "LGPL-3.0-or-later"
11
11
  license-files = ["LICENSE", "COPYING", "THIRD_PARTY_NOTICES.md", "DISTRIBUTION.md", "LICENSING.md"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MoleditPy
3
- Version: 5.1.3
3
+ Version: 5.2.0
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
@@ -10,10 +10,6 @@ Repo: https://github.com/HiroYokoyama/python_molecular_editor
10
10
  DOI: 10.5281/zenodo.17268532
11
11
  """
12
12
 
13
- print("-----------------------------------------------------")
14
- print("MoleditPy - A Python-based molecular editing software")
15
- print("-----------------------------------------------------\n")
16
-
17
13
  try:
18
14
  from .main import main # type: ignore
19
15
  except ImportError:
@@ -29,7 +29,19 @@ from .utils.constants import VERSION
29
29
  from PySide6.QtCore import QtMsgType, QThread, QTimer, qInstallMessageHandler
30
30
  from PySide6.QtWidgets import QApplication, QMessageBox
31
31
 
32
- from .ui.main_window import MainWindow
32
+ # MainWindow is imported lazily in main() to avoid paying its heavy UI
33
+ # import cost on --version/--help and --install-plugin exits.
34
+
35
+
36
+ def __getattr__(name: str) -> Any:
37
+ """Lazy-import MainWindow on first access (PEP 562)."""
38
+ if name == "MainWindow":
39
+ from .ui.main_window import MainWindow
40
+
41
+ globals()["MainWindow"] = MainWindow # cache like a real import
42
+ return MainWindow
43
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
44
+
33
45
 
34
46
  _QT_LOG_LEVEL = {
35
47
  QtMsgType.QtDebugMsg: logging.DEBUG,
@@ -259,6 +271,10 @@ def main() -> None:
259
271
  # parse_known_args so Qt's own argv flags (e.g. -platform) are passed through
260
272
  args, remaining = parser.parse_known_args()
261
273
 
274
+ print("-----------------------------------------------------")
275
+ print("MoleditPy - A Python-based molecular editing software")
276
+ print("-----------------------------------------------------\n", flush=True)
277
+
262
278
  if args.install_plugin:
263
279
  plugin_path = os.path.abspath(args.install_plugin)
264
280
  if not os.path.exists(plugin_path):
@@ -321,6 +337,8 @@ def main() -> None:
321
337
 
322
338
  app = QApplication([sys.argv[0]] + remaining)
323
339
  qInstallMessageHandler(_qt_message_handler)
340
+ # Resolves through __getattr__ unless monkeypatched (e.g. by launch-probe)
341
+ MainWindow = sys.modules[__name__].MainWindow
324
342
  window = MainWindow(initial_file=args.file, safe_mode=args.safe)
325
343
  window.show()
326
344
 
@@ -186,6 +186,14 @@ class PluginContext:
186
186
  """
187
187
  return self._manager.get_main_window()
188
188
 
189
+ @property
190
+ def moleditpy_version(self) -> str:
191
+ """Version of the running application, e.g. "5.2.0" (5.2.0 and later)."""
192
+ # Imported here: plugin test suites import this module without Qt or RDKit.
193
+ from ..utils.constants import VERSION
194
+
195
+ return VERSION
196
+
189
197
  def show_status_message(self, message: str, timeout: int = 3000) -> None:
190
198
  """
191
199
  Display a temporary message in the status bar of the main window.
@@ -308,15 +316,21 @@ class PluginContext:
308
316
  )
309
317
 
310
318
  def register_file_opener(
311
- self, extension: str, callback: Callable[[str], None], priority: int = 0
319
+ self,
320
+ extension: str,
321
+ callback: Callable[[str], Optional[bool]],
322
+ priority: int = 0,
312
323
  ) -> None:
313
324
  """
314
325
  Register a handler for opening a specific file extension.
315
326
 
316
327
  Args:
317
328
  extension: File extension including dot, e.g. ".xyz".
318
- callback: Function taking (file_path) -> None.
329
+ callback: Function taking (file_path) -> Optional[bool].
319
330
  Should load the file into the main window.
331
+ Return False to decline the file, so that the next
332
+ opener or the built-in loader is tried (5.2.0 and
333
+ later). Any other value, including None, means handled.
320
334
  priority: Higher priority handlers are tried first (default 0).
321
335
  """
322
336
  self._manager.register_file_opener(
@@ -308,8 +308,10 @@ class MainInitManager:
308
308
  for opener_info in openers:
309
309
  try:
310
310
  callback = opener_info["callback"]
311
- # Try to call the opener
312
- callback(file_path)
311
+ # Only an explicit False declines the file; None, the
312
+ # documented return of older plugins, still means handled.
313
+ if callback(file_path) is False:
314
+ continue
313
315
 
314
316
  self.current_file_path = file_path
315
317
  self.host.state_manager.update_window_title()
@@ -656,9 +656,14 @@ class PluginMenuManager:
656
656
  ext = os.path.splitext(fpath)[1].lower()
657
657
  if ext in m:
658
658
  try:
659
- m[ext](fpath)
659
+ handled = m[ext](fpath)
660
660
  except Exception:
661
661
  logging.exception("Plugin file opener error (%s)", n)
662
+ handled = False
663
+ if handled is False:
664
+ self._im.host.statusBar().showMessage(
665
+ f"{n} could not open {os.path.basename(fpath)}"
666
+ )
662
667
  return
663
668
  self._im.current_file_path = fpath
664
669
  self._im.host.state_manager.update_window_title()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes