hyperspy.ui_registry module

Registry of user interface widgets.

Format {“tool_key” : {“toolkit” : <function(obj, display, **kwargs)>}}

The tool_key` is defined by the "model function" to which the widget provides and user interface. That function gets the widget function from this registry and executes it passing the ``obj, display and any extra keyword arguments. When display is true, function displays the widget. If False it returns a dictionary with whatever is needed to display the widgets externally (usually for testing or customisation purposes).

hyperspy.ui_registry.DISPLAY_DT = 'display : bool\n If True, display the user interface widgets. If False, return the \n widgets container in a dictionary, usually for customisation or \n testing.'
hyperspy.ui_registry.GUI_DT = 'Display or return interactive GUI element if available.\n\nParameters\n----------\ndisplay : bool\n If True, display the user interface widgets. If False, return the \n widgets container in a dictionary, usually for customisation or \n testing.\ntoolkit : str, iterable of strings or None\n If None (default), all available widgets are displayed or returned. \n If string, only the widgets of the selected toolkit are displayed \n if available. If an interable of toolkit strings, the widgets of \n all listed toolkits are displayed or returned.\n\n'
hyperspy.ui_registry.KNOWN_TOOLKITS = {'ipywidgets', 'traitsui'}
hyperspy.ui_registry.TOOLKIT_DT = 'toolkit : str, iterable of strings or None\n If None (default), all available widgets are displayed or returned. \n If string, only the widgets of the selected toolkit are displayed \n if available. If an interable of toolkit strings, the widgets of \n all listed toolkits are displayed or returned.'
hyperspy.ui_registry.TOOLKIT_REGISTRY = {}
hyperspy.ui_registry.UI_REGISTRY = {'AxesManager': {}, 'CircleROI': {}, 'Component': {}, 'DataAxis': {}, 'EELSCLEdge_Component': {}, 'Line2DROI': {}, 'Model': {}, 'Model1D.fit_component': {}, 'Parameter': {}, 'Point1DROI': {}, 'Point2DROI': {}, 'Preferences': {}, 'RectangularROI': {}, 'ScalableFixedPattern_Component': {}, 'Signal1D.calibrate': {}, 'Signal1D.contrast_editor': {}, 'Signal1D.integrate_in_range': {}, 'Signal1D.remove_background': {}, 'Signal1D.smooth_butterworth': {}, 'Signal1D.smooth_lowess': {}, 'Signal1D.smooth_savitzky_golay': {}, 'Signal1D.smooth_total_variation': {}, 'Signal1D.spikes_removal_tool': {}, 'SimpleMessage': {}, 'SpanROI': {}, 'interactive_range_selector': {}, 'load': {}, 'microscope_parameters_EDS_SEM': {}, 'microscope_parameters_EDS_TEM': {}, 'microscope_parameters_EELS': {}, 'navigation_sliders': {}}
hyperspy.ui_registry.add_gui_method(toolkey)
hyperspy.ui_registry.get_gui(self, toolkey, display=True, toolkit=None, **kwargs)
hyperspy.ui_registry.get_partial_gui(toolkey)
hyperspy.ui_registry.register_toolkey(toolkey)

Register a toolkey.

Parameters

toolkey (string) –

hyperspy.ui_registry.register_widget(toolkit, toolkey)

Decorator to register a UI widget.

Parameters
  • f (function) – Function that returns or display the UI widget. The signature must include obj, display and **kwargs.

  • toolkit (string) – The name of the widget toolkit e.g. ipywidgets

  • toolkey (string) – The “key” of the tool for which the widget provides an interface. If the toolkey is not in the UI_REGISTRY dictionary a NameError is raised.

Returns

widgets – Dictionary containing the widget objects if display is False, else None.

Return type

dictionary or None