icat.item.ItemViewer#

class icat.item.ItemViewer(index=0, width=700, height=800, data=None, **params)#

Bases: Viewer

Interface for viewing and labeling a single item, useful for looking at more than just a snippet of the full text.

Parameters:
  • index (int) – The row index of the entry in the dataframe to view.

  • width (int) – The width of the rendered card.

  • height (int) – The height of the rendered card.

  • data (DataManager) – The parent data manager to pull the item from.

Methods

__init__([index, width, height, data])

fire_on_label_changed(label)

on_label_changed(callback)

Register a callback function for the "label changed" event.

populate(index)

Fill or update all of the fields for the given index.

servable([title, location, area, target])

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

show([title, port, address, ...])

Starts a Bokeh server and displays the Viewable in a new tab.

Attributes

name

param

fire_on_label_changed(label)#
Parameters:

label (int) –

name = 'ItemViewer'#
on_label_changed(callback)#

Register a callback function for the “label changed” event.

Callbacks for this event should take two parameters: * index of labeled point (int) * label value (int)

Parameters:

callback (Callable) –

populate(index)#

Fill or update all of the fields for the given index. This should be called anytime the model updates, or when the user clicks/requests to view a new instance.

Parameters:

index (int) – The row index of the item to display from parent DataManager’s active_data.