MoleditPy-linux 2.3.2__py3-none-any.whl → 2.3.3__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.3.2'
19
+ VERSION = '2.3.3'
20
20
 
21
21
  ATOM_RADIUS = 18
22
22
  BOND_OFFSET = 3.5
@@ -641,6 +641,10 @@ class MainWindowEditActions(object):
641
641
  # アプリケーションのイベントループを強制的に処理し、画面の再描画を確実に行う
642
642
  QApplication.processEvents()
643
643
 
644
+ # Call plugin document reset handlers
645
+ if hasattr(self, 'plugin_manager') and self.plugin_manager:
646
+ self.plugin_manager.invoke_document_reset_handlers()
647
+
644
648
  self.statusBar().showMessage("Cleared all data.")
645
649
 
646
650
 
@@ -1851,6 +1851,11 @@ class MainWindowMainInit(object):
1851
1851
  action_text = text if text else parts[-1]
1852
1852
  action = QAction(action_text, self)
1853
1853
  action.triggered.connect(callback)
1854
+
1855
+ # Apply shortcut if provided
1856
+ if action_def.get('shortcut'):
1857
+ action.setShortcut(QKeySequence(action_def['shortcut']))
1858
+
1854
1859
  action.setData(PLUGIN_ACTION_TAG) # TAG THE ACTION
1855
1860
  current_menu.addAction(action)
1856
1861
 
@@ -168,6 +168,16 @@ class PluginContext:
168
168
  """
169
169
  self._manager.register_3d_style(self._plugin_name, style_name, callback)
170
170
 
171
+ def register_document_reset_handler(self, callback: Callable[[], None]):
172
+ """
173
+ Register a callback to be called when a new document is created (File→New).
174
+
175
+ Args:
176
+ callback: Function with no arguments that resets plugin state.
177
+ """
178
+ self._manager.register_document_reset_handler(self._plugin_name, callback)
179
+
180
+
171
181
 
172
182
 
173
183
 
@@ -51,6 +51,7 @@ class PluginManager:
51
51
  self.save_handlers = {}
52
52
  self.load_handlers = {}
53
53
  self.custom_3d_styles = {} # style_name -> {'plugin': name, 'callback': func}
54
+ self.document_reset_handlers = [] # List of callbacks to call on new document
54
55
 
55
56
  def get_main_window(self):
56
57
  return self.main_window
@@ -182,6 +183,7 @@ class PluginManager:
182
183
  self.save_handlers = {}
183
184
  self.load_handlers = {}
184
185
  self.custom_3d_styles = {}
186
+ self.document_reset_handlers = []
185
187
 
186
188
  if not os.path.exists(self.plugin_dir):
187
189
  return []
@@ -378,6 +380,21 @@ class PluginManager:
378
380
  self.custom_3d_styles[style_name] = {
379
381
  'plugin': plugin_name, 'callback': callback
380
382
  }
383
+
384
+ def register_document_reset_handler(self, plugin_name, callback):
385
+ """Register callback to be invoked when a new document is created."""
386
+ self.document_reset_handlers.append({
387
+ 'plugin': plugin_name,
388
+ 'callback': callback
389
+ })
390
+
391
+ def invoke_document_reset_handlers(self):
392
+ """Call all registered document reset handlers."""
393
+ for handler in self.document_reset_handlers:
394
+ try:
395
+ handler['callback']()
396
+ except Exception as e:
397
+ print(f"Error in document reset handler for {handler['plugin']}: {e}")
381
398
 
382
399
  def get_plugin_info_safe(self, file_path):
383
400
  """Extracts plugin metadata using AST parsing (safe, no execution)."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MoleditPy-linux
3
- Version: 2.3.2
3
+ Version: 2.3.3
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
@@ -12,7 +12,7 @@ moleditpy_linux/modules/bond_item.py,sha256=eVkEeKvM4igYI67DYxpey3FllqDyt_iWDo4V
12
12
  moleditpy_linux/modules/bond_length_dialog.py,sha256=6bFPGssnqlgINuqpxLv-OhjMH3_hspnaH8QtorAyu2M,14782
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=wUyC8vBN2vsqgv6G_qfzdsCX3tOihY0xDCGYB9_B1O0,4702
15
+ moleditpy_linux/modules/constants.py,sha256=ehyCNblUR4uHs1xVpBAzY2-tQuuF05_6vGY7OYFTfbE,4702
16
16
  moleditpy_linux/modules/constrained_optimization_dialog.py,sha256=REsk4ePsqNmAGPMTS_jckeM7jexrU3krwun8sKqKUCs,30062
17
17
  moleditpy_linux/modules/custom_interactor_style.py,sha256=LDNODMJoNHGe1AUSrvqv6PdeJm-hpPmSpWINppnJLt0,38942
18
18
  moleditpy_linux/modules/custom_qt_interactor.py,sha256=vCZsDfRO-FtphD5cTP7Ps-5rpHZMIGloaoe6EaKzrsw,4139
@@ -23,9 +23,9 @@ moleditpy_linux/modules/main_window_app_state.py,sha256=8YDcGNCSpLTO1NGL9tEvNkXp
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=QR96LqHAPSOShXbc9cK-Ffq8a16JrXAoMKB0pHjESrQ,20072
25
25
  moleditpy_linux/modules/main_window_edit_3d.py,sha256=CUArB5wcsgq1C7LygAEC6URlbnn4RhRYDa5n-Y-etWI,19731
26
- moleditpy_linux/modules/main_window_edit_actions.py,sha256=yEc0Nw-VpN0P4e4neUu7pDuUHPGEcu6eFmwWFrSBIQ8,64815
26
+ moleditpy_linux/modules/main_window_edit_actions.py,sha256=MtCFmbKVAIMrm6hp0rUUNCQ37xYzE8MerVR7d1Coutk,65007
27
27
  moleditpy_linux/modules/main_window_export.py,sha256=dSVfylsybDDboDuXU9Inotf6YkrKJwgBTqGYSfq1lRE,38241
28
- moleditpy_linux/modules/main_window_main_init.py,sha256=flZEzOH29Z6pplOqku51RMxgKT_QJzsjQK_EheDvjQo,93007
28
+ moleditpy_linux/modules/main_window_main_init.py,sha256=stZT2Swcd_yry3C_a7R2bC9-kew8yifRqy8Q3H3a3kk,93220
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,8 +38,8 @@ moleditpy_linux/modules/molecule_scene.py,sha256=khdt7h9Mk_D1cMbYeHGtq7P9aFXo0xG
38
38
  moleditpy_linux/modules/move_group_dialog.py,sha256=Fyuy3Uq1KsFsk9qR96r_FxPbAM_-zSfW2dsMQGv7btc,27276
39
39
  moleditpy_linux/modules/periodic_table_dialog.py,sha256=ItEZUts1XCietz9paY-spvbzxh6SXak3GnikwqkHZCw,4006
40
40
  moleditpy_linux/modules/planarize_dialog.py,sha256=eaqI1MpF35e-VUMpJATt-EtGG5FhcSUlbAenUaFGabY,8593
41
- moleditpy_linux/modules/plugin_interface.py,sha256=8_keZsQ6pZEVuEviHXZWlLFs8Yt6J83mwApbX1YL7P0,7791
42
- moleditpy_linux/modules/plugin_manager.py,sha256=4lXv9stNiiqgY2FRdNDzB41jLcOfc0VzAIF88eMYWlY,20369
41
+ moleditpy_linux/modules/plugin_interface.py,sha256=JfobFdAOLp5OnyJp3BNsWnpmZNJYypWQHNVNT0fP1N8,8171
42
+ moleditpy_linux/modules/plugin_manager.py,sha256=ZFQz8VlCy1_IHX7DnMro7iRbouB_rxZQowfrKuZ76G8,21133
43
43
  moleditpy_linux/modules/plugin_manager_window.py,sha256=b4kEv0DaWHZG76ZaFTOxn6CVtA62_0MpPYYr10ehCtA,12544
44
44
  moleditpy_linux/modules/settings_dialog.py,sha256=Nr7yE8UmYRi3VObWvRlrnv0DnjSjmYXbvqryZ02O12k,65348
45
45
  moleditpy_linux/modules/template_preview_item.py,sha256=djdq3tz73d_fJGOvai3E-V9Hk9q9ZW7skx7BV59mooA,6556
@@ -51,9 +51,9 @@ moleditpy_linux/modules/assets/file_icon.ico,sha256=yyVj084A7HuMNbV073cE_Ag3Ne40
51
51
  moleditpy_linux/modules/assets/icon.icns,sha256=wD5R6-Vw7K662tVKhu2E1ImN0oUuyAP4youesEQsn9c,139863
52
52
  moleditpy_linux/modules/assets/icon.ico,sha256=RfgFcx7-dHY_2STdsOQCQziY5SNhDr3gPnjO6jzEDPI,147975
53
53
  moleditpy_linux/modules/assets/icon.png,sha256=kCFN1WacYIdy0GN6SFEbNA00ef39pCczBnFdkkBI8Bs,147110
54
- moleditpy_linux-2.3.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
55
- moleditpy_linux-2.3.2.dist-info/METADATA,sha256=du5rtSINQNFLeLYeJq8hlt5p62l-AMEWoDADk4-2h1o,60708
56
- moleditpy_linux-2.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
57
- moleditpy_linux-2.3.2.dist-info/entry_points.txt,sha256=-OzipSi__yVwlimNtu3eiRP5t5UMg55Cs0udyhXYiyw,60
58
- moleditpy_linux-2.3.2.dist-info/top_level.txt,sha256=qyqe-hDYL6CXyin9E5Me5rVl3PG84VqiOjf9bQvfJLs,16
59
- moleditpy_linux-2.3.2.dist-info/RECORD,,
54
+ moleditpy_linux-2.3.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
55
+ moleditpy_linux-2.3.3.dist-info/METADATA,sha256=OUZRP1Xv4O4yMb3HbasU5FTF2qHcP-5cg2OzG79kRjo,60708
56
+ moleditpy_linux-2.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
57
+ moleditpy_linux-2.3.3.dist-info/entry_points.txt,sha256=-OzipSi__yVwlimNtu3eiRP5t5UMg55Cs0udyhXYiyw,60
58
+ moleditpy_linux-2.3.3.dist-info/top_level.txt,sha256=qyqe-hDYL6CXyin9E5Me5rVl3PG84VqiOjf9bQvfJLs,16
59
+ moleditpy_linux-2.3.3.dist-info/RECORD,,