The widgets.framework sub-package#

Package with modified widgets required for creating the pydidas graphical user interface.

class pydidas.widgets.framework.BaseFrame(**kwargs: dict)#

Bases: QWidget, ParameterCollectionMixIn, PydidasQsettingsMixin, CreateWidgetsMixIn, ParameterWidgetsMixIn

The BaseFrame is a subclassed QWidget and the base class for all Frames in pydidas.

By default, a QGridLayout is applied with an alignment of left/top.

Parameters:
  • **kwargs (dict) – Any additional keyword arguments which might be used by subclasses.

  • **init_layout (bool, optional) – Flag to initialize the frame layout with a QtWidgets.QGridLayout and left / top alignment. If False, no layout will be initialized and the subclass is responsible for setting up the layout. The default is True.

build_frame()#

Build all widgets of the frame.

closeEvent(event: QEvent)#

Reimplement the closeEvent to emit a signal about the closing.

Parameters:

event (QtCore.QEvent) – The event which triggered the closeEvent.

connect_signals()#

Connect all the required signals for the frame.

export_state()#

Export the state of the Frame for saving.

Returns:

  • frame_index (int) – The frame index which can be used as key for referencing the state.

  • information (dict) – A dictionary with all the information required to export the frame’s state.

finalize_ui()#

finalize the UI initialization.

frame_activated(index: int)#

Received signal that frame has been activated.

This method is called when this frame becomes activated by the central widget. By default, this method will perform no actions. If specific frames require any actions, they will need to overwrite this method.

Parameters:

index (int) – The index of the activated frame.

restore_state(state: dict)#

Restore the frame’s state from stored information.

The default implementation in the BaseFrame will update all Parameters (and associated widgets) and restore the visibility of all widgets. If the frame has not yet been built, the state information is only stored internally and not yet applied. It will be applied at the next frame activation.

Parameters:

state (dict) – A dictionary with ‘params’ and ‘visibility’ keys and the respective information for both.

set_status(text: str)#

Emit a status message to the main window.

Parameters:

text (str) – The status message to be emitted.

class pydidas.widgets.framework.BaseFrameWithApp(parent=None, **kwargs)#

Bases: BaseFrame

The BaseFrameWithApp is a subclassed BaseFrame with an associated pydidas App.

It should be used as the base class for all Frames with an associated Application in the pydidas suite.

It adds (internal) methods required for running a pydidas app to the BaseFrame.

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

  • **kwargs (dict) – Any additional keyword arguments.

  • **init_layout (bool) – Flag to initialize the frame layout with a QtWidgets.QVBoxLayout. If False, no layout will be initialized and the subclass is responsible for setting up the layout. The default is True.

export_state() Tuple[int, dict]#

Export the state of the Frame for saving.

This method adds an export for the frame’s app.

Returns:

  • frame_index (int) – The frame index which can be used as key for referencing the state.

  • information (dict) – A dictionary with all the information required to export the frame’s state.

restore_state(state: dict)#

Restore the frame’s state from stored information.

The BaseFrameWithApp implementation will update the associated App and then call the BaseFrame’s method.

Parameters:

state (dict) – A dictionary with ‘params’, ‘app’ and ‘visibility’ keys and the respective information for all.

class pydidas.widgets.framework.FontScalingToolbar(*args)#

Bases: QToolBar

A subclassed toolbar with automatic scaling based on the font metrics.

process_new_font_family()#

Redraw the toolbar with the new font family.

process_new_font_metrics(font_width: float, font_height: float)#

Process the new font height and adjust the ToolBar accordingly.

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

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

class pydidas.widgets.framework.PydidasWindow(**kwargs: dict)#

Bases: BaseFrame, PydidasWindowMixIn

The PydidasWindow is a standalone BaseFrame with a persistent geometry.

open_help()#

Open the help in a browser.

This slot will check whether a helpfile exists for the current frame and open the respective helpfile if it exits or the main documentation if it does not.

show()#

Overload the generic show method.

This makes sure that any show calls will have a fully built window.