ClassesMapping
Last updated
Last updated
Classes Mapping
widget allows to rename given object classes with new names. It can be useful when you want to rename classes in your project.
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
Notification that will be displayed when there are no classes in the widget.
type: NotificationBox
default None
ID of the widget.
type: str
default value: None
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/input/009_classes_mapping/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
ClassesMapping
widget, NotificationBox
widget for custom notificationText
widget for displaying changes and Button
widget for saving changesPrepare a layout for the app using the Card
widget with the content
parameter and place the widget that we've just created into the Container
widget.
Create an app object with the layout parameter.
Parameters | Type | Description |
---|---|---|
Attributes and Methods | Description |
---|---|
classes
Union[List[ObjClass], ObjClassCollection]
Supervisely object class collection or list of object classes
empty_notification
NotificationBox
Notification that will be displayed when there are no classes in widget
widget_id
str
ID of the widget
set()
Set classes to widget.
get_classes()
Return list of all classes.
get_mapping()
Return edited classes mapping, if there were any changes.
ignore()
Ignore classes by indexes.
set_default()
Revert changes.
set_mapping()
Set new classes mapping.
select_all()
Select all classes.
deselect_all()
Deselect all classes.
select()
Select classes by ObjClass
.
@selection_changed
Callback triggers when selection is changed.