Skip to content

Index

sgp.ui.widgets.__all__ module-attribute

__all__ = ['JupyterWidget', 'TabWindow', 'PropertyWidget', 'ScientificDoubleSpinBox', 'SplashScreen', 'TabWidget', 'TabWindow', 'TeXWidget']

sgp.ui.widgets.JupyterWidget

Bases: QtInProcessRichJupyterWidget, QWidget, QObject

Jupyter Qt Console Widget

sgp.ui.widgets.JupyterWidget.push

push(context: dict = None, **kwargs)

Push variables to the kernel.

PARAMETER DESCRIPTION
context

The context to push to the kernel.

TYPE: dict DEFAULT: None

**kwargs

The variables to push to the kernel.

DEFAULT: {}

sgp.ui.widgets.PropertyWidget

Bases: QWidget, QObject

Widget for displaying property items.

sgp.ui.widgets.PropertyWidget.__init__

__init__(name: str, value: float, enabled: bool = None, parent=None, *args, SpinBox: Type[QDoubleSpinBox] = QtWidgets.QDoubleSpinBox, **kwargs)

Initialize the PropertyWidget.

sgp.ui.widgets.PropertyWidget.isEnabled

isEnabled() -> bool

Get whether the PropertyWidget is enabled.

sgp.ui.widgets.PropertyWidget.setOptions

setOptions(**options)

Set the options of the PropertyWidget.

sgp.ui.widgets.PropertyWidget.setValue

setValue(value: float)

Set the value of the PropertyWidget.

sgp.ui.widgets.PropertyWidget.value

value() -> float

Get the value of the PropertyWidget.

sgp.ui.widgets.ScientificDoubleSpinBox

Bases: QDoubleSpinBox, QObject

A QDoubleSpinBox that displays floats in scientific notation.

sgp.ui.widgets.SplashScreen

Bases: QSplashScreen, QObject

Label to show splash screen with a close signal.

sgp.ui.widgets.TabWidget

Bases: QTabWidget

Tab widget with methods for adding tabs of any types.

sgp.ui.widgets.TabWidget.figures property

figures: dict[str, Figure]

Get all figures.

sgp.ui.widgets.TabWidget.addAnyTab

addAnyTab(widget: Type | QWidget, title: str, *args, **kwargs)

Add any tab to the tab widget.

PARAMETER DESCRIPTION
widget

A class or instance of the tab.

TYPE: Type | QWidget

title

The title of the tab.

TYPE: str

*args

The arguments and keyword arguments for the tab.

DEFAULT: ()

**kwargs

The arguments and keyword arguments for the tab.

DEFAULT: ()

sgp.ui.widgets.TabWidget.addFigureTab

addFigureTab(window: MainWindow, canvas: FigureCanvas)

Add a figure tab to the tab widget.

PARAMETER DESCRIPTION
window

The window to be displayed in the tab.

TYPE: MainWindow

canvas

The canvas to be displayed in the window.

TYPE: FigureCanvas

sgp.ui.widgets.TabWidget.addTableTab

addTableTab(data, title: str) -> TableWidget

Add a table tab to the tab widget.

PARAMETER DESCRIPTION
title

The title of the tab.

TYPE: str

data

The data to be displayed in the table.

TYPE: dict

sgp.ui.widgets.TabWidget.getCanvas

getCanvas(label: str) -> FigureCanvas

Get canvas with given label.

sgp.ui.widgets.TabWidget.getFigure

getFigure(label: str) -> Figure

Get figure with given label.

sgp.ui.widgets.TabWindow

Bases: QMainWindow, QObject

Window for displaying tabbed matplotlib figures or data tables.

sgp.ui.widgets.TabWindow.closeEvent

closeEvent(event: QCloseEvent)

Close all figures when closing window.

sgp.ui.widgets.TabWindow.closeTab

closeTab(index: int)

Close tab at given index and close window if it is the last tab.

sgp.ui.widgets.TeXWidget

Bases: QLabel, QObject

Render TeX formula to QLabel.

sgp.ui.widgets.TeXWidget.TeX2svg staticmethod

TeX2svg(formula, fontsize=12, dpi=300)

Render TeX formula to SVG. Args: formula (str): TeX formula. fontsize (int, optional): Font size. dpi (int, optional): DPI. Returns: str: SVG render.