MoleditPy-linux 2.2.4__py3-none-any.whl → 2.2.5__py3-none-any.whl

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.
@@ -16,7 +16,7 @@ from PyQt6.QtGui import QFont, QColor
16
16
  from rdkit import Chem
17
17
 
18
18
  #Version
19
- VERSION = '2.2.4'
19
+ VERSION = '2.2.5'
20
20
 
21
21
  ATOM_RADIUS = 18
22
22
  BOND_OFFSET = 3.5
@@ -596,8 +596,10 @@ class MainWindowAppState(object):
596
596
  json_data["last_successful_optimization_method"] = None
597
597
 
598
598
  # Plugin State Persistence (Phase 3)
599
+ # Start with preserved data from missing plugins
600
+ plugin_data = self._preserved_plugin_data.copy() if self._preserved_plugin_data else {}
601
+
599
602
  if self.plugin_manager and self.plugin_manager.save_handlers:
600
- plugin_data = {}
601
603
  for name, callback in self.plugin_manager.save_handlers.items():
602
604
  try:
603
605
  p_state = callback()
@@ -606,8 +608,8 @@ class MainWindowAppState(object):
606
608
  except Exception as e:
607
609
  print(f"Error saving state for plugin {name}: {e}")
608
610
 
609
- if plugin_data:
610
- json_data['plugins'] = plugin_data
611
+ if plugin_data:
612
+ json_data['plugins'] = plugin_data
611
613
 
612
614
  return json_data
613
615
 
@@ -629,14 +631,19 @@ class MainWindowAppState(object):
629
631
  self.last_successful_optimization_method = None
630
632
 
631
633
  # Plugin State Restoration (Phase 3)
632
- if "plugins" in json_data and self.plugin_manager and self.plugin_manager.load_handlers:
634
+ self._preserved_plugin_data = {} # Reset preserved data on new load
635
+ if "plugins" in json_data:
633
636
  plugin_data = json_data["plugins"]
634
637
  for name, p_state in plugin_data.items():
635
- if name in self.plugin_manager.load_handlers:
638
+ if self.plugin_manager and name in self.plugin_manager.load_handlers:
636
639
  try:
637
640
  self.plugin_manager.load_handlers[name](p_state)
638
641
  except Exception as e:
639
642
  print(f"Error loading state for plugin {name}: {e}")
643
+ else:
644
+ # No handler found (plugin disabled or missing)
645
+ # Preserve data so it's not lost on next save
646
+ self._preserved_plugin_data[name] = p_state
640
647
 
641
648
 
642
649
  # 2D構造データの復元
@@ -697,7 +704,7 @@ class MainWindowAppState(object):
697
704
  for atom in self.data.atoms.values():
698
705
  atom['item'].update_style()
699
706
  # 3D構造データの復元
700
- if "3d_structure" in json_data:
707
+ if "3d_structure" in json_data and json_data["3d_structure"] is not None:
701
708
  structure_3d = json_data["3d_structure"]
702
709
 
703
710
  # 制約データの復元 (JSONはタプルをリストとして保存するので、タプルに再変換)
@@ -264,6 +264,9 @@ class MainWindowMainInit(object):
264
264
  except Exception as e:
265
265
  print(f"Failed to initialize PluginManager: {e}")
266
266
  self.plugin_manager = None
267
+
268
+ # ロードされていないプラグインのデータを保持する辞書
269
+ self._preserved_plugin_data = {}
267
270
 
268
271
  self.init_ui()
269
272
  self.init_worker_thread()
@@ -1832,6 +1835,14 @@ class MainWindowMainInit(object):
1832
1835
  if not found_sub:
1833
1836
  current_menu = current_menu.addMenu(part)
1834
1837
 
1838
+ # If last action was NOT from a plugin, insert a separator
1839
+ actions = current_menu.actions()
1840
+ if actions:
1841
+ last_action = actions[-1]
1842
+ if not last_action.isSeparator() and last_action.data() != PLUGIN_ACTION_TAG:
1843
+ sep = current_menu.addSeparator()
1844
+ sep.setData(PLUGIN_ACTION_TAG)
1845
+
1835
1846
  # Add action
1836
1847
  action_text = text if text else parts[-1]
1837
1848
  action = QAction(action_text, self)
@@ -65,6 +65,24 @@ class PluginContext:
65
65
  """
66
66
  return self._manager.get_main_window()
67
67
 
68
+ @property
69
+ def current_molecule(self) -> Any:
70
+ """
71
+ Get or set the current molecule (RDKit Mol object).
72
+ """
73
+ mw = self._manager.get_main_window()
74
+ if mw:
75
+ return mw.current_mol
76
+ return None
77
+
78
+ @current_molecule.setter
79
+ def current_molecule(self, mol: Any):
80
+ mw = self._manager.get_main_window()
81
+ if mw:
82
+ mw.current_mol = mol
83
+ if hasattr(mw, 'draw_molecule_3d'):
84
+ mw.draw_molecule_3d(mol)
85
+
68
86
  def add_export_action(self, label: str, callback: Callable):
69
87
  """
70
88
  Register a custom export action.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MoleditPy-linux
3
- Version: 2.2.4
3
+ Version: 2.2.5
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: GNU GENERAL PUBLIC LICENSE
@@ -706,7 +706,9 @@ This is the Linux version of MoleditPy. The Open Babel fallback is disabled due
706
706
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.17268532.svg)](https://doi.org/10.5281/zenodo.17268532)
707
707
  [![Powered by RDKit](https://img.shields.io/badge/Powered%20by-RDKit-3838ff.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEXc3NwUFP8UPP9kZP+MjP+0tP////9ZXZotAAAAAXRSTlMAQObYZgAAAAFiS0dEBmFmuH0AAAAHdElNRQfmAwsPGi+MyC9RAAAAQElEQVQI12NgQABGQUEBMENISUkRLKBsbGwEEhIyBgJFsICLC0iIUdnExcUZwnANQWfApKCK4doRBsKtQFgKAQC5Ww1JEHSEkAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wMy0xMVQxNToyNjo0NyswMDowMDzr2J4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDMtMTFUMTU6MjY6NDcrMDA6MDBNtmAiAAAAAElFTkSuQmCC)](https://www.rdkit.org/)
708
708
 
709
- **MoleditPy** is a cross-platform, intuitive molecular editor built in Python. It provides a seamless workflow for drawing 2D molecular structures, visualizing them in 3D, and performing interactive geometric manipulations. Its powerful editing and export capabilities make it an ideal tool for preparing input files for DFT calculation software.
709
+ [🇯🇵 日本語 (Japanese)](#japanese)
710
+
711
+ **MoleditPy** is a **programmable** and cross-platform molecular editor built in Python. It streamlines the workflow from 2D drawing to 3D visualization, making it an **ideal tool for rapidly preparing input files for DFT calculations**. Designed as an **open platform**, it also allows users to freely extend its capabilities, writing custom Python scripts to manipulate molecular data, automate tasks, or integrate new cheminformatics algorithms seamlessly.
710
712
 
711
713
  **Author**: HiroYokoyama
712
714
  **License**: GPL-v3
@@ -715,7 +717,7 @@ This is the Linux version of MoleditPy. The Open Babel fallback is disabled due
715
717
  -----
716
718
  ![](img/icon.png)
717
719
  ![](img/screenshot.png)
718
- -----
720
+
719
721
 
720
722
  ## Overview
721
723
 
@@ -760,7 +762,14 @@ This application combines a modern GUI built with **PyQt6**, powerful cheminform
760
762
  * Import structures from **MOL/SDF** files or **SMILES** strings.
761
763
  * Export 3D structures to **MOL** or **XYZ** formats, which are compatible with most DFT calculation software.
762
764
  * Export 2D and 3D views as high-resolution PNG images.
763
- * **Plugin System:** Extend functionality with Python scripts. Place custom scripts in `~/.moleditpy/plugins` to add new features to the "Plugin" menu.
765
+ * Export 2D and 3D views as high-resolution PNG images.
766
+
767
+ ### 4. Programmable & Extensible
768
+
769
+ * **Python Plugin System:** Drop your Python scripts into the plugin folder, and they instantly become part of the application menu.
770
+ * **Downloadable Plugins:** Explore and download specialized plugins from the [Plugin Explorer](https://hiroyokoyama.github.io/moleditpy-plugins/explorer/).
771
+ * **Full API Access:** Plugins have direct access to the `MainWindow`, `RDKit` molecule objects, and `PyGraphics` items, allowing for limitless customization.
772
+ * **Rapid Prototyping:** Ideal for researchers who need to test new algorithms or workflow automations on the fly.
764
773
 
765
774
  ## Installation and Execution
766
775
 
@@ -822,9 +831,11 @@ This project is licensed under the **GNU General Public License v3.0 (GPL-v3)**.
822
831
 
823
832
  -----
824
833
 
834
+ <div id="japanese"></div>
835
+
825
836
  # MoleditPy — A Python Molecular Editor
826
837
 
827
- **MoleditPy**は、Pythonで構築されたクロスプラットフォームかつ直感的な分子エディターです。2Dでの分子描画から3D構造の可視化・編集、さらにはインタラクティブな幾何学的操作まで、シームレスなワークフローを提供します。その強力な編集機能とエクスポート機能により、**DFT計算ソフトウェアのインプット作成に最適なツール**です。
838
+ **MoleditPy**は、Pythonで構築された**機能拡張が自由自在な**分子エディタープラットフォームです。2D描画から3Dへの変換により、**DFT計算用インプットの迅速な作成に最適なツール**であると同時に、**Pythonスクリプトを用いて必要な機能をユーザー自身が手軽に追加・開発できる**柔軟な環境を提供します。
828
839
 
829
840
  **作者**: HiroYokoyama
830
841
  **ライセンス**: GPL-v3
@@ -875,7 +886,14 @@ This project is licensed under the **GNU General Public License v3.0 (GPL-v3)**.
875
886
  * **MOL/SDF**ファイルや**SMILES**文字列から構造をインポートできます。
876
887
  * 3D構造を**MOL**または**XYZ**形式でエクスポートでき、これらは多くのDFT計算ソフトウェアと互換性があります。
877
888
  * 2Dおよび3Dビューを高解像度のPNG画像としてエクスポートできます。
878
- * **プラグインシステム:** Pythonスクリプトで機能を拡張できます。`~/.moleditpy/plugins` にスクリプトを配置することで、「Plugin」メニューに独自の機能を追加できます。
889
+ * 2Dおよび3Dビューを高解像度のPNG画像としてエクスポートできます。
890
+
891
+ ### 4. プログラマブルで拡張可能
892
+
893
+ * **Pythonプラグインシステム:** Pythonスクリプトをプラグインフォルダに入れるだけで、即座にアプリケーションメニューの一部として機能します。
894
+ * **プラグインのダウンロード:** [Plugin Explorer](https://hiroyokoyama.github.io/moleditpy-plugins/explorer/) から特化したプラグインを探索・ダウンロードできます。
895
+ * **フルAPIアクセス:** プラグインは `MainWindow`、`RDKit` 分子オブジェクト、`PyGraphics` アイテムに直接アクセスでき、無限のカスタマイズが可能です。
896
+ * **迅速なプロトタイピング:** 新しいアルゴリズムやワークフローの自動化をその場でテストしたい研究者に最適です。
879
897
 
880
898
  ## インストールと実行
881
899
 
@@ -12,20 +12,20 @@ moleditpy_linux/modules/bond_item.py,sha256=eVkEeKvM4igYI67DYxpey3FllqDyt_iWDo4V
12
12
  moleditpy_linux/modules/bond_length_dialog.py,sha256=k5x_DhK9Q8CSwouKhEo_kLRRdaYHDaK84KDNmuDNLvY,14868
13
13
  moleditpy_linux/modules/calculation_worker.py,sha256=KiGQY7i-QCQofEoE0r65KoQgpEGFcbhmxWv6egfkUdc,42324
14
14
  moleditpy_linux/modules/color_settings_dialog.py,sha256=Ow44BhCOLo0AFb6klO001k6B4drOgKX9DeNBQhZLp5o,15474
15
- moleditpy_linux/modules/constants.py,sha256=FZjG-RLZs_Xqn8D7MDAGKZAJY4G44Bh2Nm2qnDTFXm8,4702
15
+ moleditpy_linux/modules/constants.py,sha256=DVxFJrPqhASSlFj9fRpsOe8RiJc2lJqTJMQtmnUCIqg,4702
16
16
  moleditpy_linux/modules/constrained_optimization_dialog.py,sha256=IEdNVhFoNSEMeA5ABpUH9Q88-YzDXFloQM2gwnPwnHY,30150
17
17
  moleditpy_linux/modules/custom_interactor_style.py,sha256=NjsXE2a43IDNEanZBlcG9eR4ZIERT1MsQC6lbfesapQ,38453
18
18
  moleditpy_linux/modules/custom_qt_interactor.py,sha256=MFaTuDh-FPeFBS4303CqxsxmsOIOW4QXUz6USwI8PHQ,2451
19
19
  moleditpy_linux/modules/dialog3_d_picking_mixin.py,sha256=2Sut0J5ltXMtrUJ9R3o1oZ4ysed27mdSIqLpWxmGdyM,5037
20
20
  moleditpy_linux/modules/dihedral_dialog.py,sha256=rgry7LqyX9JMAR7d82QSroTPoKT3xz18EgKN1GzYZx4,18088
21
21
  moleditpy_linux/modules/main_window.py,sha256=IL8dH3qPx2TkPgO7amuDgjlFoadh5J59xYUEVhlNZqA,36338
22
- moleditpy_linux/modules/main_window_app_state.py,sha256=DmBfzurTftUIkPZu8465YnxL8Hdx2vHYSbyWdB-kvjs,34757
22
+ moleditpy_linux/modules/main_window_app_state.py,sha256=8YDcGNCSpLTO1NGL9tEvNkXpUcS7JW-uK7TdUGvEqnk,35189
23
23
  moleditpy_linux/modules/main_window_compute.py,sha256=ipIkhH_DONXDnPzh7xeym9X-Yfx8EhsvXYOdyxsAj4c,53347
24
24
  moleditpy_linux/modules/main_window_dialog_manager.py,sha256=9ZVy5-dlk8SjGU5R6NtbaVZuBQfVK5Nwrc633pEzjq8,19955
25
25
  moleditpy_linux/modules/main_window_edit_3d.py,sha256=CUArB5wcsgq1C7LygAEC6URlbnn4RhRYDa5n-Y-etWI,19731
26
26
  moleditpy_linux/modules/main_window_edit_actions.py,sha256=-SDLoMQ7S-3u3eBUb-w7BU7OAsFkhQ9ZBjF3Y2jGgZc,64708
27
27
  moleditpy_linux/modules/main_window_export.py,sha256=dSVfylsybDDboDuXU9Inotf6YkrKJwgBTqGYSfq1lRE,38241
28
- moleditpy_linux/modules/main_window_main_init.py,sha256=ZxScNJI-OVx_ki5C37fY4Dmm9IIm5eJWVwd7jIKu8ms,90606
28
+ moleditpy_linux/modules/main_window_main_init.py,sha256=Shxs8_vVa7PhfhVZdHYtPniItLHKJ3i9wcamcVofvso,91172
29
29
  moleditpy_linux/modules/main_window_molecular_parsers.py,sha256=KR6vzuqc3nutOcorpYr0QOyX3MFBcxTwDhZX96VgJ9Q,48291
30
30
  moleditpy_linux/modules/main_window_project_io.py,sha256=TWwtuKDuvgcvPZ9IGmW8r1EJJOrgxrIJRnxe_f4C1oM,17149
31
31
  moleditpy_linux/modules/main_window_string_importers.py,sha256=v47wOd4RtjKYcF-aLP-mogGGdYTpTEo3dDyAu79_5MM,10782
@@ -38,7 +38,7 @@ moleditpy_linux/modules/molecule_scene.py,sha256=khdt7h9Mk_D1cMbYeHGtq7P9aFXo0xG
38
38
  moleditpy_linux/modules/move_group_dialog.py,sha256=65HVXTJSaQ9lp03XFhI1l7OzUsXmH_aqd8OgwjpjfGg,27174
39
39
  moleditpy_linux/modules/periodic_table_dialog.py,sha256=ItEZUts1XCietz9paY-spvbzxh6SXak3GnikwqkHZCw,4006
40
40
  moleditpy_linux/modules/planarize_dialog.py,sha256=yY8o-SxT8vGEHVWnjDTXecRv5NUaEejEsXH-836Xk8g,8681
41
- moleditpy_linux/modules/plugin_interface.py,sha256=W6Hw1OLqMkcg8XU-S347v2sDBMEoo6iiCSbmL6MjZrA,7639
41
+ moleditpy_linux/modules/plugin_interface.py,sha256=srzPZ3a_aRTx28NAvWNKRVUDYQNfQOTcjzx-5YW2Pb4,8164
42
42
  moleditpy_linux/modules/plugin_manager.py,sha256=cxbqIE7Rb_KeBd-cG1vF2ySY2qNx8IJVRXjVPyQMFDc,13457
43
43
  moleditpy_linux/modules/plugin_manager_window.py,sha256=UeoPQWTxmckoFIQAuv9jVBzok_9gEKEm9c7JsKRX0P4,10135
44
44
  moleditpy_linux/modules/settings_dialog.py,sha256=Nr7yE8UmYRi3VObWvRlrnv0DnjSjmYXbvqryZ02O12k,65348
@@ -47,12 +47,13 @@ moleditpy_linux/modules/template_preview_view.py,sha256=4OCHZDO51BvJpKdfrBWJ4_4W
47
47
  moleditpy_linux/modules/translation_dialog.py,sha256=aWlgTR9mtEMbzGIY1SoQhDltsX-01LtCxjqy5NWtGuA,14663
48
48
  moleditpy_linux/modules/user_template_dialog.py,sha256=2hARO04DaILgdExx5ubL0GPsxK95VvVRqy7fNfudD_M,30843
49
49
  moleditpy_linux/modules/zoomable_view.py,sha256=hjwljui13QpvjvxJHY4Evot4jMQvxRBQUNH5HUlyFOk,5966
50
+ moleditpy_linux/modules/assets/file_icon.ico,sha256=yyVj084A7HuMNbV073cE_Ag3Ne405qgOP3Mia1ZqLpE,101632
50
51
  moleditpy_linux/modules/assets/icon.icns,sha256=wD5R6-Vw7K662tVKhu2E1ImN0oUuyAP4youesEQsn9c,139863
51
52
  moleditpy_linux/modules/assets/icon.ico,sha256=RfgFcx7-dHY_2STdsOQCQziY5SNhDr3gPnjO6jzEDPI,147975
52
53
  moleditpy_linux/modules/assets/icon.png,sha256=kCFN1WacYIdy0GN6SFEbNA00ef39pCczBnFdkkBI8Bs,147110
53
- moleditpy_linux-2.2.4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
54
- moleditpy_linux-2.2.4.dist-info/METADATA,sha256=dIsDl6OWhQ_BAlFFaYll51SyZqs7Qm4-T0tENUokPbE,59354
55
- moleditpy_linux-2.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
56
- moleditpy_linux-2.2.4.dist-info/entry_points.txt,sha256=-OzipSi__yVwlimNtu3eiRP5t5UMg55Cs0udyhXYiyw,60
57
- moleditpy_linux-2.2.4.dist-info/top_level.txt,sha256=qyqe-hDYL6CXyin9E5Me5rVl3PG84VqiOjf9bQvfJLs,16
58
- moleditpy_linux-2.2.4.dist-info/RECORD,,
54
+ moleditpy_linux-2.2.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
55
+ moleditpy_linux-2.2.5.dist-info/METADATA,sha256=OSFWNBWdHFd_AkChJlQU61D4gzMquTUHun4pgffZndU,60708
56
+ moleditpy_linux-2.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
57
+ moleditpy_linux-2.2.5.dist-info/entry_points.txt,sha256=-OzipSi__yVwlimNtu3eiRP5t5UMg55Cs0udyhXYiyw,60
58
+ moleditpy_linux-2.2.5.dist-info/top_level.txt,sha256=qyqe-hDYL6CXyin9E5Me5rVl3PG84VqiOjf9bQvfJLs,16
59
+ moleditpy_linux-2.2.5.dist-info/RECORD,,