Main Window#

Defines MainWindow class.

MainWindow(*args, **kwargs)

The main window of the app, built in Qt designer.

class mdaviz.mainwindow.MainWindow(*args: Any, **kwargs: Any)[source]#

The main window of the app, built in Qt designer.

connect()

status

setStatus(text[, timeout])

Write new status to the main window and terminal output.

doAboutDialog(*args, **kw)

Show the "About ..." dialog

closeEvent(event)

User clicked the big [X] to quit.

doClose(*args, **kw)

User chose exit (or quit), or closeEvent() was called.

doOpen(*args, **kw)

User chose to open a file or folder dialog.

reset_mainwindow()

dataPath()

Full path object for the selected folder

setDataPath([path])

mdaFileList()

List of mda file (name only) in the selected folder.

setMdaFileList([mda_file_list])

mdaInfoList()

setMdaInfoList([infoList])

folderList()

setFolderList([folder_list])

Set the folder path list & populating the folder QComboBox.

onFolderSelected(folder_name)

A folder was selected (from the open dialog or pull down menu).

onRefresh()

Refreshes the file list in the currently selected folder - Re-fetch the list of MDA files in the current folder.

_buildFolderList([folder_list])

Build the list of recent folders and remove duplicates from the folder list.

_addToRecentFolders(folder_path: str) None[source]#

Add a new folder path to the list of recent folders in the app settings.

Args:

folder_path (str): The path of the folder to be added.

_auto_load_first_folder() None[source]#

Auto-load the first valid folder from recent folders.

This method attempts to automatically load the first folder from the recent folders list if it exists and is valid. This provides a better user experience by not requiring manual folder selection on startup.

The auto-loading can be disabled by setting the ‘auto_load_folder’ setting to False.

_buildFolderList(folder_list=None)[source]#

Build the list of recent folders and remove duplicates from the folder list.

  • If folder_list arg is not None (after a doOpen call), it just removes duplicates.

  • If folder_list arg is None, it grabs the list of recent folder from the app settings. The directory loaded at start-up will be added at index 0.

Args:

folder_list (list, optional): a list folders. Defaults to None.

Returns:

list: list of folders to be populated in the QComboBox

_center_window()[source]#

Center the window on the screen.

_display_fit_data(fit_data, curve_id: str)[source]#

Display fit data in the fit data tab.

_fillFolderBox(folder_list: List[str] | None = None) None[source]#

Fill the Folder ComboBox; Clear Recently Open… is added at the end by default.

Args:

folder_list (list, optional): The list of folders to be displayed in the ComboBox. Defaults to [].

_on_fit_added(curve_id: str, fit_id: str)[source]#

Handle when a new fit is added.

_on_fit_updated(curve_id: str, fit_id: str)[source]#

Handle when a fit is updated.

_on_scan_complete(result: FolderScanResult) None[source]#

Handle scan completion.

_on_scan_error(error_message: str) None[source]#

Handle scan errors.

_on_scan_progress(current: int, total: int) None[source]#

Handle scan progress updates.

_setup_fit_data_tab()[source]#

Set up the fit data tab widget and components.

_setup_resizable_layout() None[source]#

Set up proper size policies for resizable layout.

cancel()[source]#

Handle the logic when the user clicks ‘Cancel’.

closeEvent(event)[source]#

User clicked the big [X] to quit.

connectToFitSignals(chart_view)[source]#

Connect to fit signals from a chart view.

Parameters: - chart_view: ChartView instance that emits fit signals

dataPath()[source]#

Full path object for the selected folder

doAboutDialog(*args, **kw)[source]#

Show the “About …” dialog

doClose(*args, **kw)[source]#

User chose exit (or quit), or closeEvent() was called.

doOpen(*args, **kw)[source]#

User chose to open a file or folder dialog.

doPopUp(message)[source]#

User chose to show a popup dialog with a message.

doPreferences(*args, **kw)[source]#

Show the Preferences dialog

get_auto_load_setting() bool[source]#

Get the current auto-load folder setting.

Returns:

bool: True if auto-loading is enabled, False if disabled

mdaFileList()[source]#

List of mda file (name only) in the selected folder.

onFolderSelected(folder_name)[source]#

A folder was selected (from the open dialog or pull down menu).

onRefresh()[source]#

Refreshes the file list in the currently selected folder - Re-fetch the list of MDA files in the current folder. - Display the updated file list in the MDA folder table view.

proceed()[source]#

Handle the logic when the user clicks ‘OK’.

setFolderList(folder_list=None)[source]#

Set the folder path list & populating the folder QComboBox.

  • If folder_list is not None, it will remove its duplicates.

  • If folder_list is None, the call to buildFolderList will take care of building the list based on the recent list of folder saved in the app settings.

Args:

folder_list (list, optional): the current list of recent folders. Defaults to None.

setStatus(text, timeout=0)[source]#

Write new status to the main window and terminal output.

showFitDataTab()[source]#

Show the fit data tab and switch to it.

toggle_auto_load() bool[source]#

Toggle the auto-load folder setting.

Returns:

bool: The new state of the auto-load setting (True if enabled, False if disabled)

updateFitData(fit_data: str)[source]#

Update the fit data tab with new fit information.

Parameters: - fit_data: String containing formatted fit data to display