fiftyone.operators.panel#

FiftyOne panels.

Copyright 2017-2025, Voxel51, Inc.

Classes:

PanelConfig(name, label[, help_markdown, ...])

Configuration for a panel.

Panel([_builtin])

A panel.

PanelRefBase(ctx)

Base class for panel state and data.

PanelRefState(ctx)

Class representing the state of a panel.

PanelRefData(ctx)

Class representing the data of a panel.

PanelRef(ctx)

Class representing a panel.

Exceptions:

WriteOnlyError

Error raised when trying to read a write-only property.

class fiftyone.operators.panel.PanelConfig(name, label, help_markdown=None, alpha=False, beta=False, is_new=False, category=None, icon=None, light_icon=None, dark_icon=None, allow_multiple=False, surfaces: Literal['grid', 'modal', 'grid modal'] = 'grid', priority=None, **kwargs)#

Bases: 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

  • 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

  • category (Category) – the category id of the panel

  • priority (None) – the priority of the panel for sorting in the UI

Methods:

to_json()#
class fiftyone.operators.panel.Panel(_builtin=False)#

Bases: 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.

resolve_execution_options(ctx)

Returns the resolved execution options.

resolve_output(ctx)

Returns the resolved output property.

resolve_placement(ctx)

Returns the resolved placement of the operator.

resolve_run_name(ctx)

Returns the resolved run name of the operator.

resolve_type(ctx, type)

Returns the resolved input or output property.

to_json()

Returns a JSON representation of the operator.

Attributes:

builtin

Whether the operator is builtin.

config

The OperatorConfig for the operator.

name

uri

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:

a fiftyone.operators.types.Property

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_run_name(ctx)#

Returns the resolved run name of the operator.

Subclasses can implement this method to define the run name of the operator.

Parameters:

ctx – the fiftyone.operators.executor.ExecutionContext

Returns:

a string, or None

resolve_type(ctx, type)#

Returns the resolved input or output property.

Parameters:
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.

Methods:

add_note

Exception.add_note(note) -- add a note to the exception

with_traceback

Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.

Attributes:

add_note()#

Exception.add_note(note) – add a note to the exception

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 values

  • value (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: 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 values

  • value (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: 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 values

  • value (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:

data

Panel data.

state

Panel state.

id

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 values

  • value (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 values

  • value (None) – the value, if key is a string

set_title(title)#

Sets the title of the panel.

Parameters:

title – a title string