fiftyone.operators.panel¶
FiftyOne panels.
Classes:
|
Configuration for a panel. |
|
A panel. |
|
Base class for panel state and data. |
|
Class representing the state of a panel. |
|
Class representing the data of a panel. |
|
Class representing a panel. |
Exceptions:
Error raised when trying to read a write-only property. |
-
class
fiftyone.operators.panel.
PanelConfig
(name, label, help_markdown=None, icon=None, light_icon=None, dark_icon=None, allow_multiple=False, surfaces: typing_extensions.Literal[grid, modal, grid modal] = 'grid', reload_on_navigation=False, **kwargs)¶ Bases:
fiftyone.operators.operator.OperatorConfig
Configuration for a panel.
- Parameters
name – the name of the panel
label – the display name for the panel
icon (None) – the icon to show in the panel’s tab
light_icon (None) – the icon to show in the panel’s tab when the App is in light mode
dark_icon (None) – the icon to show in the panel’s tab when the App is in dark mode
allow_multiple (False) – whether to allow multiple instances of the panel to be opened
reload_on_navigation (False) – whether to reload the panel when the user navigates to a new page. This is only applicable to panels that are not shown in a modal
surfaces ("grid") – the surfaces on which the panel can be displayed
help_markdown (None) – a markdown string to display in the panel’s help tooltip
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.panel.
Panel
(_builtin=False)¶ Bases:
fiftyone.operators.operator.Operator
A panel.
Methods:
render
(ctx)Defines the panel’s layout and events.
resolve_input
(ctx)Returns the resolved input property.
on_startup
(ctx)on_load
(ctx)execute
(ctx)Executes the operator.
add_secrets
(secrets)Adds secrets to the operator.
method_to_uri
(method_name)Converts a method name to a URI.
resolve_delegation
(ctx)Returns the resolved forced delegation flag.
Returns the resolved execution options.
resolve_output
(ctx)Returns the resolved output property.
resolve_placement
(ctx)Returns the resolved placement of the operator.
resolve_type
(ctx, type)Returns the resolved input or output property.
to_json
()Returns a JSON representation of the operator.
Attributes:
Whether the operator is builtin.
The
OperatorConfig
for the operator.The unique identifier of the operator:
plugin_name/operator_name
.-
render
(ctx)¶ Defines the panel’s layout and events.
This method is called after every panel event is called (on load, button callback, context change event, etc).
- Parameters
ctx – the
fiftyone.operators.executor.ExecutionContext
- Returns
-
resolve_input
(ctx)¶ Returns the resolved input property.
Subclasses can implement this method to define the inputs to the operator. This method should never be called directly. Instead use
resolve_type()
.By default, this method is called once when the operator is created. If the operator is dynamic, this method is called each time the input changes.
- Parameters
ctx – the
fiftyone.operators.executor.ExecutionContext
- Returns
a
fiftyone.operators.types.Property
, or None
-
on_startup
(ctx)¶
-
on_load
(ctx)¶
-
execute
(ctx)¶ Executes the operator.
Subclasses must implement this method.
- Parameters
ctx – the
fiftyone.operators.executor.ExecutionContext
- Returns
JSON serializable data, or None
-
add_secrets
(secrets)¶ Adds secrets to the operator.
- Parameters
secrets – a list of secrets
-
property
builtin
¶ Whether the operator is builtin.
-
property
config
¶ The
OperatorConfig
for the operator.
-
method_to_uri
(method_name)¶ Converts a method name to a URI.
- Parameters
method_name – the method name
- Returns
a URI
-
property
name
¶
-
resolve_delegation
(ctx)¶ Returns the resolved forced delegation flag.
Subclasses can implement this method to decide if delegated execution should be forced for the given operation.
- Parameters
ctx – the
fiftyone.operators.executor.ExecutionContext
- Returns
whether the operation should be delegated (True), run immediately (False), or None to defer to
resolve_execution_options()
to specify the available options
-
resolve_execution_options
(ctx)¶ Returns the resolved execution options.
Subclasses can implement this method to define the execution options available for the operation.
- Parameters
ctx – the
fiftyone.operators.executor.ExecutionContext
- Returns
a
fiftyone.operators.executor.ExecutionOptions
instance
-
resolve_output
(ctx)¶ Returns the resolved output property.
Subclasses can implement this method to define the outputs of the operator.
By default, this method is called once when the operator is created. If the operator is dynamic, this method is called after the operator is executed.
- Parameters
ctx – the
fiftyone.operators.executor.ExecutionContext
- Returns
a
fiftyone.operators.types.Property
, or None
-
resolve_placement
(ctx)¶ Returns the resolved placement of the operator.
Subclasses can implement this method to define the placement of the operator.
- Parameters
ctx – the
fiftyone.operators.executor.ExecutionContext
- Returns
a
fiftyone.operators.types.Placement
, or None
-
resolve_type
(ctx, type)¶ Returns the resolved input or output property.
- Parameters
ctx – the
fiftyone.operators.executor.ExecutionContext
type – the type of property to resolve, either
"inputs"
or"outputs"
- Returns
a
fiftyone.operators.types.Property
, or None
-
to_json
()¶ Returns a JSON representation of the operator.
- Returns
a JSON dict
-
property
uri
¶ The unique identifier of the operator:
plugin_name/operator_name
.
-
-
exception
fiftyone.operators.panel.
WriteOnlyError
¶ Bases:
Exception
Error raised when trying to read a write-only property.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
fiftyone.operators.panel.
PanelRefBase
(ctx)¶ Bases:
object
Base class for panel state and data.
- Parameters
ctx – an
fiftyone.operators.executor.ExecutionContext
Methods:
set
(key[, value])Sets some value(s) in the dictionary.
get
(key[, default])Gets a value from the dictionary.
clear
()Clears the dictionary.
-
set
(key, value=None)¶ Sets some value(s) in the dictionary.
- Parameters
key – a key,
"nested.key.path"
, or dict mapping multiple possibly-nested keys to valuesvalue (None) – the value, if key is a string
-
get
(key, default=None)¶ Gets a value from the dictionary.
- Parameters
key – a key or
"nested.key.path"
default (None) – a default value if the key is not found
- Returns
the value
-
clear
()¶ Clears the dictionary.
-
class
fiftyone.operators.panel.
PanelRefState
(ctx)¶ Bases:
fiftyone.operators.panel.PanelRefBase
Class representing the state of a panel.
- Parameters
ctx – an
fiftyone.operators.executor.ExecutionContext
Methods:
set
(key[, value])Sets some panel state.
clear
()Clears the panel state.
apply
(path)Applies the state to the panel.
get
(key[, default])Gets a value from the dictionary.
-
set
(key, value=None)¶ Sets some panel state.
- Parameters
key – a key,
"nested.key.path"
, or dict mapping multiple possibly-nested keys to valuesvalue (None) – the value, if key is a string
-
clear
()¶ Clears the panel state.
-
apply
(path)¶ Applies the state to the panel.
- Parameters
path (str) – The path to the state.
-
get
(key, default=None)¶ Gets a value from the dictionary.
- Parameters
key – a key or
"nested.key.path"
default (None) – a default value if the key is not found
- Returns
the value
-
class
fiftyone.operators.panel.
PanelRefData
(ctx)¶ Bases:
fiftyone.operators.panel.PanelRefBase
Class representing the data of a panel.
- Parameters
ctx – an
fiftyone.operators.executor.ExecutionContext
Methods:
set
(key[, value])Sets some panel data.
get
(key[, default])Gets a value from the dictionary.
clear
()Clears the panel data.
-
set
(key, value=None)¶ Sets some panel data.
- Parameters
key – a key,
"nested.key.path"
, or dict mapping multiple possibly-nested keys to valuesvalue (None) – the value, if key is a string
-
get
(key, default=None)¶ Gets a value from the dictionary.
- Parameters
key – a key or
"nested.key.path"
default (None) – a default value if the key is not found
- Returns
the value
-
clear
()¶ Clears the panel data.
-
class
fiftyone.operators.panel.
PanelRef
(ctx)¶ Bases:
object
Class representing a panel.
- Parameters
ctx – an
fiftyone.operators.executor.ExecutionContext
Attributes:
Panel data.
Panel state.
Panel ID.
Methods:
close
()Closes the panel.
set_state
(key[, value])Sets some panel state.
get_state
(key[, default])Gets some panel state.
set_data
(key[, value])Sets some panel data.
set_title
(title)Sets the title of the panel.
-
property
data
¶ Panel data.
-
property
state
¶ Panel state.
-
property
id
¶ Panel ID.
-
close
()¶ Closes the panel.
-
set_state
(key, value=None)¶ Sets some panel state.
- Parameters
key – a key,
"nested.key.path"
, or dict mapping multiple possibly-nested keys to valuesvalue (None) – the value, if key is a string
-
get_state
(key, default=None)¶ Gets some panel state.
- Parameters
key – the key or
"nested.key.path"
default (None) – a default value if the key is not found
- Returns
the state value
-
set_data
(key, value=None)¶ Sets some panel data.
- Parameters
key – a key,
"nested.key.path"
, or dict mapping multiple possibly-nested keys to valuesvalue (None) – the value, if key is a string
-
set_title
(title)¶ Sets the title of the panel.
- Parameters
title – a title string