diff --git a/nexus-constructor.py b/nexus-constructor.py index 98a3d3544..9430d3ab9 100644 --- a/nexus-constructor.py +++ b/nexus-constructor.py @@ -85,7 +85,9 @@ def closeEvent(self, event: QCloseEvent) -> None: surfaceFormat.setSwapBehavior(QSurfaceFormat.DoubleBuffer) QSurfaceFormat.setDefaultFormat(surfaceFormat) app = QApplication(sys.argv) - app.setStyleSheet("QWidget{padding:0px;margin:0px;}QLayout{padding:0;margin:0;border:0;}") + app.setStyleSheet( + "QWidget{padding:0px;margin:0px;}QLayout{padding:0;margin:0;border:0;}" + ) app.setWindowIcon(QIcon(os.path.join("ui", "icon.png"))) window = NexusConstructorMainWindow() definitions_dir = os.path.abspath(os.path.join(root_dir, "definitions")) diff --git a/nexus_constructor/add_component_window.py b/nexus_constructor/add_component_window.py index 8efb0827b..53d3a48e8 100644 --- a/nexus_constructor/add_component_window.py +++ b/nexus_constructor/add_component_window.py @@ -74,7 +74,8 @@ def __init__(self, parent): ) super().setupUi() self.setWindowModality(Qt.WindowModal) -# self.setHidden(True) + + # self.setHidden(True) def refresh_widget_values( self, diff --git a/nexus_constructor/component_tree_view.py b/nexus_constructor/component_tree_view.py index 344d94c80..bb7e0bb50 100755 --- a/nexus_constructor/component_tree_view.py +++ b/nexus_constructor/component_tree_view.py @@ -64,7 +64,7 @@ def get_frame( LinkTransformation, TransformationsList, FileWriterModule, - None + None, ], ): frame = NexusQFrame() @@ -89,7 +89,14 @@ def get_frame( elif isinstance(value, FileWriterModule): get_module_frame(frame, self.model, value, self._use_simple_tree_view) else: - get_component_frame(frame, self.model, self.parent().parent().component_model, self.model.entry, self.parent().parent().sceneWidget, True) + get_component_frame( + frame, + self.model, + self.parent().parent().component_model, + self.model.entry, + self.parent().parent().sceneWidget, + True, + ) return frame def paint( diff --git a/nexus_constructor/main_window.py b/nexus_constructor/main_window.py index 0a418a2d9..5d43bde4c 100644 --- a/nexus_constructor/main_window.py +++ b/nexus_constructor/main_window.py @@ -60,9 +60,10 @@ def setupUi(self, main_window): self.component_tree_view_tab.set_up_model(self.model) self._update_views() self.simple_tree_view.triggered.emit() -# self.add_component_window = AddComponentDialog(self.central_widget, self.model, self.component_tree_view_tab.component_model, self.sceneWidget) -# self.component_tree_view_tab.component_delegate.get_frame(Component("empty")).layout().addWidget(self.add_component_window) -# .componentsTabLayout.insertWidget(1, self.add_component_window) + + # self.add_component_window = AddComponentDialog(self.central_widget, self.model, self.component_tree_view_tab.component_model, self.sceneWidget) + # self.component_tree_view_tab.component_delegate.get_frame(Component("empty")).layout().addWidget(self.add_component_window) + # .componentsTabLayout.insertWidget(1, self.add_component_window) def _setup_model_signals(self): self.model.signals.component_added.connect(self.sceneWidget.add_component) @@ -117,7 +118,8 @@ def show_add_component_dialog(self): return new_group = Group("", parent_node=selected_component) selected_component.children.append(new_group) -# 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: @@ -126,7 +128,7 @@ def show_edit_component_dialog(self): 0 ].internalPointer() ) -# self.show_add_component_window(selected_component, False) + # self.show_add_component_window(selected_component, False) except IndexError: print("Select a valid group in the NeXus tree view before editing.") diff --git a/nexus_constructor/treeview_utils.py b/nexus_constructor/treeview_utils.py index 759b06882..353563f5e 100644 --- a/nexus_constructor/treeview_utils.py +++ b/nexus_constructor/treeview_utils.py @@ -273,17 +273,18 @@ def get_link_transformation_frame( frame.layout().addWidget(frame.transformation_frame, Qt.AlignTop) -def get_component_frame(frame: QFrame, model, component_model, group_to_edit, scene_widget, initial_edit): +def get_component_frame( + frame: QFrame, model, component_model, group_to_edit, scene_widget, initial_edit +): my_add_component_window = AddComponentDialog(frame) my_add_component_window.refresh_widget_values( - frame, - model, - component_model, group_to_edit, scene_widget, initial_edit - ) + frame, model, component_model, group_to_edit, scene_widget, initial_edit + ) frame.layout().addWidget(my_add_component_window) pixmap = QPixmap(frame.size()) frame.render(pixmap, QPoint(), QRegion()) + def get_transformation_frame(frame: QFrame, model: Model, value: Transformation): if value.transform_type == TransformationType.TRANSLATION: frame.transformation_frame = EditTranslation(frame, value, model)