brace.UI.GUIController package¶
Submodules¶
brace.UI.GUIController.DataExporters module¶
- class brace.UI.GUIController.DataExporters.AbstractDataExporter[source]¶
Bases:
ABCAn abstract class that exports the datastreams into a certain format.
- abstractmethod exportData(animatedGraphManager: AnimatedGraphManager, filename: str, startStreamUnixTime: float, controlLogicEnumType: type, parent: MainWindow = None) None[source]¶
An abstract method that should be implemented by all exporting classes, which formats the dataset into the desired data structure and file format.
- Parameters:
animatedGraphManager (AnimatedGraphManager) – The AnimatedGraphManager to export data.
filename (str) – The filename to export the data into.
startStreamUnixTime (float) – The starting time (referenced against Unix epoch) at which the stream has started.
controlLogicEnumType (type) – The enum type the control logic that is to checked against the remote (for configuration).
parent (MainWindow) – The main GUI that is exporting the data.
- Returns:
None
- Return type:
None
- exportDatastreamData(animatedGraphManager: AnimatedGraphManager, startStreamUnixTime: float) Generator[type, dict[str, list[float | int]]][source]¶
A helper that yields the type and the datastream data from the datastreams of an AnimatedGraphManager. Two times are listed, “t” which refers to the time offset to the local time which may be less precise (but useful for general times). Or “uptime” which should be used for all analyses as this time is offset from the beginning of the stream time (and is more precise).
- Parameters:
animatedGraphManager (AnimatedGraphManager) – The AnimatedGraphManager whose data should be exported.
startStreamUnixTime (float) – The local time of the time when the datastream was started (in seconds).
- Returns:
A generator containing a tuple of the type and the data of that datastream.
- Return type:
Generator[type, dict[str, list[float | int]]]
- class brace.UI.GUIController.DataExporters.HDF5Exporter[source]¶
Bases:
AbstractDataExporter- exportData(animatedGraphManager: AnimatedGraphManager, filename: str, startStreamUnixTime: float, controlLogicEnumType: type, parent: MainWindow = None) None[source]¶
An abstract method that should be implemented by all exporting classes, which formats the dataset into the desired data structure and file format.
- Parameters:
animatedGraphManager (AnimatedGraphManager) – The AnimatedGraphManager to export data.
filename (str) – The filename to export the data into.
startStreamUnixTime (float) – The starting time (referenced against Unix epoch) at which the stream has started.
controlLogicEnumType (type) – The enum type the control logic that is to checked against the remote (for configuration).
parent (MainWindow) – The main GUI that is exporting the data.
- Returns:
None
- Return type:
None
- class brace.UI.GUIController.DataExporters.ParquetExporter[source]¶
Bases:
AbstractDataExporter- exportData(animatedGraphManager: AnimatedGraphManager, filename: str, startStreamUnixTime: float, controlLogicEnumType: type, parent: MainWindow = None) None[source]¶
Exports the data in the parquet file format, hierarchically setting the data in “L” and “R” paths, scrunching down the table into a single column to fit in the row of a parquet file. Configuration and APIEvents are also first-class attributes of this file format (as metadata).
- Parameters:
animatedGraphManager (AnimatedGraphManager) – The AnimatedGraphManager to export data.
filename (str) – The filename to export the data into.
startStreamUnixTime (float) – The starting time (referenced against Unix epoch) at which the stream has started.
controlLogicEnumType (type) – The enum type the control logic that is to checked against the remote (for configuration).
parent (MainWindow) – The main GUI that is exporting the data.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.DataExporters.formatLeftRight(datastreamData: dict[str, list[float | int]]) tuple[dict[str, list[float | int]], dict[str, list[float | int]]][source]¶
Formats the data into left and right based on the L or R at the end of the name of the attribute. If there is no L or R, then the value goes to both legs.
- Parameters:
datastreamData (dict[str, list[float | int]]) – Data formatted in a dictionary of a list of floats or ints.
- Returns:
Data sorted into left and right dictionaries by the attribute name.
- Return type:
tuple[dict[str, list[float | int], dict[str, list[float | int]]]]
brace.UI.GUIController.InitializationFunctions module¶
- brace.UI.GUIController.InitializationFunctions.getDefaultsDictionary(initFileConfiguration: dict) dict | None[source]¶
Gets the subdictionary under “defaults”
- Parameters:
initFileConfiguration (dict[str, float | int]) – The default values for the configuration.
- Returns:
Subdictionary underneath the defaults header
- Return type:
dict[str, Any]
- brace.UI.GUIController.InitializationFunctions.getSettingsDictionary(initFileConfiguration: dict) dict | None[source]¶
Gets the subdictionary under “settings”
- Parameters:
initFileConfiguration (dict[str, float | int]) – The default values for the configuration.
- Returns:
Subdictionary underneath the settings header
- Return type:
dict[str, Any]
- brace.UI.GUIController.InitializationFunctions.initializeDefaultParameters(defaultParameters: dict[str, float], configurationObjects: dict[str, QWidget]) None[source]¶
Sets the default values for the parameters that are listed in the .ini file. Currently only QComboBox, QSpinBox, and QDoubleSpinBox are supported.
- Parameters:
defaultParameters (dict[str, float]) – The default values for the parameters in the configuration widget.
configurationObjects (dict[str, QtWidgets.QWidget]) – The configuration widgets dictionary that references widgets by name.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.InitializationFunctions.initializeLegEntries(legInformation: dict[str, dict], legComboBoxLeft: QComboBox, legComboBoxRight: QComboBox) None[source]¶
Populates the entries in the .ini file with the relevant leg entries of the combobox.
- Parameters:
legInformation (dict[str, dict]) – Dictionary containing the string and other relevant information of the leg serial.
legComboBoxLeft (QtWidgets.QComboBox) – The left combobox leg for the leg to be populated with entries.
legComboBoxRight (QtWidgets.QComboBox) – The right combobox leg for the leg to be populated with entries.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.InitializationFunctions.initializeLimits(limitInformation: dict[str, dict[str, int | float]], configurationObjects: dict) None[source]¶
Initializes the limits for configuration objects using the information set up in the .ini file for the minimum, maximum, and stepSize of the configuration object.
- Parameters:
limitInformation (dict[str, dict[str, int | float]]) – The minimum, maximum, and stepSize limits information for the configuration object.
configurationObjects (dict[str, QtWidgets.QWidget]) – The configuration widgets dictionary that references widgets by name.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.InitializationFunctions.loadInitFile(fileLocation: str) dict[source]¶
Load the .ini file, which is intended to be a toml file. It is formatted as a nested dictionary.
- Returns:
A dictionary containing the information inside the .ini file.
- Return type:
dict[str, Any]
- brace.UI.GUIController.InitializationFunctions.setConfigurationDictionaries(referenceConfigurationNames: list[str], internalDictionary: dict[str, QWidget]) dict[str, QWidget][source]¶
Creates a dictionary of the relevant configuration elements referenced by the name for easy access. The names are given as prefixes and the relevant widget has the L and R appended.
- Parameters:
referenceConfigurationNames (list[str]) – list of configuration name prefixes
internalDictionary (dict[str, QtWidgets.QWidget]) – Dictionary from the configuration box containing the attribute name and the widgets.
- Returns:
A consolidated dictionary of left and right widgets containing relevant parameter fields.
- Return type:
dict[str, QtWidgets.QWidget]
- brace.UI.GUIController.InitializationFunctions.setSingleConfigurationDictionaries(referenceConfigurationNames: list[str], internalDictionary: dict[str, QWidget]) dict[str, QWidget][source]¶
Gets the configuration for any single fields that are assigned for both left and right (and thus do not fit in the use of setConfigurationDictionaries).
- Parameters:
referenceConfigurationNames (list[str]) – list of configuration name prefixes
internalDictionary (dict[str, QtWidgets.QWidget]) – Dictionary from the configuration box containing the attribute name and the widgets.
- Returns:
A dictionary consisting of relevant single type parameter fields.
- Return type:
dict[str, QtWidgets.QWidget]
brace.UI.GUIController.PlotHelpers module¶
- brace.UI.GUIController.PlotHelpers.canHide(axes: ndarray[PlotItem], plotIndexToCheck: tuple[int, int]) None[source]¶
Helper function to determine whether it is the last plot (and thus shouldn’t be hidden) to workaround issue with corrupted graphs on hiding.
- Parameters:
axes (numpy.ndarray[PlotItem]) – The set of plots containing hideable plots.
plotIndexToCheck (tuple[int, int]) – A tuple containing the indicies of the plot to check.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.PlotHelpers.changePlotBackground(parent: MainWindow) None[source]¶
Goes through the GraphContexts of the MainWindow changing all the plots to have a dark background color if dark mode is used, and white background is light mode is used.
- Parameters:
parent (MainWindow) – The MainWindow containing the GraphContexts.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.PlotHelpers.changeStyle(parent: MainWindow) None[source]¶
Changes the style by applying the stylehint color scheme for the Qt window.
- Parameters:
parent (MainWindow) – The main GUI that is running this command.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.PlotHelpers.createHidingBoxes(parent: MainWindow, graphContexts: list[GraphContext]) None[source]¶
Populate the checkboxes that hide the plots when not needed. This is done across all of the GraphContexts.
- Parameters:
parent – The parent object calling this method, containing the GraphContexts
that should have their plots with hiding checkboxes. :type parent: MainWindow :param graphContext: GraphContexts containing the plots with that should have their plots with hideable checkboxes. :type graphContext: list[GraphContext]
- Returns:
None
- Return type:
None
- brace.UI.GUIController.PlotHelpers.setColorActionGroups(parent: MainWindow) QActionGroup[source]¶
Sets up the ActionGroup in the menu panel to trigger changing the style when light/dark mode is changed.
- Parameters:
parent (MainWindow | Simulator) – The main GUI that is running this command.
- Returns:
The QActionGroup that handles the style changes.
- Return type:
QActionGroup
- brace.UI.GUIController.PlotHelpers.setPlotVisibility(graphContext: GraphContext, plotIndexesToHide: tuple[int, int], shouldBeVisible: bool) None[source]¶
Sets the visibility of the plots should the checkbox be unchecked, hiding them as necessary.
- Parameters:
graphContext (GraphContext) – The graphContext containing the plot that should be hidden or shown.
plotIndexesToHide (tuple[int, int]) – The tuple indicies of the plot that should be hidden.
shouldBeVisible (bool) – Whether or not the plots should be hidden or shown.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.PlotHelpers.showBottomRowLabel(axes: ndarray[PlotItem]) None[source]¶
Adjusts the plots so that only the last plot shows the axis bottoms (since all the plots) have linked X-axes. This changes when plots are hidden and shown.
- Parameters:
axes (numpy.ndarray[PlotItem]) – The set of plots containing the last plot to show axis bottoms.
- Returns:
None
- Return type:
None
brace.UI.GUIController.UIConfigurationHelpers module¶
- brace.UI.GUIController.UIConfigurationHelpers.getConfigurationChanges(configurationObjects: dict[str, QWidget], configurationWidgetLookup: dict[str, str]) tuple[dict[str, str | int | float]][source]¶
Gets the configuration values for both left and right configuration fields and places them into two separate dictionaries.
- Parameters:
configurationObjects (dict[str, QWidget]) – The configuration widget objects referenceable by name.
configurationWidgetLookup – A lookup between the name of the attribute in the remote control logic object
and the name of the field as the configuration widget. :type configurationWidgetLookup: dict[str, str]
- Returns:
Left and right configuration referencing the configuration widget name instead of the control logic object name.
- Return type:
tuple[dict[str, str | int | float]]
- brace.UI.GUIController.UIConfigurationHelpers.getConfigurationParametersFromGUI(parent: MainWindow | Simulator, configurationObjects: dict[str, QWidget]) dict[str, Any][source]¶
Helper function that gets the configuration values from the GUI. Configuration is obtained using the widget name. Only active legs are exported. Thus one left and right leg configurations can be merged by opening separately.
- Parameters:
parent (MainWindow | Simulator) – The calling GUI running this function.
configurationObjects (dict[str, QWidget]) – The configuration widgets referenced by widget name.
- Returns:
A dictionary containing all of the widget names and values.
- Return type:
dict[str, Any]
- brace.UI.GUIController.UIConfigurationHelpers.getLegElementsByPrefix(configurationObjectsNew: dict[str, QWidget], widgetPrefix: str) tuple[QWidget, QWidget][source]¶
Gets tuple of leg elements with a given prefix.
- Parameters:
configurationObjectsNew (dict[str, QWidget]) – Dictionary of QWidgets referenced by name.
widgetPrefix (str) – The prefix for a given QWidget that should be referenced.
- Returns:
A tuple of QWidget objects retrieved given the widgetPrefix. Belonging to both belongs to the first element
in the tuple. :rtype: tuple[QWidget, QWidget]
- brace.UI.GUIController.UIConfigurationHelpers.hideItem(configurationWidgetName: str, configurationWidgetObject: QWidget, hideLeftLegConfiguration: bool, hideRightLegConfiguration: bool) None[source]¶
Hides or shows the leg widget items. This is done when the leg is not active. If at least one leg is active, then leg widgets that belong to both will be shown.
- Parameters:
configurationWidgetName (str) – Name of the configuration widget.
configurationWidgetObject (QWidget) – The configuration widget to hide or show.
hideLeftLegConfiguration (bool) – Whether or not the left leg configuration should be hidden or shown.
hideRightLegConfiguration (bool) – Whether or not the right leg configuration should be hidden or shown.
- Returns:
None
- Return type:
None
- brace.UI.GUIController.UIConfigurationHelpers.saveConfiguration(parent: MainWindow | Simulator, configurationObjects: dict[str, QWidget]) None[source]¶
Saves the configuration as a JSON file. This can be done from either the main GUI or the Simulator. The JSON file handles the configuration using the widget object names. The JSON is formatted with 4 spaces.
- Parameters:
parent (MainWindow | Simulator) – The calling GUI running this function.
configurationObjects (dict[str, QWidget]) – The configuration widgets referenced by widget name.
- Returns:
None
- Return type:
None