The widgets.misc sub-package#

Package with miscellaneous individual QWidgets.

class pydidas.widgets.misc.LineEditWithIcon(icon=None, **kwargs)#

Bases: QLineEdit

A QLineEdit with an added icon.

Parameters:
  • parent (QWidget, optional) – The Qt parent widget. The default is None.

  • **kwargs (Any supported Qt arguments) – Any arguments which have an associated setArgName method in Qt can be defined at creation.

class pydidas.widgets.misc.PointsForBeamcenterWidget(plot: Any, parent: Any = None, **kwargs: Any)#

Bases: QWidget, CreateWidgetsMixIn, ParameterWidgetsMixIn

A widget to display a list of points in an associated plot.

add_point_to_table(xpos: float, ypos: float) None#

Add a newly selected point to the table.

Parameters:
  • xpos (float) – The x position.

  • ypos (float) – The y position.

process_new_font_metrics(char_width: float, char_height: float) None#

Adjust the widget’s width based on the font metrics.

Parameters:
  • char_width (float) – The font width in pixels.

  • char_height (float) – The font height in pixels.

class pydidas.widgets.misc.ReadOnlyTextWidget(parent: QWidget | None = None, **kwargs: Any)#

Bases: PydidasWidgetMixin, QTextEdit

A QTextEdit widget with advanced text display and formatting support.

The ReadOnlyTextWidget is a subclass of QTextEdit and is used to display scrollable text. It allows four formatters for text.

  • ‘plain’ : No indent and regular text

  • ‘header’ : No indent and bold font

  • ‘section’ : A single indent level and regular text

  • ‘subsection’ : Two indent levels and regular text

The formats can be specified in the set_text or append_text method or by supplying a list of items.

Parameters:
  • parent (QWidget, optional) – The Qt parent widget. The default is None.

  • **kwargs (Any) – Any arguments which have an associated setArgName method in Qt can be used at creation.

append_text(text: str, formatter: str = 'plain') None#

Append text to the widget with a specified formatter.

Parameters:
  • text (str) – The text to be appended.

  • formatter (str) – The formatter of the text. Can be ‘plain’, ‘header’, ‘section’, or ‘subsection’. The default is ‘plain’.

clear() None#

Clear the widget and reset the content tracking.

property default_text: list[tuple[str, str]]#

Get the default text (the first entry in the content list).

prepend_text(text: str, formatter: str = 'plain') None#

Prepend text to the widget with a specified formatter.

Parameters:
  • text (str) – The text to be appended.

  • formatter (str) – The formatter of the text. Can be ‘plain’, ‘header’, ‘section’, or ‘subsection’. The default is ‘plain’.

reprint() None#

Reprint the latest text with the updated font settings.

setText(text: str, title: str = '') None#

Set the widget’s text.

Parameters:
  • text (str) – The text to be displayed.

  • title (str) – The title. If an empty string, no title will be printed. The default is ‘’.

set_text(text: str, title: str = '') None#

Set the widget’s text.

Parameters:
  • text (str) – The text to be displayed.

  • title (str) – The title. If an empty string, no title will be printed. The default is ‘’.

set_text_from_list(text_list: list[tuple[str, str]], title: str = '') None#

Set the widget’s text from a list of entries.

Each entry in the list is a tuple with the first element being the type of the entry (header, section, subsection) and the second element being the value. The type will determine the formatting of the entry.

Parameters:
  • text_list (list[tuple[str, str]]) – The list of entries. Each entry is a tuple with the formatter key and text entries to be displayed.

  • title (str) – The title. If an empty string, no title will be printed. The default is ‘’.

set_title(title: str) None#

Update the displayed title without changing the text.

Parameters:

title (str) – The new title.

class pydidas.widgets.misc.ShowIntegrationRoiParamsWidget(**kwargs: Any)#

Bases: WidgetWithParameterCollection

Widget to display Parameters for the integration region.

The Parameter widgets are created for an associated plugin which is not owned by this widget.

clear_plugin_widgets() None#

Clear the plugin_container widget to create new widgets.

create_widgets_for_axis(plugin: BasePlugin, axis: Literal['rad', 'azi']) None#

Create the widgets for the given axis.

Parameters:
  • plugin (pydidas.plugins.BasePlugin) – The plugin for which widgets shall be created.

  • axis (Literal["rad", "azi"]) – The axis name.

toggle_enable(enabled: bool) None#

Toggle the selection mode and enable/disable the Parameter widgets.

Parameters:

enabled (bool) – Editing enabled flag.