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

Commit

Permalink
GO FORMAT YOURSELF (black)
Browse files Browse the repository at this point in the history
  • Loading branch information
cow-bot committed Nov 21, 2023
1 parent ea19a6b commit 5f8dd6c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
4 changes: 3 additions & 1 deletion nexus-constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
3 changes: 2 additions & 1 deletion nexus_constructor/add_component_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 9 additions & 2 deletions nexus_constructor/component_tree_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_frame(
LinkTransformation,
TransformationsList,
FileWriterModule,
None
None,
],
):
frame = NexusQFrame()
Expand All @@ -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(
Expand Down
12 changes: 7 additions & 5 deletions nexus_constructor/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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.")

Expand Down
11 changes: 6 additions & 5 deletions nexus_constructor/treeview_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5f8dd6c

Please sign in to comment.