The widgets.dialogues sub-package#

Subpackage with PyQt dialogues.

class pydidas.widgets.dialogues.AcknowledgeBox(*args: tuple, **kwargs: dict)#

Bases: QDialog, CreateWidgetsMixIn

Show a dialogue box with information to be acknowledged.

Parameters:
  • *args (tuple) – Arguments passed to QtWidgets.QDialogue instanciation.

  • **kwargs (dict) –

    Supported keywords are:

    textstr, optional

    The notice text to be displayed. The text will be formatted to a line length of a maximum of 60 characters.

    text_preformattedbool, optional

    Flag to keep the text formatting and not to auto-format the text to keep a width of < 60 characters.

    titlestr, optional

    The title of the box. The default is “Notice”

close()#

Close the widget and store the acknowledge state.

set_text(text: str, pre_formatted: bool = False)#

Set the text in the message box.

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

  • pre_formatted (bool, optional) – Flag to keep the text formatting. The default is False.

class pydidas.widgets.dialogues.ErrorMessageBox(*args: tuple, **kwargs: dict)#

Bases: QDialog, CreateWidgetsMixIn

Show a dialogue box with exception information.

Parameters:
  • *args (tuple) – Arguments passed to QtWidgets.QDialogue instanciation.

  • **kwargs (dict) – Keyword arguments passed to QtWidgets.QDialogue instanciation.

copy_to_clipboard_and_open_webpage()#

Copy the trace to the clipboard and open the URL for the pydidas feedback form.

set_text(text: str)#

Set the text in the message box.

Parameters:

text (str) – The text to be displayed.

class pydidas.widgets.dialogues.Hdf5DatasetSelectionPopup(parent: None | QWidget = None, fname: None | Path = None)#

Bases: QInputDialog

A dialogue for showing a pop-up dialogue to select a dataset from an hdf5 file.

Parameters:
  • parent (Union[None, QWidget]) – The parent widget

  • fname (Union[str, pathlib.Path]) – The file path to the hdf5 file.

get_dset() Hdf5key | None#

Show the QInputDialog.

Returns:

If the dialogue is accepted, returns the selected Hdf5key. If it is aborted, it will return None.

Return type:

Union[Hdf5key, None]

set_filename(fname: Path | str)#

Set the filename for the Hdf5 file.

Parameters:

fname (str) – The full path to the Hdf5 file.

class pydidas.widgets.dialogues.PydidasExceptionMessageBox(*args: tuple, **kwargs: dict)#

Bases: QDialog, CreateWidgetsMixIn

Show a dialogue box with exception information.

Parameters:
  • *args (tuple) – Arguments passed to QtWidgets.QDialogue instanciation.

  • **kwargs (dict) –

    Supported keyword arguments are:

    textstr, optional

    The error string. The default is an empty string.

    titlestr, optional

    The window title. The default is “Configuration error”.

set_text(text: str)#

Set the text in the message box.

Parameters:

text (str) – The text to be displayed.

class pydidas.widgets.dialogues.QuestionBox(title: str, question: str, explanation: str = '', parent: None | QWidget = None, default: StandardButton = 65536, tooltip: str = '')#

Bases: QMessageBox

Show a dialogue box with a yes/no question.

Parameters:
  • title (str) – The QuestionBox title.

  • question (str) – The question text.

  • explanation (str, optional) – An explanatory text to amend the question text.

  • parent (Union[None, QtWidgets.QWidget], optional) – The parent widget. The default is None.

  • default (QtWidgets.QMessageBox.StandardButton, optional) – The default pre-selected button. The default is No.

  • tooltip (str, optional) – The tooltip text for the dialog. The default is an empty string.

exec_() bool#

Show the box.

This method will show the QuestionBox

class pydidas.widgets.dialogues.WarningBox(title: str, msg: str, info: str = '', details: str = '')#

Bases: QMessageBox

A QMessageBox with simplified calling syntax to generate a user warning.

The WarningBox class will set title and message of the QMessageBox and call the execute function to display it with a single line of code.

Parameters:
  • title (str) – The message box title.

  • msg (str) – The message box text.

  • info (str, optional) – Additional informative text. The default is an empty string.

  • details (str, optional) – Addition details for the warning. The default is an empty string.

pydidas.widgets.dialogues.critical_warning(title: str, text: str)#

Create a QMessageBox with a critical warning and show it.

Parameters:
  • title (str) – The warning title.

  • text (str) – The warning message text.