diff --git a/src/ui/dtl/utils.py b/src/ui/dtl/utils.py index ea616975..5ccc6de1 100644 --- a/src/ui/dtl/utils.py +++ b/src/ui/dtl/utils.py @@ -125,6 +125,10 @@ def get_classes_mapping_value( default_allowed: bool = False, ): mapping = classes_mapping_widget.get_mapping() + existing_classes = classes_mapping_widget.get_classes() + if hasattr(existing_classes, "keys"): + existing_classes = existing_classes.keys() + if default_allowed: default = [cls_name for cls_name, cls_values in mapping.items() if cls_values["default"]] classes = classes_mapping_widget.get_classes() @@ -138,6 +142,11 @@ def get_classes_mapping_value( other_allowed=other_allowed, ) + if any([object_class in existing_classes for object_class in result_mapping.values()]): + classes_mapping_widget.conflict_notification.show() + else: + classes_mapping_widget.conflict_notification.hide() + return result_mapping diff --git a/src/ui/widgets/classes_mapping/classes_mapping.py b/src/ui/widgets/classes_mapping/classes_mapping.py index 0877b0c5..652da78c 100644 --- a/src/ui/widgets/classes_mapping/classes_mapping.py +++ b/src/ui/widgets/classes_mapping/classes_mapping.py @@ -47,7 +47,14 @@ def __init__( title="No classes", description="Connect node and ensure that source node produces classes of type needed for this node.", ) + self.conflict_notification = NotificationBox( + title="Conflicting names", + description="Some class names are conflicting. Please, resolve the conflicts before saving.", + box_type="warning", + ) + self.conflict_notification.hide() self.empty_notification = empty_notification + self._classes = classes self._select_all_btn = Button() diff --git a/src/ui/widgets/classes_mapping/template.html b/src/ui/widgets/classes_mapping/template.html index 457535d5..b079b499 100644 --- a/src/ui/widgets/classes_mapping/template.html +++ b/src/ui/widgets/classes_mapping/template.html @@ -1,6 +1,9 @@