MoleditPy-linux 4.2.0__py3-none-any.whl → 4.2.1__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.
@@ -485,12 +485,18 @@ class PluginManager:
485
485
  self, plugin_name: str, method_name: str, callback: Callable
486
486
  ) -> None:
487
487
  """Register a named 3D optimization method provided by a plugin."""
488
- # Key by upper-case method name for consistency
489
- self.optimization_methods[method_name.upper()] = {
488
+ method_key = method_name.upper()
489
+ self.optimization_methods[method_key] = {
490
490
  "plugin": plugin_name,
491
491
  "callback": callback,
492
492
  "label": method_name,
493
493
  }
494
+ if hasattr(self.main_window, "init_manager") and hasattr(
495
+ self.main_window.init_manager, "add_optimization_method"
496
+ ):
497
+ self.main_window.init_manager.add_optimization_method(
498
+ method_name, method_key
499
+ )
494
500
 
495
501
  def register_file_opener(
496
502
  self, plugin_name: str, extension: str, callback: Callable, priority: int = 0
@@ -178,20 +178,10 @@ class ComputeManager:
178
178
  return
179
179
 
180
180
  menu = QMenu(self.host)
181
- opt_list = [
182
- ("MMFF94s (RDKit)", "MMFF_RDKIT"),
183
- ("MMFF94 (RDKit)", "MMFF94_RDKIT"),
184
- ("UFF (RDKit)", "UFF_RDKIT"),
185
- ("MMFF94s (Open Babel)", "MMFF94s_OBABEL"),
186
- ("MMFF94 (Open Babel)", "MMFF94_OBABEL"),
187
- ("UFF (Open Babel)", "UFF_OBABEL"),
188
- ("GAFF (Open Babel)", "GAFF_OBABEL"),
189
- ("Ghemical (Open Babel)", "GHEMICAL_OBABEL"),
190
- ]
191
- for label, key in opt_list:
181
+ for key, source_action in self.host.init_manager.opt3d_actions.items():
182
+ label = source_action.text().replace("&", "")
192
183
  a = QAction(label, self.host)
193
- if key in self.host.init_manager.opt3d_actions:
194
- a.setEnabled(self.host.init_manager.opt3d_actions[key].isEnabled())
184
+ a.setEnabled(source_action.isEnabled())
195
185
  a.triggered.connect(
196
186
  lambda checked=False, k=key: self._trigger_optimize_with_temp_method(k)
197
187
  )
@@ -1648,7 +1648,7 @@ class MainInitManager:
1648
1648
  self.conv_actions[saved_conv].setChecked(True)
1649
1649
  self.settings["3d_conversion_mode"] = saved_conv
1650
1650
 
1651
- optimization_menu = settings_menu.addMenu("3D Optimization Settings")
1651
+ self.optimization_menu = settings_menu.addMenu("3D Optimization Settings")
1652
1652
  opt_methods = [
1653
1653
  ("MMFF94s (RDKit)", "MMFF_RDKIT"),
1654
1654
  ("MMFF94 (RDKit)", "MMFF94_RDKIT"),
@@ -1660,8 +1660,8 @@ class MainInitManager:
1660
1660
  ("Ghemical (Open Babel)", "GHEMICAL_OBABEL"),
1661
1661
  ]
1662
1662
  self.opt3d_method_labels = {key.upper(): label for (label, key) in opt_methods}
1663
- opt_group = QActionGroup(self.host)
1664
- opt_group.setExclusive(True)
1663
+ self.opt_group = QActionGroup(self.host)
1664
+ self.opt_group.setExclusive(True)
1665
1665
  self.opt3d_actions = {}
1666
1666
  for label, key in opt_methods:
1667
1667
  action = QAction(label, self.host)
@@ -1672,11 +1672,11 @@ class MainInitManager:
1672
1672
  lambda checked,
1673
1673
  m=key: self.host.compute_manager.set_optimization_method(m)
1674
1674
  )
1675
- optimization_menu.addAction(action)
1676
- opt_group.addAction(action)
1675
+ self.optimization_menu.addAction(action)
1676
+ self.opt_group.addAction(action)
1677
1677
  self.opt3d_actions[key] = action
1678
1678
 
1679
- optimization_menu.addSeparator()
1679
+ self.opt3d_separator = self.optimization_menu.addSeparator()
1680
1680
  self.host.intermolecular_rdkit_action = QAction(
1681
1681
  "Consider Intermolecular Interaction for RDKit", self.host
1682
1682
  )
@@ -1687,7 +1687,7 @@ class MainInitManager:
1687
1687
  self.host.intermolecular_rdkit_action.triggered.connect(
1688
1688
  self.host.compute_manager.toggle_intermolecular_interaction_rdkit
1689
1689
  )
1690
- optimization_menu.addAction(self.host.intermolecular_rdkit_action)
1690
+ self.optimization_menu.addAction(self.host.intermolecular_rdkit_action)
1691
1691
 
1692
1692
  saved_opt = (self.settings.get("optimization_method") or "MMFF_RDKIT").upper()
1693
1693
  if (
@@ -1705,6 +1705,24 @@ class MainInitManager:
1705
1705
  reset_settings_action.triggered.connect(self.reset_all_settings_menu)
1706
1706
  settings_menu.addAction(reset_settings_action)
1707
1707
 
1708
+ def add_optimization_method(self, label: str, key: str) -> None:
1709
+ """Dynamically add an optimization method to the menu."""
1710
+ key_upper = key.upper()
1711
+ if key_upper in self.opt3d_actions:
1712
+ return
1713
+
1714
+ self.opt3d_method_labels[key_upper] = label
1715
+ action = QAction(label, self.host)
1716
+ action.setCheckable(True)
1717
+ action.triggered.connect(
1718
+ lambda checked,
1719
+ m=key_upper: self.host.compute_manager.set_optimization_method(m)
1720
+ )
1721
+
1722
+ self.optimization_menu.insertAction(self.opt3d_separator, action)
1723
+ self.opt_group.addAction(action)
1724
+ self.opt3d_actions[key_upper] = action
1725
+
1708
1726
  def _init_help_menu(self, menu_bar: Any) -> None:
1709
1727
  """Initialize the Help menu."""
1710
1728
  help_menu = menu_bar.addMenu("&Help")
@@ -81,6 +81,7 @@ class PluginMenuManager:
81
81
  self.integrate_plugin_export_actions()
82
82
  self.integrate_plugin_file_openers()
83
83
  self.integrate_plugin_analysis_tools()
84
+ self.integrate_plugin_optimization_methods()
84
85
 
85
86
  def rebuild_plugin_menus(self) -> None:
86
87
  """Fully rebuild all plugin-managed UI after an install/uninstall.
@@ -120,6 +121,7 @@ class PluginMenuManager:
120
121
  (self.integrate_plugin_file_openers, "file openers"),
121
122
  (self.integrate_plugin_analysis_tools, "analysis tools"),
122
123
  (self.update_style_menu_with_plugins, "style menu"),
124
+ (self.integrate_plugin_optimization_methods, "optimization methods"),
123
125
  ]:
124
126
  try:
125
127
  method()
@@ -366,6 +368,16 @@ class PluginMenuManager:
366
368
  a.setData(PLUGIN_ACTION_TAG)
367
369
  menu.addAction(a)
368
370
 
371
+ def integrate_plugin_optimization_methods(self) -> None:
372
+ """Inject plugin optimization methods into the 3D Optimization Settings menu."""
373
+ if not hasattr(self._im.host.plugin_manager, "optimization_methods"):
374
+ return
375
+
376
+ for key, entry in self._im.host.plugin_manager.optimization_methods.items():
377
+ self._im.add_optimization_method(entry["label"], key)
378
+ if key in self._im.opt3d_actions:
379
+ self._im.opt3d_actions[key].setData("plugin_managed")
380
+
369
381
  def integrate_plugin_file_openers(self) -> None:
370
382
  """Inject plugin file-opener entries into the File > Import menu."""
371
383
  if not self._im.host.plugin_manager.file_openers:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MoleditPy-linux
3
- Version: 4.2.0
3
+ Version: 4.2.1
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
@@ -10,7 +10,7 @@ moleditpy_linux/core/mol_geometry.py,sha256=PzdJGxWs6vXwVyILBG6-6qhiVYuB33YTr8lc
10
10
  moleditpy_linux/core/molecular_data.py,sha256=CboEOZMjtbyRSQ7-f6kj0jngUM0Tw-7L6lU9eDtdycQ,18606
11
11
  moleditpy_linux/plugins/__init__.py,sha256=BEOaCz93HzgTe0FhBzSj6Sfk8MAWxcY9vCDGmOriJx4,267
12
12
  moleditpy_linux/plugins/plugin_interface.py,sha256=OT3K0yIZQA3HaJlavOj6wlUwS7EnEJaOhWqi1WVjD0M,22066
13
- moleditpy_linux/plugins/plugin_manager.py,sha256=FM_Y-5jwQ-FU_043JSvYQIXFPIfPClXStJY3H_-k0_I,31776
13
+ moleditpy_linux/plugins/plugin_manager.py,sha256=LeuqJdIkeqYy1SbL8JLJoKDepbdkYXG1SPus4dK15RE,32025
14
14
  moleditpy_linux/plugins/plugin_manager_window.py,sha256=ot4ftAR8GA6mn6PMuYYgMGyqqabEmtP7EVYEnxCeDDU,13432
15
15
  moleditpy_linux/ui/__init__.py,sha256=_BslFbhSM4Ba4GDzH1XpvlqlGgvi4OFkcuU3pPeIz3s,751
16
16
  moleditpy_linux/ui/about_dialog.py,sha256=saCFGcJXoWTIwWkH3iwIPy9dRy-zlgVUKfN6x2E1S2Y,4552
@@ -26,7 +26,7 @@ moleditpy_linux/ui/bond_item.py,sha256=8qm15z3OVflCtkVXRfbPGRtZidAduyZ6Yuxci3-Ed
26
26
  moleditpy_linux/ui/bond_length_dialog.py,sha256=lss8J2g_pUK-BCbqWk25JMFsn-g8SxBjiBp8mZrn57I,15930
27
27
  moleditpy_linux/ui/calculation_worker.py,sha256=bwrzCW5935Twe5EY7Mtd35YQaWJILvBPwzPIQgmqz98,41849
28
28
  moleditpy_linux/ui/color_settings_dialog.py,sha256=RFp8h0R1yC8YwqOxc972Da9xO95Gu-0qywAAEeXMj4E,14224
29
- moleditpy_linux/ui/compute_logic.py,sha256=7ztFNIAgKZaS1oqwpOYRx4uXZQ2dBJExSSLYaOaaR8A,29888
29
+ moleditpy_linux/ui/compute_logic.py,sha256=7wlouTcU1qYG9srl1YyLIXZLUgxlKqTJvboP2A4aL4E,29454
30
30
  moleditpy_linux/ui/constrained_optimization_dialog.py,sha256=JexsKDqwogdJMKxdDyI-xce3fPq27tsCZdzl2uyXuDc,35980
31
31
  moleditpy_linux/ui/custom_interactor_style.py,sha256=8UzJ7tItbsPTSlxe69P8wLB9uOeWG2o1PpJpriRvI3M,44414
32
32
  moleditpy_linux/ui/custom_qt_interactor.py,sha256=AZ5TtQjWUs4F5FFg-tBUZQlbk74UHboTjYpBQRUlhvQ,3827
@@ -39,7 +39,7 @@ moleditpy_linux/ui/export_logic.py,sha256=97NrR6lC8U7ChN2EyOuTrl1vHB6g6xuL1BeJmY
39
39
  moleditpy_linux/ui/geometry_base_dialog.py,sha256=jj9uI2cexEjC3WxFm8HAlsrGUcTX6lQv-BX70hkSW7o,4472
40
40
  moleditpy_linux/ui/io_logic.py,sha256=cGXrECHoCkGIJ7HUZpbm4SrE-Ewmsn6b5nj4V1qsi-M,45975
41
41
  moleditpy_linux/ui/main_window.py,sha256=ygYEMJfQQ5Y2-nCMzEym2epOsMRX9JwArB_cyEp3SM4,12551
42
- moleditpy_linux/ui/main_window_init.py,sha256=HtjbGE0ogwABJfMLZVdjpVy4kmzxcN3mUYxLwSErXiI,75914
42
+ moleditpy_linux/ui/main_window_init.py,sha256=hNo2uRcjGhZBHywvE-kuY25QEIyUCAq39gsK88iKwtM,76664
43
43
  moleditpy_linux/ui/mirror_dialog.py,sha256=iRt5rRVJ4gY2Ha5BlEoYv0D_HJpVXaQz4nqsHPlZ-9c,5210
44
44
  moleditpy_linux/ui/molecular_scene_handler.py,sha256=w2TYkJFtsQzQHIfKDQbByoSxmEHOlUrfb5vYvs6-dw4,69793
45
45
  moleditpy_linux/ui/molecule_scene.py,sha256=BnYZipB9zZN76mLK3bVro_CroTo166oTz5K7obObYFA,44084
@@ -47,7 +47,7 @@ moleditpy_linux/ui/move_group_dialog.py,sha256=W5Tk2OgKAApXuEqHoB-gY6RsDerRbC3_C
47
47
  moleditpy_linux/ui/move_selected_atoms_dialog.py,sha256=NJbYZ8-DHBD7jpqlkyWKNhW7gCYpzfRXjfniPpijC5w,29654
48
48
  moleditpy_linux/ui/periodic_table_dialog.py,sha256=yadE1bbJaObAiIfpKwANqiDOBI8R3yOHvDTZYrw1J4Q,6134
49
49
  moleditpy_linux/ui/planarize_dialog.py,sha256=qWMokIKDjsuC2KY-s00nrHflIr3uw4XAcwWftNFleek,7951
50
- moleditpy_linux/ui/plugin_menu_manager.py,sha256=MmUjXE7tKisaRZhBlvSnEky3pKI6UhyRWoc8EQscqUs,19211
50
+ moleditpy_linux/ui/plugin_menu_manager.py,sha256=hwp2XWMknQp5R4vsZqwDDXlVk90hvgdVQr1PNhU1qr0,19874
51
51
  moleditpy_linux/ui/settings_dialog.py,sha256=tAw-Ko73oBG5o8jnsiK4MiPar88GxiAkcnE5h6aUlYo,7319
52
52
  moleditpy_linux/ui/string_importers.py,sha256=cgsMoIYRKKP-RZZzhcpCdlDqr8KJgmazZdJ7C3GCSaE,8078
53
53
  moleditpy_linux/ui/template_preview_item.py,sha256=exJ4r3qmLOCQrEgl9ktNu4zTrgqixZcq82rUb9flWiM,7743
@@ -68,9 +68,9 @@ moleditpy_linux/utils/default_settings.py,sha256=6Q3Gw1vyG7uk-35yBtr1sKeJVnOjb4S
68
68
  moleditpy_linux/utils/sip_isdeleted_safe.py,sha256=aXoW_PDHAsu0SkqcvkUZAsWDhl9Ka8-VnzgNE5ub41Y,1215
69
69
  moleditpy_linux/utils/suppress_log.py,sha256=EFkN79q6QfYXAuii8g1fBuvFJrnVsio3aFTKMvAmXW4,928
70
70
  moleditpy_linux/utils/system_utils.py,sha256=j1RAiiKXg3N-rjpTh7yxKVAYED_kUJy4aVrY-9Hh0Mc,2674
71
- moleditpy_linux-4.2.0.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
72
- moleditpy_linux-4.2.0.dist-info/METADATA,sha256=jUeLrGfPa4qMT5iS3nUOyJGtp4X8ufPGn7lTwcwtCrE,64474
73
- moleditpy_linux-4.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
74
- moleditpy_linux-4.2.0.dist-info/entry_points.txt,sha256=-OzipSi__yVwlimNtu3eiRP5t5UMg55Cs0udyhXYiyw,60
75
- moleditpy_linux-4.2.0.dist-info/top_level.txt,sha256=qyqe-hDYL6CXyin9E5Me5rVl3PG84VqiOjf9bQvfJLs,16
76
- moleditpy_linux-4.2.0.dist-info/RECORD,,
71
+ moleditpy_linux-4.2.1.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
72
+ moleditpy_linux-4.2.1.dist-info/METADATA,sha256=rJnUldrcCJldKgN73wnkjKz54_xuehFDEp1z35l5wuM,64474
73
+ moleditpy_linux-4.2.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
74
+ moleditpy_linux-4.2.1.dist-info/entry_points.txt,sha256=-OzipSi__yVwlimNtu3eiRP5t5UMg55Cs0udyhXYiyw,60
75
+ moleditpy_linux-4.2.1.dist-info/top_level.txt,sha256=qyqe-hDYL6CXyin9E5Me5rVl3PG84VqiOjf9bQvfJLs,16
76
+ moleditpy_linux-4.2.1.dist-info/RECORD,,