|
6 | 6 | from lib.core.conditions import CONDITION_EQ as EQ |
7 | 7 | from lib.core.entities import AnnotationClassEntity |
8 | 8 | from lib.core.entities import ProjectEntity |
| 9 | +from lib.core.entities.classes import GroupTypeEnum |
9 | 10 | from lib.core.enums import ProjectType |
10 | 11 | from lib.core.exceptions import AppException |
11 | 12 | from lib.core.serviceproviders import BaseServiceProvider |
@@ -66,6 +67,13 @@ def validate_project_type(self): |
66 | 67 | "Predefined tagging functionality is not supported for projects" |
67 | 68 | f" of type {ProjectType.get_name(self._project.type)}." |
68 | 69 | ) |
| 70 | + if self._project.type != ProjectType.VECTOR: |
| 71 | + for g in self._annotation_class.attribute_groups: |
| 72 | + if g.group_type == GroupTypeEnum.OCR: |
| 73 | + raise AppException( |
| 74 | + f"OCR attribute group is not supported for project type " |
| 75 | + f"{ProjectType.get_name(self._project.type)}." |
| 76 | + ) |
69 | 77 |
|
70 | 78 | def validate_default_value(self): |
71 | 79 | if self._project.type == ProjectType.PIXEL.value and any( |
@@ -109,13 +117,19 @@ def __init__( |
109 | 117 | self._annotation_classes = annotation_classes |
110 | 118 |
|
111 | 119 | def validate_project_type(self): |
112 | | - if self._project.type == ProjectType.PIXEL and any( |
113 | | - [True for i in self._annotation_classes if i.type == "tag"] |
114 | | - ): |
115 | | - raise AppException( |
116 | | - f"Predefined tagging functionality is not supported" |
117 | | - f" for projects of type {ProjectType.get_name(self._project.type)}." |
118 | | - ) |
| 120 | + if self._project.type != ProjectType.VECTOR: |
| 121 | + for c in self._annotation_classes: |
| 122 | + if self._project.type == ProjectType.PIXEL and c.type == "tag": |
| 123 | + raise AppException( |
| 124 | + f"Predefined tagging functionality is not supported" |
| 125 | + f" for projects of type {ProjectType.get_name(self._project.type)}." |
| 126 | + ) |
| 127 | + for g in c.attribute_groups: |
| 128 | + if g.group_type == GroupTypeEnum.OCR: |
| 129 | + raise AppException( |
| 130 | + f"OCR attribute group is not supported for project type " |
| 131 | + f"{ProjectType.get_name(self._project.type)}." |
| 132 | + ) |
119 | 133 |
|
120 | 134 | def validate_default_value(self): |
121 | 135 | if self._project.type == ProjectType.PIXEL.value: |
|
0 commit comments