Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
working commit for new component not edit
Browse files Browse the repository at this point in the history
  • Loading branch information
ggoneiESS committed Oct 27, 2023
1 parent ece0608 commit b5632be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 3 additions & 1 deletion nexus_constructor/add_component_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __init__(
self.setupUi()
self.use_dialogs = use_dialogs
self.setWindowModality(Qt.WindowModal)
self.setHidden(False)
if self.initial_edit:
self.ok_button.setText("Add group")
self.cancel_button.setVisible(True)
Expand Down Expand Up @@ -137,6 +138,7 @@ def _cancel_new_group(self):
self._refresh_tree(group)
else:
self._refresh_tree(self._group_to_edit_backup)
self.setHidden(True)
self.close()

def _cancel_edit_group(self):
Expand Down Expand Up @@ -626,7 +628,7 @@ def on_ok(self):
if not self.initial_edit:
self.signals.transformation_changed.emit()
self.model.signals.group_edited.emit(index, True)
self.hide()
self.setHidden(True)

def keyPressEvent(self, arg__1: QKeyEvent) -> None:
if arg__1.key() == Qt.Key_Escape:
Expand Down
11 changes: 4 additions & 7 deletions nexus_constructor/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ def show_add_component_dialog(self):
return
new_group = Group("", parent_node=selected_component)
selected_component.children.append(new_group)
try:
if not self.add_component_window.isVisible():
self.show_add_component_window(new_group, new_group=True)
except (RuntimeError, AttributeError):
self.show_add_component_window(new_group, new_group=True)
self.show_add_component_window(new_group, new_group=True)

def show_edit_component_dialog(self):
try:
Expand Down Expand Up @@ -254,8 +250,9 @@ def show_add_component_window(self, group: Group, new_group: bool):
nx_classes=self.nx_classes,
tree_view_updater=self._update_model,
)
self.main_grid_layout.addWidget(self.add_component_window)
# self.add_component_window.show()
if not self.add_component_window.isHidden():
self.main_grid_layout.addWidget(self.add_component_window)
self.add_component_window.setHidden(False)

def _show_attributes_list_window(
self, selected_object: Union[Group, FileWriterModule]
Expand Down

0 comments on commit b5632be

Please sign in to comment.