open_viewmin.filter_tree_plot.widget_formulas#

Classes#

WidgetFormula

Class for creating re-usable widgets

Module Contents#

class WidgetFormula(plotter, name=None, mesh_name=None, enabled=True, callback=None, creator=None, configure=None, widget_args=None, **kwargs)#

Class for creating re-usable widgets

Parameters:
  • plotter (FilterTreePlot)

  • name (str or None) – Name of widget. Pass None to default to “_widget” appended to parent_mesh_name.

  • mesh_name (str or None) – Name of mesh controlled by widget. Pass None to default to plotter’s default mesh name.

  • enabled (bool, optional) – Whether to initialize widget as enabled.

  • callback (callable()) – Function mapping (plotter, parent_mesh_name) to a callable that applies the widget to update its mesh.

  • creator (callable()) – Function creating the widget. First argument must be a function of the kind created by callback(plotter, parent_mesh_name). Must also accept all arguments in widget_args and keyword arguments in kwargs.

  • configure (callable() or None, optional) – Function configuring a widget based on previously existing widget, mapping the widget to a two-element tuple (enabled: bool, widget_args: tuple). Pass None to ignore.

  • widget_args (tuple or None) – Positional arguments, besides callback, to creator. None is equivalent to empty tuple.

  • kwargs (dict, optional) – Keyword arguments to creator.

apply()#

Create the widget and apply it to create the mesh it controls

check_existing_widget_configuration()#

Get information to configure widget according to previous settings

Returns:

Whether widget is enabled; widget arguments.

Return type:

(bool, tuple)

get_creator_func()#

If self.creator is a string, get the corresponding callable

Return type:

callable()

set_color(*widget_color)#

Set widget color

Note that this does not control the color of any mesh.

Parameters:

widget_color (tuple) – Color as rgb floats, or as one-element tuple containing string of color name or hex value.

set_outline_visibility(visibility: int)#

Set visibility of a widget’s box outline

Parameters:

visibility (int) – Make outline visible unless visibility equals 0.

update()#

Update mesh controlled by widget.

Configure widget according to previous settings, then apply the widget’s callback.

callback#
color = None#
configure#
creator#
enabled#
plotter#
property widget#
Get widget
Return type:

VTK widget

widget_kwargs#