MoleditPy-linux 2.8.0__tar.gz → 2.8.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 (67) hide show
  1. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/PKG-INFO +3 -3
  2. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/README.md +2 -2
  3. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/pyproject.toml +1 -1
  4. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/MoleditPy_linux.egg-info/PKG-INFO +3 -3
  5. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/angle_dialog.py +27 -21
  6. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/bond_length_dialog.py +9 -11
  7. moleditpy_linux-2.8.2/src/moleditpy_linux/modules/calculation_worker.py +1320 -0
  8. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/constants.py +1 -1
  9. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/dihedral_dialog.py +3 -6
  10. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_compute.py +9 -2
  11. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_edit_3d.py +8 -19
  12. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_main_init.py +1 -0
  13. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/mol_geometry.py +50 -0
  14. moleditpy_linux-2.8.0/src/moleditpy_linux/modules/calculation_worker.py +0 -1313
  15. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/LICENSE +0 -0
  16. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/setup.cfg +0 -0
  17. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/MoleditPy_linux.egg-info/SOURCES.txt +0 -0
  18. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/MoleditPy_linux.egg-info/dependency_links.txt +0 -0
  19. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/MoleditPy_linux.egg-info/entry_points.txt +0 -0
  20. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/MoleditPy_linux.egg-info/requires.txt +0 -0
  21. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/MoleditPy_linux.egg-info/top_level.txt +0 -0
  22. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/__init__.py +0 -0
  23. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/__main__.py +0 -0
  24. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/assets/file_icon.ico +0 -0
  25. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/assets/icon.icns +0 -0
  26. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/assets/icon.ico +0 -0
  27. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/assets/icon.png +0 -0
  28. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/main.py +0 -0
  29. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/__init__.py +0 -0
  30. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/about_dialog.py +0 -0
  31. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/align_plane_dialog.py +0 -0
  32. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/alignment_dialog.py +0 -0
  33. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/analysis_window.py +0 -0
  34. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/atom_item.py +0 -0
  35. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/bond_item.py +0 -0
  36. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/color_settings_dialog.py +0 -0
  37. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/constrained_optimization_dialog.py +0 -0
  38. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/custom_interactor_style.py +0 -0
  39. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/custom_qt_interactor.py +0 -0
  40. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/dialog3_d_picking_mixin.py +0 -0
  41. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window.py +0 -0
  42. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_app_state.py +0 -0
  43. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_dialog_manager.py +0 -0
  44. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_edit_actions.py +0 -0
  45. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_export.py +0 -0
  46. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_molecular_parsers.py +0 -0
  47. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_project_io.py +0 -0
  48. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_string_importers.py +0 -0
  49. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_ui_manager.py +0 -0
  50. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_view_3d.py +0 -0
  51. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/main_window_view_loaders.py +0 -0
  52. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/mirror_dialog.py +0 -0
  53. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/molecular_data.py +0 -0
  54. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/molecule_scene.py +0 -0
  55. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/move_group_dialog.py +0 -0
  56. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/periodic_table_dialog.py +0 -0
  57. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/planarize_dialog.py +0 -0
  58. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/plugin_interface.py +0 -0
  59. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/plugin_manager.py +0 -0
  60. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/plugin_manager_window.py +0 -0
  61. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/settings_dialog.py +0 -0
  62. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/sip_isdeleted_safe.py +0 -0
  63. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/template_preview_item.py +0 -0
  64. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/template_preview_view.py +0 -0
  65. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/translation_dialog.py +0 -0
  66. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/user_template_dialog.py +0 -0
  67. {moleditpy_linux-2.8.0 → moleditpy_linux-2.8.2}/src/moleditpy_linux/modules/zoomable_view.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MoleditPy-linux
3
- Version: 2.8.0
3
+ Version: 2.8.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: GNU GENERAL PUBLIC LICENSE
@@ -711,10 +711,10 @@ This is the Linux version of MoleditPy. The Open Babel fallback is disabled due
711
711
  [![Python Versions](https://img.shields.io/pypi/pyversions/MoleditPy.svg)](https://pypi.org/project/MoleditPy/)
712
712
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
713
713
  [![Build Status](https://github.com/HiroYokoyama/python_molecular_editor/actions/workflows/tests.yml/badge.svg)](https://github.com/HiroYokoyama/python_molecular_editor/actions)
714
- ![Core Logic Coverage](https://img.shields.io/badge/core_logic_coverage-73%25-green)
714
+ ![Core Logic Coverage](https://img.shields.io/badge/core_logic_coverage-72%25-green)
715
715
  ![Overall Coverage](https://img.shields.io/badge/coverage-50%25-orange)
716
716
  ![GUI Status](https://img.shields.io/badge/GUI-Manually_Verified-blue)
717
- ![Pylint Score](https://img.shields.io/badge/pylint-8.63%2F10-brightgreen)
717
+ ![Pylint Score](https://img.shields.io/badge/pylint-8.64%2F10-brightgreen)
718
718
  [![PyPI Downloads](https://static.pepy.tech/personalized-badge/moleditpy?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/moleditpy)
719
719
 
720
720
  [🇯🇵 日本語 (Japanese)](#japanese)
@@ -8,10 +8,10 @@ This is the Linux version of MoleditPy. The Open Babel fallback is disabled due
8
8
  [![Python Versions](https://img.shields.io/pypi/pyversions/MoleditPy.svg)](https://pypi.org/project/MoleditPy/)
9
9
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
10
10
  [![Build Status](https://github.com/HiroYokoyama/python_molecular_editor/actions/workflows/tests.yml/badge.svg)](https://github.com/HiroYokoyama/python_molecular_editor/actions)
11
- ![Core Logic Coverage](https://img.shields.io/badge/core_logic_coverage-73%25-green)
11
+ ![Core Logic Coverage](https://img.shields.io/badge/core_logic_coverage-72%25-green)
12
12
  ![Overall Coverage](https://img.shields.io/badge/coverage-50%25-orange)
13
13
  ![GUI Status](https://img.shields.io/badge/GUI-Manually_Verified-blue)
14
- ![Pylint Score](https://img.shields.io/badge/pylint-8.63%2F10-brightgreen)
14
+ ![Pylint Score](https://img.shields.io/badge/pylint-8.64%2F10-brightgreen)
15
15
  [![PyPI Downloads](https://static.pepy.tech/personalized-badge/moleditpy?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/moleditpy)
16
16
 
17
17
  [🇯🇵 日本語 (Japanese)](#japanese)
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "MoleditPy-linux"
7
7
 
8
- version = "2.8.0"
8
+ version = "2.8.2"
9
9
 
10
10
  license = {file = "LICENSE"}
11
11
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MoleditPy-linux
3
- Version: 2.8.0
3
+ Version: 2.8.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: GNU GENERAL PUBLIC LICENSE
@@ -711,10 +711,10 @@ This is the Linux version of MoleditPy. The Open Babel fallback is disabled due
711
711
  [![Python Versions](https://img.shields.io/pypi/pyversions/MoleditPy.svg)](https://pypi.org/project/MoleditPy/)
712
712
  [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
713
713
  [![Build Status](https://github.com/HiroYokoyama/python_molecular_editor/actions/workflows/tests.yml/badge.svg)](https://github.com/HiroYokoyama/python_molecular_editor/actions)
714
- ![Core Logic Coverage](https://img.shields.io/badge/core_logic_coverage-73%25-green)
714
+ ![Core Logic Coverage](https://img.shields.io/badge/core_logic_coverage-72%25-green)
715
715
  ![Overall Coverage](https://img.shields.io/badge/coverage-50%25-orange)
716
716
  ![GUI Status](https://img.shields.io/badge/GUI-Manually_Verified-blue)
717
- ![Pylint Score](https://img.shields.io/badge/pylint-8.63%2F10-brightgreen)
717
+ ![Pylint Score](https://img.shields.io/badge/pylint-8.64%2F10-brightgreen)
718
718
  [![PyPI Downloads](https://static.pepy.tech/personalized-badge/moleditpy?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/moleditpy)
719
719
 
720
720
  [🇯🇵 日本語 (Japanese)](#japanese)
@@ -24,10 +24,10 @@ from PyQt6.QtWidgets import (
24
24
 
25
25
  try:
26
26
  from .dialog3_d_picking_mixin import Dialog3DPickingMixin
27
- from .mol_geometry import adjust_bond_angle, get_connected_group, rodrigues_rotate
27
+ from .mol_geometry import adjust_bond_angle, calc_angle_deg, get_connected_group, rodrigues_rotate
28
28
  except Exception:
29
29
  from modules.dialog3_d_picking_mixin import Dialog3DPickingMixin
30
- from modules.mol_geometry import adjust_bond_angle, get_connected_group, rodrigues_rotate
30
+ from modules.mol_geometry import adjust_bond_angle, calc_angle_deg, get_connected_group, rodrigues_rotate
31
31
 
32
32
  import numpy as np
33
33
  from PyQt6.QtCore import Qt
@@ -152,11 +152,15 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
152
152
  self.atom2_idx = atom_idx
153
153
  elif self.atom3_idx is None:
154
154
  self.atom3_idx = atom_idx
155
+ # Take a fresh snapshot immediately upon completing the triad selection
156
+ # This locks in the "original" initial geometry the user started modifying from
157
+ self._snapshot_positions = self.mol.GetConformer().GetPositions().copy()
155
158
  else:
156
159
  # Reset and start over
157
160
  self.atom1_idx = atom_idx
158
161
  self.atom2_idx = None
159
162
  self.atom3_idx = None
163
+ self._snapshot_positions = None
160
164
 
161
165
  # 原子ラベルを表示
162
166
  self.show_atom_labels()
@@ -177,12 +181,6 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
177
181
  self.disable_picking()
178
182
  super().closeEvent(event)
179
183
 
180
- def reject(self):
181
- """キャンセル時の処理"""
182
- self.clear_atom_labels()
183
- self.disable_picking()
184
- super().reject()
185
-
186
184
  def accept(self):
187
185
  """OK時の処理"""
188
186
  self.clear_atom_labels()
@@ -194,6 +192,7 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
194
192
  self.atom1_idx = None
195
193
  self.atom2_idx = None # vertex atom
196
194
  self.atom3_idx = None
195
+ self._snapshot_positions = None
197
196
  self.clear_selection_labels()
198
197
  self.update_display()
199
198
 
@@ -215,6 +214,7 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
215
214
  self.selection_label.setText("No atoms selected")
216
215
  self.angle_label.setText("")
217
216
  self.apply_button.setEnabled(False)
217
+ self._snapshot_positions = None
218
218
  # Clear angle input when no selection
219
219
  try:
220
220
  self.angle_input.blockSignals(True)
@@ -235,6 +235,7 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
235
235
  )
236
236
  self.angle_label.setText("")
237
237
  self.apply_button.setEnabled(False)
238
+ self._snapshot_positions = None
238
239
  # ラベル追加
239
240
  self.add_selection_label(self.atom1_idx, "1")
240
241
  # Clear angle input while selection is incomplete
@@ -258,6 +259,7 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
258
259
  )
259
260
  self.angle_label.setText("")
260
261
  self.apply_button.setEnabled(False)
262
+ self._snapshot_positions = None
261
263
  # ラベル追加
262
264
  self.add_selection_label(self.atom1_idx, "1")
263
265
  self.add_selection_label(self.atom2_idx, "2(vertex)")
@@ -308,17 +310,10 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
308
310
  def calculate_angle(self):
309
311
  """現在の角度を計算"""
310
312
  conf = self.mol.GetConformer()
311
- pos1 = np.array(conf.GetAtomPosition(self.atom1_idx))
312
- pos2 = np.array(conf.GetAtomPosition(self.atom2_idx)) # vertex
313
- pos3 = np.array(conf.GetAtomPosition(self.atom3_idx))
314
-
315
- vec1 = pos1 - pos2
316
- vec2 = pos3 - pos2
317
-
318
- cos_angle = np.dot(vec1, vec2) / (np.linalg.norm(vec1) * np.linalg.norm(vec2))
319
- cos_angle = np.clip(cos_angle, -1.0, 1.0)
320
- angle_rad = np.arccos(cos_angle)
321
- return np.degrees(angle_rad)
313
+ pos1 = conf.GetAtomPosition(self.atom1_idx)
314
+ pos2 = conf.GetAtomPosition(self.atom2_idx) # vertex
315
+ pos3 = conf.GetAtomPosition(self.atom3_idx)
316
+ return calc_angle_deg(pos1, pos2, pos3)
322
317
 
323
318
  def on_angle_input_changed(self, text):
324
319
  """Line edit text changed, update slider."""
@@ -340,7 +335,9 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
340
335
  self._slider_dragging = True
341
336
  self.main_window.push_undo_state()
342
337
  # Snapshot positions so the rotation axis stays stable during drag
343
- self._snapshot_positions = self.mol.GetConformer().GetPositions().copy()
338
+ # Only take snapshot if one doesn't exist to preserve directional info
339
+ if getattr(self, '_snapshot_positions', None) is None:
340
+ self._snapshot_positions = self.mol.GetConformer().GetPositions().copy()
344
341
 
345
342
  def on_slider_moved(self, value):
346
343
  """Update geometry in real-time while dragging."""
@@ -356,7 +353,8 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
356
353
  def on_slider_released(self):
357
354
  """Finalize slider dragging."""
358
355
  self._slider_dragging = False
359
- self._snapshot_positions = None
356
+ # Do NOT clear snapshot here. Keep it to preserve the turning direction
357
+ # even if they approach ±180°. It gets cleared when selection is changed.
360
358
  self.main_window.draw_molecule_3d(self.mol)
361
359
  self.main_window.update_chiral_labels()
362
360
 
@@ -367,6 +365,11 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
367
365
  if self.atom1_idx is None or self.atom2_idx is None or self.atom3_idx is None:
368
366
  return
369
367
  self.main_window.push_undo_state()
368
+
369
+ # Ensure we have a snapshot for click-to-position as well to maintain direction
370
+ if getattr(self, '_snapshot_positions', None) is None:
371
+ self._snapshot_positions = self.mol.GetConformer().GetPositions().copy()
372
+
370
373
  self.angle_input.blockSignals(True)
371
374
  self.angle_input.setText(f"{value}")
372
375
  self.angle_input.blockSignals(False)
@@ -468,6 +471,9 @@ class AngleDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
468
471
  self.main_window.draw_molecule_3d(self.mol)
469
472
 
470
473
  def reject(self):
474
+ """キャンセル時の処理"""
475
+ self.clear_atom_labels()
476
+ self.disable_picking()
471
477
  super().reject()
472
478
  try:
473
479
  if self.main_window.current_mol:
@@ -26,7 +26,7 @@ from PyQt6.QtWidgets import (
26
26
  )
27
27
 
28
28
  from .dialog3_d_picking_mixin import Dialog3DPickingMixin
29
- from .mol_geometry import get_connected_group
29
+ from .mol_geometry import calc_distance, get_connected_group
30
30
 
31
31
 
32
32
  class BondLengthDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
@@ -168,12 +168,6 @@ class BondLengthDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
168
168
  self.disable_picking()
169
169
  super().closeEvent(event)
170
170
 
171
- def reject(self):
172
- """キャンセル時の処理"""
173
- self.clear_atom_labels()
174
- self.disable_picking()
175
- super().reject()
176
-
177
171
  def accept(self):
178
172
  """OK時の処理"""
179
173
  self.clear_atom_labels()
@@ -248,9 +242,10 @@ class BondLengthDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
248
242
 
249
243
  # Calculate current distance
250
244
  conf = self.mol.GetConformer()
251
- pos1 = np.array(conf.GetAtomPosition(self.atom1_idx))
252
- pos2 = np.array(conf.GetAtomPosition(self.atom2_idx))
253
- current_distance = np.linalg.norm(pos2 - pos1)
245
+ current_distance = calc_distance(
246
+ conf.GetAtomPosition(self.atom1_idx),
247
+ conf.GetAtomPosition(self.atom2_idx),
248
+ )
254
249
  self.distance_label.setText(f"Current distance: {current_distance:.3f} Å")
255
250
  self.apply_button.setEnabled(True)
256
251
  # Update the distance input box to show current distance
@@ -355,7 +350,7 @@ class BondLengthDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
355
350
 
356
351
  # Direction vector from atom1 to atom2
357
352
  direction = pos2 - pos1
358
- current_distance = np.linalg.norm(direction)
353
+ current_distance = calc_distance(pos1, pos2)
359
354
 
360
355
  if current_distance == 0:
361
356
  return
@@ -420,6 +415,9 @@ class BondLengthDialog(Dialog3DPickingMixin, QDialog): # pragma: no cover
420
415
  self.main_window.draw_molecule_3d(self.mol)
421
416
 
422
417
  def reject(self):
418
+ """キャンセル時の処理"""
419
+ self.clear_atom_labels()
420
+ self.disable_picking()
423
421
  super().reject()
424
422
  try:
425
423
  if self.main_window.current_mol: