moleditpy 1.2.3__tar.gz → 1.2.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moleditpy
3
- Version: 1.2.3
3
+ Version: 1.2.4
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
  Project-URL: Homepage, https://github.com/HiroYokoyama/python_molecular_editor
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "moleditpy"
7
7
 
8
- version = "1.2.3"
8
+ version = "1.2.4"
9
9
 
10
10
  authors = [
11
11
  { name="HiroYokoyama", email="titech.yoko.hiro@gmail.com" },
@@ -11,7 +11,7 @@ DOI 10.5281/zenodo.17268532
11
11
  """
12
12
 
13
13
  #Version
14
- VERSION = '1.2.3'
14
+ VERSION = '1.2.4'
15
15
 
16
16
  print("-----------------------------------------------------")
17
17
  print("MoleditPy — A Python-based molecular editing software")
@@ -2139,6 +2139,7 @@ class CustomInteractorStyle(vtkInteractorStyleTrackballCamera):
2139
2139
  # その後、カーソルの表示を更新します
2140
2140
  is_edit_active = mw.is_3d_edit_mode or interactor.GetAltKey()
2141
2141
  if is_edit_active:
2142
+ # 編集がアクティブな場合のみ、原子のホバーチェックを行う
2142
2143
  atom_under_cursor = False
2143
2144
  click_pos = interactor.GetEventPosition()
2144
2145
  picker = mw.plotter.picker
@@ -2982,6 +2983,7 @@ class MainWindow(QMainWindow):
2982
2983
  self.optimize_3d_button.setEnabled(True)
2983
2984
  self.export_button.setEnabled(True)
2984
2985
  self.edit_3d_action.setEnabled(True)
2986
+ self.plotter.reset_camera()
2985
2987
 
2986
2988
  def on_calculation_error(self, error_message):
2987
2989
  self.dragged_atom_info = None
@@ -3486,6 +3488,7 @@ class MainWindow(QMainWindow):
3486
3488
 
3487
3489
  try:
3488
3490
  # 安定版:原子IDとRDKit座標の確実なマッピング
3491
+ view_center = self.view_2d.mapToScene(self.view_2d.viewport().rect().center())
3489
3492
  new_positions_map = {}
3490
3493
  AllChem.Compute2DCoords(mol)
3491
3494
  conf = mol.GetConformer()
@@ -3501,8 +3504,8 @@ class MainWindow(QMainWindow):
3501
3504
  self.statusBar().showMessage("Error: Atom items not found for optimized atoms."); return
3502
3505
 
3503
3506
  # 元の図形の中心を維持
3504
- original_center_x = sum(item.pos().x() for item in target_atom_items) / len(target_atom_items)
3505
- original_center_y = sum(item.pos().y() for item in target_atom_items) / len(target_atom_items)
3507
+ #original_center_x = sum(item.pos().x() for item in target_atom_items) / len(target_atom_items)
3508
+ #original_center_y = sum(item.pos().y() for item in target_atom_items) / len(target_atom_items)
3506
3509
 
3507
3510
  positions = list(new_positions_map.values())
3508
3511
  rdkit_cx = sum(p.x for p in positions) / len(positions)
@@ -3514,8 +3517,8 @@ class MainWindow(QMainWindow):
3514
3517
  for atom_id, rdkit_pos in new_positions_map.items():
3515
3518
  if atom_id in self.data.atoms:
3516
3519
  item = self.data.atoms[atom_id]['item']
3517
- sx = ((rdkit_pos.x - rdkit_cx) * SCALE) + original_center_x
3518
- sy = (-(rdkit_pos.y - rdkit_cy) * SCALE) + original_center_y
3520
+ sx = ((rdkit_pos.x - rdkit_cx) * SCALE) + view_center.x()
3521
+ sy = (-(rdkit_pos.y - rdkit_cy) * SCALE) + view_center.y()
3519
3522
  new_scene_pos = QPointF(sx, sy)
3520
3523
  item.setPos(new_scene_pos)
3521
3524
  self.data.atoms[atom_id]['pos'] = new_scene_pos
@@ -3689,6 +3692,7 @@ class MainWindow(QMainWindow):
3689
3692
 
3690
3693
 
3691
3694
  def draw_molecule_3d(self, mol):
3695
+ camera_state = self.plotter.camera.copy()
3692
3696
  self.plotter.clear()
3693
3697
  conf = mol.GetConformer()
3694
3698
 
@@ -3762,6 +3766,8 @@ class MainWindow(QMainWindow):
3762
3766
  except Exception: pass
3763
3767
  self.plotter.add_point_labels(np.array(pts), labels, font_size=20, point_size=0, text_color='k', name='chiral_labels', always_visible=True, tolerance=0.01, show_points=False)
3764
3768
  except Exception as e: self.statusBar().showMessage(f"3D chiral label drawing error: {e}")
3769
+
3770
+ self.plotter.camera = camera_state
3765
3771
 
3766
3772
 
3767
3773
  def toggle_chiral_labels_display(self, checked):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moleditpy
3
- Version: 1.2.3
3
+ Version: 1.2.4
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
  Project-URL: Homepage, https://github.com/HiroYokoyama/python_molecular_editor
File without changes
File without changes