brace.UI package

Subpackages

Submodules

brace.UI.ConfigurationGrid module

class brace.UI.ConfigurationGrid.ConfigurationGrid(parent=None)[source]

Bases: QWidget, Ui_ConfigurationGrid

This widget is the Configuration box that contains all of the fields that may be used in changing parameters in the remote. It is also used in the simulator, with one constant set on the top and another mutable set on the bottom.

staticMetaObject = PySide6.QtCore.QMetaObject("ConfigurationGrid" inherits "QWidget": )

brace.UI.ExperimentGroup module

class brace.UI.ExperimentGroup.ExperimentGroup(parent=None)[source]

Bases: QWidget, Ui_UBQVisitTrials

This widget is found on the right of the calibrate button. Sets subject, visit, and trial numbers that are used in the filenames of saved files.

getNumbers() tuple[int, int, int][source]
staticMetaObject = PySide6.QtCore.QMetaObject("ExperimentGroup" inherits "QWidget": )

brace.UI.GraphContext module

class brace.UI.GraphContext.GraphContext(fig: HideableElementsGraphicsLayoutWidget, axes: np.ndarray[PlotItem], axisLines: dict[type, dict[str, PlotDataItem]], simulatorAxisLines: dict[type, dict[str, PlotDataItem]], toggleHBoxLayout: QHBoxLayout, dataType: type, controlLogicType: IntEnum, getConfigurationChangesFunc: Callable[[dict[str, QWidget], ConfigurationGrid], tuple[dict[str, Any], dict[str, Any]]], validateConfigurationFunc: Callable[[ConfigurationGrid, bool, bool, dict[str, float]], bool], writeConfigurationChangesFunc: Callable[[dict[str, Any], dict[str, Any]], None], resetGraphXLimitsFunc: Callable[[np.ndarray[PlotItem], int], None], readConfigurationFromControllerFunc: Callable[[dict[str, Any], bool], None], readConfigurationFromSaveFileFunc: Callable[[dict[str, QWidget], dict[str, Any], bool], None], adjustPlotThresholdValuesFunc: Callable[[MainWindow | Simulator, dict[str, Any], dict[str, Any]], None])[source]

Bases: object

A GraphContext wraps up a set of related widgets, datatypes, and callable functions that should be used together especially with the context of the GUI.

Parameters:
  • fig (HideableElementsGraphicsLayoutWidget) – The HideableElementsGraphicsLayoutWidget or GraphicsLayoutWidget that contains the plots.

  • axes (numpy.ndarray[PlotItem]) – The array of PlotItems that the fig contains.

  • axisLines (dict[type, dict[str, Line2D]]) – The dictionary that organizes the graph lines hierarchically by type then by attribute.

  • simulatorAxisLines (dict[type, dict[str, PlotDataItem]]) – The dictionary that organizes simulator graph lines hierarchically by type then by attribute.

  • toggleHBoxLayout – The small horizontal box layout that contains programmatically defined checkboxes for hiding/showing

checkboxes for the plots. :type toggleHBoxLayout: QHBoxLayout :param dataType: The data type that overall belongs to this particular set of plots. :type dataType: type :param controlLogicType: The enum of the respective control logic with this particular dataset. :type controlLogicType: IntEnum :param getConfigurationChangesFunc: A Callable function that gets the current configuration from the GUI :type getConfigurationChangesFunc: Callable[[dict[str, QWidget], ConfigurationGrid], tuple[dict[str, Any], dict[str, Any]]] :param validateConfigurationFunc: A Callable function that validates the configuration input in the GUI. :type validateConfigurationFunc: Callable[[ConfigurationGrid, bool, bool, dict[str, float]], bool] :param writeConfigurationChangesFunc: A Callable function that writes the configuration to the remote and may update threshold lines. :type writeConfigurationChangesFunc: Callable[[dict[str, Any], dict[str, Any]], None] :param resetGraphXLimitsFunc: A Callable function that resets the graphs back to some initial state before streaming starts again. :type resetGraphXLimitsFunc: Callable[[np.ndarray[PlotItem], int], None] :param readConfigurationFromControllerFunc: A Callable function that reads the configuration from the remote to the GUI. :type readConfigurationFromControllerFunc: Callable[[dict[str, Any], bool], None] :param readConfigurationFromSaveFileFunc: A Callable function that reads the configuration from JSON configuration file to the GUI. :type readConfigurationFromSaveFileFunc: Callable[[dict[str, QWidget], dict[str, Any], bool], None] :param adjustPlotThresholdValuesFunc: A Callable function that adjusts any threshold lines in the plots particularly when parameters are updated. :type adjustPlotThresholdValuesFunc: Callable[[MainWindow | Simulator, dict[str, Any], dict[str, Any]], None]

brace.UI.LoggingHelpers module

class brace.UI.LoggingHelpers.TextBrowserHandler(level=0)[source]

Bases: Handler

RED_WARN = 'RED_WARN'
emit(record)[source]

Emits out the record onto the textbox. If the record is given a RED_WARN, then the text will be bolded.

lock = <RLock(None, 0)>
textBrowser: QTextBrowser
brace.UI.LoggingHelpers.joinStringsWithSpace(*argv) str[source]
brace.UI.LoggingHelpers.redBoldText(stringToBold: str) str[source]

Formats the text to be red and bold when displayed out to the textbox.

Parameters:

stringToBold (str) – The string that should be displayed as bold.

Returns:

A bolded and red string using tags.

Return type:

str

brace.UI.PlotsPage module

class brace.UI.PlotsPage.PlotsPage(parent=None)[source]

Bases: QWidget, Ui_PlotsPage

The box on the GUI that contains the plots in separate tabs.

staticMetaObject = PySide6.QtCore.QMetaObject("PlotsPage" inherits "QWidget": )

brace.UI.SaveDialog module

class brace.UI.SaveDialog.SaveDialog(parent: MainWindow, animatedGraphManager: AnimatedGraphManager, startStreamUnixTime: float, controlLogicEnumType: type)[source]

Bases: Ui_SaveDialog, QDialog

This dialog box is shown when the user stops streaming. It will ask the user whether or not the streamed data should be saved before enacting on the user decision.

static exporterFactory(suffix: str) AbstractDataExporter[source]

Gets the exporter based on the suffix of the file.

Parameters:

suffix (str) – The file extension to be used for the file.

Returns:

The exporter that should be used for the graphed data.

Return type:

AbstractDataExporter

static saveStreamedData(parent: MainWindow, animatedGraphManager: AnimatedGraphManager, startStreamUnixTime: float, controlLogicEnumType: type) None[source]

Saves the stream data, getting the experiment numbers and formatting the time in the filename. Trial numbers are incremented after a successful save for convenience.

Parameters:
  • parent (MainWindow) – The parent saving GUI that runs this dialog.

  • animatedGraphManager (AnimatedGraphManager) – The manager that holds all of the graphed data to be exported.

  • startStreamUnixTime (float) – The estimated time when the stream was started using seconds from the Unix epoch.

  • controlLogicEnumType (type) – The Enum type that facilitates the state of which control logic was used. Used in converting values.

staticMetaObject = PySide6.QtCore.QMetaObject("SaveDialog" inherits "QDialog": Methods:   #41 type=Slot, signature=saveStreamedData() )

brace.UI.SimulatorConfigurationButtons module

class brace.UI.SimulatorConfigurationButtons.SimulatorConfigurationButtons(parent=None)[source]

Bases: QWidget, Ui_ConfigurationButtons

These are the configuration buttons used in the simulator underneath the configuration box.

staticMetaObject = PySide6.QtCore.QMetaObject("SimulatorConfigurationButtons" inherits "QWidget": )
toggleConfigurationButtons(enable: bool) None[source]

brace.UI.WindowConfigurationButtons module

class brace.UI.WindowConfigurationButtons.WindowConfigurationButtons(parent=None)[source]

Bases: QWidget, Ui_ConfigurationButtons

These are the configuration buttons that are in the main GUI that are found below the configuration box.

staticMetaObject = PySide6.QtCore.QMetaObject("WindowConfigurationButtons" inherits "QWidget": )
toggleDisabledConfigurationWidgets(disabled: bool) None[source]

Module contents