ClassesMapping
Introduction
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.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| Supervisely object class collection or list of object classes |
|
| Notification that will be displayed when there are no classes in widget |
|
| ID of the widget |
classes
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
empty_notification
Notification that will be displayed when there are no classes in the widget.
type: NotificationBox
default None
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Set classes to widget. |
| Return list of all classes. |
| Return edited classes mapping, if there were any changes. |
| Ignore classes by indexes. |
| Revert changes. |
| Set new classes mapping. |
| Select all classes. |
| Deselect all classes. |
| Select classes by |
| Callback triggers when selection is changed. |
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/input/009_classes_mapping/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Create list of object classes
Initialize ClassesMapping
widget, NotificationBox
widget for custom notification
ClassesMapping
widget, NotificationBox
widget for custom notificationCreate Text
widget for displaying changes and Button
widget for saving changes
Text
widget for displaying changes and Button
widget for saving changesCreate app layout
Prepare 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 the app using the layout
Create an app object with the layout parameter.
Add functions to control widgets from the python code
Last updated