open_viewmin.filter_tree_plot_Qt.widgets_Qt.controls

Contents

open_viewmin.filter_tree_plot_Qt.widgets_Qt.controls#

Routines to create actor control toolbars in the Qt GUI

Classes#

ActorControlToolbar

Toolbar with standard controls for an actor

ControlsCheckboxToolBar

Toolbar containing only a checkbox and its label

SliceControlsToolBar

For a plane widget, add an expandable set of rows to its controls

Functions#

add_toolbar_to_controls_dock_widget(plotter, toolbar_name)

add_viz_options_toolbar(plotter, actor_name[, label, ...])

Standard controls toolbar for each actor's rendering options

relink_visibility_checkbox(plotter, actor_name)

Make sure visibility checkbox state matches actor visibility,

set_lights_intensity_from_slider(plotter)

Set Plotter's lights intensity from the 'lighting' toolbar's slider

setup_animation_buttons(plotter)

Buttons for animations toolbar to change the frame number

setup_lighting_control(plotter)

Slider to change lighting intensity

setup_widget_control(plotter)

Add toolbar to controls dock containing checkboxes for enabling/disabling

Module Contents#

class ActorControlToolbar(plotter, actor_name, label=None)#

Bases: open_viewmin.filter_tree_plot_Qt.widgets_Qt.utilities_Qt.ControlsToolbar

Toolbar with standard controls for an actor

add_isosurface_qslider(min_val=None, max_val=None, **kwargs)#

Add slider control for value of isosurface filter

Parameters:
  • min_val (float | None)

  • max_val (float | None)

  • **kwargs (dict, optional) – Keyword arguments to get_min_max_scalars()

Return type:

ControlsSliderToolbar

add_property_toggle_checkbox(property_name, label=None)#

Add checkbox that toggles a named property with boolean value

Parameters:
  • property_name (str)

  • label (str | None)

Return type:

qw.QCheckBox

add_qslider(update_method, num_divs=100, init_val_percent=50, min_val=None, max_val=None, scalars=None, label_txt='')#

Add a slider control to the controls area

Parameters:
  • update_method (callable)

  • num_divs (int)

  • init_val_percent (int)

  • min_val (float | None)

  • max_val (float | None)

  • scalars (pv.pyvista_ndarray)

  • label_txt (str)

Return type:

ControlsSliderToolbar

add_qslider_type(type_string, **kwargs)#
Parameters:
Return type:

ControlsSliderToolbar

add_threshold_qslider(min_val=None, max_val=None, **kwargs)#

Add two-value slider control for min/max values of threshold filter

Parameters:
  • min_val (float | None)

  • max_val (float | None)

  • **kwargs (dict, optional) – Keyword arguments to add_qslider()

Return type:

ControlsSliderToolbar

add_threshold_text_controls(label='')#

Add text box controls for min/max values of a threshold filter

Parameters:

label (str)

add_to_plotter()#

Add this toolbar to its parent Plotter

add_visibility_checkbox()#

Add a checkbox that toggles an actor’s visibility

assign_checkbox_to_actor_visibility(actor_name=None)#

Couple toolbar’s visibility checkbox to the visibility of the associated actor

Parameters:

actor_name (str | None)

format_label_for_filters_tree(label)#

By default, label toolbar with name of associated actor

Parameters:

label (str | None)

Return type:

str

get_min_max_scalars(min_val=None, max_val=None)#

Get minimum and maximum values of a scalar dataset

Parameters:
  • min_val (float | None)

  • max_val (float | None)

Return type:

dict

isosurface_slider_callback(contour_value)#

Callback to update an isosurface filter

Parameters:

contour_value (float)

make_slice_slider_controls(widget_name=None, make_origin_slider=True)#

Make sliders that control a slice widget’s orientation and position

Parameters:
  • widget_name (str | None)

  • make_origin_slider (bool)

make_special_settings_button(callback)#

Make button that launches a settings dialog

Parameters:

callback (callable)

Make sure visibility checkbox state matches actor visibility, otherwise checkbox becomes unusable

set_label(text=None)#

Set toolbar’s label

Parameters:

text (str | None)

threshold_slider_callback(value_lims)#

Callback to update a threshold filter

Parameters:

value_lims (tuple(float, float))

wiggle_slider_to_update()#

For an actor with some feature controlled by a slider, move the slider right and left to force the actor to update

QSlider = None#
QSlider_target_type = ''#
actor_name#
mesh_options_button#
plotter#
slice_controls = None#
slider_toolbar = None#
visibility_checkbox#
visualization_options_button#
class ControlsCheckboxToolBar(plotter, name=None, label=None, icon_size=None, movable=True, floatable=True, items_dict_reference=None, init_state_callback=None, state_changed_callback=None, do_color_buttons=False)#

Bases: open_viewmin.filter_tree_plot_Qt.widgets_Qt.utilities_Qt.ControlsToolbar

Toolbar containing only a checkbox and its label

Parameters:
  • plotter (FilterTreePlotQt)

  • name (str | None)

  • label (str | None)

  • icon_size (int | None)

  • movable (bool)

  • floatable (bool)

  • items_dict_reference (dict | None)

  • init_state_callback (callable | None)

  • state_changed_callback (callable | None)

  • do_color_buttons (bool)

add_checkbox(item_name)#

Add checkbox to toolbar

Parameters:

item_name (str)

add_item(item_name, init_state_callback, state_changed_callback)#

Add checkbox to toolbar

Parameters:
  • item_name (str)

  • init_state_callback (callable | None)

  • state_changed_callback (callable | None)

make_label_a_color_button(item_name)#

Replace label of checkbox with a separate button that activates a color picker dialog for the widget

Parameters:

item_name (str)

populate()#

Recreate toolbar’s checkbox

refresh(item_name=None)#
refresh_all()#
checkbox_toolbars#
checkboxes#
color_button_enabled#
init_state_callback#
items#
items_dict_reference#
name#
plotter#
state_changed_callback#
class SliceControlsToolBar(parent_toolbar, widget_name: str | None = None, make_origin_slider: bool = True)#

Bases: qtpy.QtWidgets.QToolBar

For a plane widget, add an expandable set of rows to its controls toolbar to change its normal and origin

Parameters:
  • widget_name (Optional[str])

  • make_origin_slider (bool)

collapse()#

Increase control toolbar height, hiding slice-specific controls

create_orientation_button_callback(theta: float, phi: float)#

Callback to reset slice orientation

Parameters:
  • theta (polar angle)

  • phi (azimuthal angle)

Return type:

callable()

expand()#

Increase control toolbar height, revealing slice-specific controls

expand_or_collapse_control_toolbar()#

Toggle show/hide slice-specific controls

origin_reset_callback()#

Reset slice origin to center of volume

setup_orient_along_axes_buttons()#

Make buttons to orient slice normal along coordinate axes

setup_slice_control(label: str, minimum: float, maximum: float, init_val: float, slider_formula: callable, slider_inv_formula: callable, value_changed_callback: callable, use_ints: bool = False, slider_minimum: int = 0, slider_maximum: int | None = None)#

Set up controls for slice widget

Parameters:
  • label (str)

  • minimum (float)

  • maximum (float)

  • init_val (float)

  • slider_formula (callable)

  • slider_inv_formula (callable)

  • value_changed_callback (callable)

  • use_ints (bool)

  • slider_minimum (int)

  • slider_maximum (int | None)

Return type:

(qw.QSlider, qw.QSpinBox)

slice_origin_slider_value_changed_callback(value)#

Recreate slice after change in origin

Parameters:

value (float) – Shift along slice normal

Return type:

None

slice_phi_slider_formula(value: int) float#

Conversion from slider position to slice \(\phi\) value

Parameters:

value (int) – slider value

Return type:

float

slice_phi_slider_inv_formula(value: float) int#

Conversion from slice \(\theta\) value to slider position

Parameters:

value (float)

Return type:

int

slice_phi_slider_value_changed_callback(value)#

Recreate slice after change in azimuthal angle

Parameters:

value (float) – azimuthal angle

Return type:

None

slice_theta_slider_formula(value: int) float#

Conversion from slider position to slice \(\theta\) value

Parameters:

value (int) – slider value

Returns:

polar angle

Return type:

float

slice_theta_slider_inv_formula(value: float) int#

Conversion from slice \(\theta\) value to slider position

Parameters:

value (float) – polar angle

Returns:

slider value

Return type:

int

slice_theta_slider_value_changed_callback(value)#

Recreate slice after change in polar angle

Parameters:

value (float) – polar angle

Return type:

None

slice_value_changed_callback(key: str, value_callable: callable(float) | callable(int))#

Make callback executed when a slice widget is altered

Parameters:
  • key (str)

  • value_callable (callable)

Return type:

callable

QSliders#
actor_name#
current_phi#
current_theta#
expand_controls_button#
expanded = False#
input_boxes#
make_origin_slider#
max_slice_translate#
num_slider_divs#
parent_toolbar#
plotter#
slice_control_toolbar#
symbol = '⊞'#
widget#
property widget_formula#
Callback that updates the `slice` widget
Return type:

WidgetFormula

widget_name#
add_toolbar_to_controls_dock_widget(plotter, toolbar_name, orientation_int=2)#
Parameters:
  • plotter (FilterTreePlotQt)

  • toolbar_name (str)

  • orientation_int (int) – Horizontal (1) or vertical (2, default) toolbar orientation

add_viz_options_toolbar(plotter, actor_name, label=None, mesh_type=None)#

Standard controls toolbar for each actor’s rendering options

Parameters:
  • plotter (FilterTreePlotQt)

  • actor_name (str)

  • label (str | None)

  • mesh_type (str | None) – Acceptable strings are: “isosurface”, “threshold”, “slice”, “line”

Make sure visibility checkbox state matches actor visibility,

otherwise checkbox becomes unusable

Parameters:
set_lights_intensity_from_slider(plotter)#

Set Plotter’s lights intensity from the ‘lighting’ toolbar’s slider

Parameters:

plotter (FilterTreePlotQt)

setup_animation_buttons(plotter)#

Buttons for animations toolbar to change the frame number

Parameters:

plotter (FilterTreePlotQt)

setup_lighting_control(plotter)#

Slider to change lighting intensity

Parameters:

plotter (FilterTreePlotQt)

setup_widget_control(plotter)#

Add toolbar to controls dock containing checkboxes for enabling/disabling PyVista widgets.

Parameters:

plotter (FilterTreePlotQt)