The widgets.controllers sub-package#
Package with widget controllers.
- class pydidas.widgets.controllers.ManuallySetBeamcenterController(master: BaseFrame, plot: PydidasPlot2d, point_table: PointsForBeamcenterWidget, **kwargs: dict)#
Bases:
QObject
This class manages manually selecting and editing the beamcenter.
This controller requires a PydidasPlot2D to pick up selected points and to draw the markers, as well as a master widget which controls the beamcenter Parameters and a PointPositionTableWidget to represent the points.
- Parameters:
master (pydidas.widgets.framework.BaseFrame) – The master widget which displays the information.
plot (pydidas.widgets.silx_plot.PydidasPlot2D) – The plot to draw markers etc.
point_table (pydidas.widgets.misc.PointsForBeamcenterWidget) – The table to store the selected points.
- property beamcenter_is_set: bool#
Get the flag whether the beamcenter has been set.
- Returns:
Flag whether the beamcenter has been set.
- Return type:
bool
- fit_beamcenter_with_circle()#
Fit the beamcenter through a circle.
- fit_beamcenter_with_ellipse()#
Fit the beamcenter through an ellipse.
- manual_beamcenter_update(*arg)#
Process a manual update of the beamcenter x/y Parameter.
- property points: tuple[ndarray, ndarray]#
The points marked in the image.
- Returns:
x_positions (np.ndarray) – The x values of the selected points.
y_positions (np.ndarray) – The y values of the selected points.
- remove_plot_items(*kind: tuple[Literal['all', 'marker', 'beamcenter', 'beamcenter_outline']])#
Remove the selected items from the plot.
- Parameters:
*kind (tuple[Literal["all", "marker", "beamcenter", "beamcenter_outline"]]) – The kind of items to be removed.
- property selected_points: tuple[ndarray, ndarray]#
The currently selected points in the image.
- Returns:
x_positions (np.ndarray) – The x values of the selected points.
y_positions (np.ndarray) – The y values of the selected points.
- property selection_active: bool#
Get the flag whether the selection is active.
- Returns:
Selection active flag.
- Return type:
bool
- set_beamcenter_from_point()#
Set the beamcenter from a single point.
- set_marker_color(color: str)#
Set the marker color for the markers.
- Parameters:
color (str) – The new color name.
- set_mask_file(mask: None | Path)#
Set the mask file.
- Parameters:
mask (Union[None, Path]) – The path to the mask file or None to skip masking.
- set_new_detector_with_mask(detector_name: str)#
Process the input of a new detector to select the generic mask.
- Parameters:
detector_name (str) – The name of the detector.
- show_plot_items(*kind: tuple[Literal['all', 'marker', 'beamcenter', 'beamcenter_outline']])#
Show the selected items in the plot.
- Parameters:
*kind (tuple[Literal["all", "marker", "beamcenter", "beamcenter_outline"]]) – The kind of items to be removed.
- toggle_2click_selection(use_2_clicks: bool)#
Toggle the 2-click selection for points.
- Parameters:
use_2_clicks (bool) – Flag to activate/deactivate 2-point selection.
- toggle_selection_active(active: bool)#
Toggle the selection mode.
- Parameters:
active (bool) – The new activation state.
- class pydidas.widgets.controllers.ManuallySetIntegrationRoiController(editor: QWidget, plot: QWidget, **kwargs: dict)#
Bases:
QObject
A controller to handle manually setting the integration region.
This controller connects a plot widget (PydidasPlot2d instance) with the editor which holds the references to the Parameters for the integration ROI bounds. It allows to draw the boundaries of the integration ROI in the plot (assuming that the DiffractionExperimentContext has been set). If enabled, it picks up clicks in the plot widget and updates the respective Parameters and draws the new bounds in the plot.
- Parameters:
editor (pydidas.widgets.misc.ShowIntegrationRoiParamsWidget) – The ShowIntegrationRoiParamsWidget instance to display parameter values.
plot (pydidas.widgets.silx_plot.PydidasPlot2DwithIntegrationRegions) – The plot to display the ROI.
**kwargs (dict) –
Supported keyword arguments are:
- pluginpydidas.plugins.BasePlugin
The plugin to be edited.
- forced_edit_disablebool
Flag to force
- property enabled: bool#
Get the enabled status flag.
- Returns:
The enabled status.
- Return type:
bool
- remove_plot_items(*kind: tuple[Literal['azimuthal', 'radial', 'roi', 'all']])#
Remove the items for the given kind from the plot.
- Parameters:
*kind (tuple[Literal["azimuthal", "radial", "roi", "all"]]) – The kind or markers to be removed.
- reset_plugin()#
Reset the plugin to the start values.
- reset_selection_mode()#
Reset the selection mode and restore button functionality.
- set_new_marker_color(color: str)#
Set the new color for the markers.
- Parameters:
color (str) – The name of the new color.
- set_new_plugin(plugin: BasePlugin)#
Set a new connected plugin.
- Parameters:
plugin (pydidas.plugins.BasePlugin) – The plugin to be edited
- set_param_value_and_widget(key: str, value: object)#
Set the Plugin’s Parameter value and the widget display value.
- Parameters:
key (str) – The parameter reference key.
value (object) – The new value.
- show_plot_items(*kind: tuple[Literal['azimuthal', 'radial', 'roi', 'all']])#
Show the items for the given kind from the plot.
- Parameters:
*kind (tuple[Literal["azimuthal", "radial", "roi", "all"]]) – The kind or markers to be removed.
- toggle_enable(enabled: bool)#
Toggle the selection mode which disables the Parameter widgets.
- Parameters:
enabled (bool) – Flag whether the editing mode is active.
- toggle_marker_color_param_visibility(visible: bool)#
Toggle the visibility of the marker_color Parameter widget.
- Parameters:
visible (bool) – Visible status flag.
- update_input_widgets()#
Configure the input widget visibility based on the Parameter config.