Graphical User Interface
The following functions are classes are provided in the gui module. They are central in producing and managing the user interface as well as starting the worker threads responsible for producing plots from data.
Plot Manager
Orchestrate a plotting run in a background thread to keep the GUI responsive.
Workflow
- Collect the selected file labels from the main window.
- Build a reduced
DataSetcontaining only the selected files, colours, device, structure type, and name. - Collect plotting options from the active device widget (via
aliasproperties) and from global GUI controls, storing them inPlotterOptions. - Resolve and instantiate the appropriate device worker class from the
implementations.devices.workersnamespace. - Configure the worker with the reduced dataset, selected plot function, and options.
- Move the worker to a
QThread, wire up progress/finished signals, and start the thread.
The function logs a concise summary of the run (including a short run identifier) to the GUI console once the worker is started.
Parameters
window : QMainWindow Main application window providing access to the dataset, widgets (file selection, stacked options, checkboxes, etc.), and console API.
Source code in gui\plot_manager.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
Utils
Clear
Fully reset the GUI state and remove all in-memory data.
This helper:
- Clears the active DataSet and GUI fields via clear_data.
- Empties the console widget.
- Writes a confirmation message to the GUI console.
Parameters
window : QMainWindow Main application window whose state should be cleared.
Source code in gui\utils\clear\clear_all.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Clear the currently loaded dataset and reset all GUI widgets tied to it.
Resets:
- Stored DataSet object and its disk location.
- Set name, device name, notes, and list widgets.
- Plot type combobox and stacked widget view.
A console message is printed to confirm completion.
Parameters
window : QMainWindow Main GUI instance that holds dataset-related widgets.
Source code in gui\utils\clear\clear_data.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
DataSet Tools
Launch the DataSet creation dialog and construct a new dataset from user input.
Workflow: - Opens the DataSet creator window populated with available devices. - On confirmation: * Clears existing state. * Stores the newly created dataset. * Loads it into the GUI and updates the header. * Immediately saves it to disk. - If cancelled, informs the user that no dataset was created.
Parameters
window : QMainWindow Main application window controlling dataset creation.
Source code in gui\utils\dataset_tools\create_dataset.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
Populate the GUI with data from the currently loaded dataset.
Actions: - Adds all dataset labels to the file selection list. - Selects all items by default. - Populates the plot-type combobox with device-appropriate plotting functions.
Raises
IncompatibleDeviceTypeFound If the dataset’s device type does not match available plot handlers.
Parameters
window : QMainWindow GUI instance holding a loaded dataset.
Source code in gui\utils\dataset_tools\load_dataset.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
Save the currently loaded dataset to disk using a file dialog.
Behaviour:
- Ensures a dataset is loaded before saving.
- Opens a save-file dialog and writes the dataset via DataSetJSONEncoder.
- Auto-appends a valid extension if necessary.
- Updates the stored dataset location and logs status messages.
Parameters
window : QMainWindow GUI window containing the active dataset.
Source code in gui\utils\dataset_tools\save_dataset.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
Other
Extract the current value from common Qt widget types.
Supported widgets:
- QDoubleSpinBox / QSpinBox → numeric value
- QCheckBox → boolean isChecked
- QLineEdit / QComboBox → text, with "None"/"none" mapped to None
Raises NotImplementedError if the widget type is unsupported.
Parameters
widget : QWidget The widget whose value should be extracted.
Returns
Any The widget's value in a Python-friendly type.
Source code in gui\utils\get_qwidget_value.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
Find and return the checked QRadioButton within a dialog.
Scans all child radio buttons and returns the first active one.
Parameters
dialog : QDialog Container widget containing radio buttons.
Returns
QRadioButton or None
The checked radio button, or None if no selection exists.
Source code in gui\utils\search_for_first_active_radio_button.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Split a CamelCase string into its component words.
Examples
"MyPlotType" → ["My", "Plot", "Type"]
Parameters
camel_case : str Input CamelCase string.
Returns
list[str] List of lowercase/uppercase-correct word segments.
Source code in gui\utils\split_camelCase.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Windows and Dialogs
Bases: QMainWindow
Main GUI window for interactive, automated plotting of experimental data.
Responsibilities
- Load the main QtDesigner-generated UI file and dynamically attach device-
specific option panels to the central
QStackedWidget. - Manage the currently loaded
DataSet:- Creating, loading, saving, and autosaving datasets.
- Displaying raw JSON content and console history in helper dialogs.
- Updating header fields (set name, device type) when datasets change.
- Integrate logging with a QTextEdit-based console for time-stamped messages.
- Provide a thin controller layer for:
- Launching the plotting pipeline via
plot_manager. - Handling progress updates and console appends.
- Adding notes and console history back into the dataset.
- Launching the plotting pipeline via
On construction, the window:
- Discovers available devices from implementations.devices.
- Loads and registers per-device widgets and their plot functions.
- Wires menu actions and buttons to dataset, plotting, and utility actions.
- Optionally auto-opens a demo dataset if a file name is supplied.
The class is intended to be the central hub of the GUI application, with device-specific logic pushed into worker classes and implementations.
Source code in gui\windows\MainWindow.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
navigate_to_docs()
Opens the default web browser and navigates to the documentation URL.
Source code in gui\windows\MainWindow.py
315 316 317 318 319 320 | |
not_implemented()
Shows the user a message that the current feature is planned but not yet implemented.
Source code in gui\windows\MainWindow.py
322 323 324 325 326 | |
show_about()
Shows a simple window with licence, authorship and build information
Source code in gui\windows\MainWindow.py
302 303 304 305 306 307 308 309 310 311 312 313 | |
Bases: QDialog
Dialog for interactively creating new DataSet instances.
Overview
This window guides the user through constructing a dataset by: - Selecting a device type from a combobox. - Adding individual files with custom labels, or - Auto-generating filepaths from a directory according to a chosen structure. - Setting the experiment name and experiment date/time.
Behaviour
- Maintains an internal
DataSetobject that is updated as the user adds files or generates sets from directories. - Displays the current file mapping as formatted JSON in a plain-text widget.
- Validates that both a name and at least one file are present before enabling the “Done” button.
- On completion (
finish), writes name, device type, and experiment datetime into the dataset and closes with an accepted result.
Parameters
devices : list[str], optional
List of available device names to present in the device selection combo
box. Defaults to a single "N/A" entry when not specified.
Source code in gui\windows\DataSetCreatorWindow.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
add_file_to_set()
Gets the path and label and adds it to the current DataSet instance while updating GUI
Source code in gui\windows\DataSetCreatorWindow.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
browse_dir()
Open directory selection dialog to get a path and update gui when confirmed
Source code in gui\windows\DataSetCreatorWindow.py
84 85 86 87 88 89 | |
browse_files()
Open file selection dialog to get a file path and update gui when confirmed
Source code in gui\windows\DataSetCreatorWindow.py
77 78 79 80 81 82 | |
finish()
Add name, device type, and date and time dataset before exiting
Source code in gui\windows\DataSetCreatorWindow.py
196 197 198 199 200 201 202 203 | |
finish_button_state()
Only enable closing when some data was included
Source code in gui\windows\DataSetCreatorWindow.py
170 171 172 173 174 175 176 177 178 | |
generate_set()
Automatically generate a set of filepaths based on a directory path. Will create nested structure if desired
Source code in gui\windows\DataSetCreatorWindow.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
label_button_state()
Only enable the add button once a label and a path were selected
Source code in gui\windows\DataSetCreatorWindow.py
158 159 160 161 162 163 164 165 166 167 | |
reset()
Completely reset this UI by clearing all elements
Source code in gui\windows\DataSetCreatorWindow.py
187 188 189 190 191 192 193 194 | |
Bases: Handler, QTextEdit
QTextEdit-based logging console widget for the GUI.
This class bridges the logging module with a Qt text widget by:
- Subclassing both logging.Handler and QTextEdit.
- Emitting formatted log messages through a dedicated Qt signal
(appendTextEdit), which is connected to the widget's append slot.
- Keeping the text area read-only so it behaves like a console.
Typical usage
- Create an instance and add it as a handler to a
logging.Logger. - Configure a formatter for the handler.
- Logged messages will appear in the GUI with the configured format.
Parameters
parent : QWidget Parent widget that will own this console.
Source code in gui\windows\qtexteditconsole.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
Display text content inside a modal dialog with optional saving.
The dialog contains:
- A read-only text editor showing contents.
- “OK” to close the dialog.
- “SAVE” to delegate saving via window.save_to_file.
Parameters
window : QMainWindow Parent window providing the save callback. title : str Dialog title bar text. contents : str Text content to display.
Source code in gui\windows\dialogs\dialog_print.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
Build and return an 'About' information dialog containing a logo and text.
Features: - Displays an application logo loaded via QPixmap. - Shows about text with HTML formatting support. - Uses a fixed-size vertical layout.
Parameters
about_contents : str HTML/markdown-like text describing the application. centralwidget : QWidget Parent widget for modal behavior. logo_path : str Directory path to the logo image file.
Returns
QDialog Configured dialog ready to be shown.
Source code in gui\windows\dialogs\generate_about_dialog.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |