populse_mia.user_interface.data_browser.data_browser

Module to define data browser tab appearance, settings and methods.

Classes

DataBrowser(project, main_window)

Widget that manages and displays the contents of the Data Browser tab.

DateFormatDelegate([parent])

A custom delegate for handling date editing in table views.

DateTimeFormatDelegate([parent])

Custom delegate for displaying and editing datetime values in table views.

NumberFormatDelegate([parent])

Delegate for handling numeric input in table cells.

TableDataBrowser(project, data_browser, ...)

Table widget that displays the documents contained in the database and their associated tags.

TimeFormatDelegate([parent])

Delegate for handling time data display and editing in table views.

class populse_mia.user_interface.data_browser.data_browser.DataBrowser(project, main_window)[source]

Bases: QWidget

Widget that manages and displays the contents of the Data Browser tab.

The Data Browser provides an interface for viewing, filtering, tagging, and sending documents to the pipeline manager. It integrates tools for advanced search, tag management, and visual inspection of loaded data.

Contains:

Methods:

  • add_tag_infos: Add the tag after add tag pop-up.

  • add_tag_pop_up: Display the add tag pop-up.

  • clone_tag_infos: Clone the tag after the clone tag pop-up.

  • connect_actions: Connect actions method to views.

  • connect_mini_viewer: Display the selected documents in the viewer.

  • connect_toolbar: Connect toolbar views to methods.

  • count_table_pop_up: Open the count table.

  • create_layout: Create the layout of the data browser.

  • create_toolbar_view: Create the toolbar views.

  • move_splitter: Check if the viewer’s splitter is at its lowest position.

  • open_filter: Open a project filter that has already been saved.

  • open_filter_infos: Apply the current filter.

  • remove_tag_infos: Remove user tags after the pop-up.

  • remove_tag_pop_up: Display the pop-up to remove user tags.

  • reset_search_bar: Reset the rapid search bar.

  • search_str: Search a string in the table and updates the visualized documents.

  • send_documents_to_pipeline: Send the current list of scans to the Pipeline Manager.

  • show_clone_tag_popup: Display the clone tag pop-up.

  • toggle_advanced_search: Toggle the visibility of the advanced search interface.

  • update_database: Update the database in the software.

__init__(project, main_window)[source]

Initialization of the data_browser class.

Parameters:
  • project – Current project in the software.

  • main_window – Main window of the software.

add_tag_infos(new_tag_name, new_default_value, tag_type, new_tag_description, new_tag_unit)[source]

Add a new tag to both current and initial database collections.

This method creates a new tag field in the database schema and populates it with default values for all existing scans. The operation is tracked in the project’s undo/redo history.

Parameters:
  • new_tag_name – (str) Name of the new tag to create.

  • new_default_value – Default value to assign to all existing scans.

  • tag_type – (str) Data type of the tag (e.g., FIELD_TYPE_STRING, FIELD_TYPE_FLOAT).

  • new_tag_description – (str) Human-readable description of the tag.

  • new_tag_unit – (str) Unit of measurement for the tag value.

Note

  • Marks the project as having unsaved modifications

  • Adds the operation to the undo history

  • Updates the UI table with the new column

add_tag_pop_up()[source]

Display a popup window for adding a new tag to the project.

This method initializes and shows a PopUpAddTag dialog, allowing the user to add a new tag to the current project. The popup is modal and tied to the current project context.

clone_tag_infos(tag_to_clone, new_tag_name)[source]

Clone a tag and its associated data, creating a new tag with the same attributes and values.

This method clones the specified tag, including its schema and data, into a new tag. The new tag is added to both the current and initial collections, and all existing values for the original tag are copied to the new tag. The operation is recorded in the project’s undo history.

Parameters:
  • tag_to_clone – (str) Name of the tag to clone.

  • new_tag_name – (str) Name of the new tag to create.

Note

  • The new tag is added to the database schema and data for both COLLECTION_CURRENT and COLLECTION_INITIAL collections.

  • The project’s unsaved modifications flag is set to True.

  • The operation is recorded in the project’s undo history.

connect_actions()[source]

Connect UI actions to their corresponding methods.

Binds each action’s triggered signal to the appropriate slot method, enabling interactive functionality for tag management and filter operations.

connect_mini_viewer()[source]

Display the selected documents in the viewer.

connect_toolbar()[source]

Connect methods to toolbar.

count_table_pop_up()[source]

Open the count table pop-up.

create_layout()[source]

Create the layouts of the tab.

create_toolbar_view()[source]

Create the toolbar menu at the top of the tab.

move_splitter()[source]

Connect the mini viewer if the splitter is not at its minimum position.

Checks whether the bottom pane of the vertical splitter is at its minimum height. If it’s larger than the minimum, connects the mini viewer.

open_filter()[source]

Display a dialog for selecting and opening a saved project filter.

Creates and shows a PopUpSelectFilter dialog, allowing the user to choose from previously saved filters associated with the current project. The dialog is stored as an instance attribute to maintain a reference during its lifetime.

open_filter_infos()[source]

Apply the current project filter to the data table.

Opens the advanced search interface if the filter contains exclusion criteria (nots), updates the search bar text, and refreshes the visualized scans to match the filtered document collection.

The method:
  • Retrieves documents from the current collection.

  • Updates scans_to_visualize and scans_to_search.

  • Applies the filter’s search bar text.

  • Shows advanced search interface if exclusion filters exist.

remove_tag_infos(tag_names_to_remove)[source]

Remove specified tags from the database and update the UI.

This method removes tags from both the current and initial collections, preserving tag attributes and values in the undo history. The table display is updated to reflect the changes.

Parameters:

tag_names_to_remove – Iterable of tag names (str) to remove from the database and table display.

Side Effects:
  • Marks project as having unsaved modifications.

  • Adds removal operation to undo history.

  • Clears redo history.

  • Removes columns from table display.

  • Temporarily disconnects and reconnects table selection signal.

remove_tag_pop_up()[source]

Display a modal dialog for removing user tags from the project.

Creates and shows a PopUpRemoveTag instance, allowing the user to select and remove tags associated with the current project.

Clear the search bar input field.

This method resets the search bar to an empty state by clearing any existing text content.

search_str(str_search)[source]

Search and filter documents in the table based on a search string.

Updates the table’s visualized documents based on the search criteria. An empty string shows all searchable scans. The special value NOT_DEFINED_VALUE filters for documents with undefined field values.

Parameters:

str_search – The search string to filter documents. Empty string returns all searchable scans. NOT_DEFINED_VALUE returns scans with undefined values.

send_documents_to_pipeline()[source]

Display a popup dialog for sending filtered scans to the Pipeline Manager.

Retrieves the currently filtered scans from the table data and presents them in a selection popup, allowing the user to confirm which scans to send to the pipeline. The popup is shown modally and references the main window as its parent.

show_clone_tag_popup()[source]

Display a popup dialog for cloning a tag.

This method initializes and shows a popup dialog (PopUpCloneTag) to allow the user to clone a tag within the current project context. The popup is stored as an instance variable for later reference if needed.

Toggle the visibility of the advanced search interface.

If the advanced search is hidden, it resets and displays the search interface, updating the scans list to the current visualized scans. If the advanced search is visible, it hides the interface, resets the search state, and restores the original scans list to the data browser. This method ensures the UI and data state are synchronized with the visibility of the advanced search.

update_database(database)[source]

Update the project database and reset UI state.

This method propagates the database instance to all components that need it and resets UI elements to their default state. It’s called during project lifecycle events (new, open, save as).

Parameters:

database – The new Database instance to use across the application.

class populse_mia.user_interface.data_browser.data_browser.DateFormatDelegate(parent=None)[source]

Bases: QItemDelegate

A custom delegate for handling date editing in table views.

This delegate provides a QDateEdit widget for editing date values in table cells, with dates formatted as DD/MM/YYYY. It replaces the default text editor with a calendar-based date picker for improved user experience and data validation.

Contains:

Methods:

  • createEditor: Create and return a QDateEdit widget for editing dates.

__init__(parent=None)[source]

Initialize the DateFormatDelegate.

Parameters:

parent – Optional parent QObject. Defaults to None.

createEditor(parent, option, index)[source]

Create and return a QDateEdit widget for editing dates.

This method is called by the view when a cell needs to be edited. It creates a date editor with DD/MM/YYYY format.

Parameters:
  • parent – The parent widget for the editor.

  • option – Style options for rendering the item.

  • index – The model index of the item being edited.

Returns:

(QDateEdit) A configured date editor widget.

class populse_mia.user_interface.data_browser.data_browser.DateTimeFormatDelegate(parent=None)[source]

Bases: QItemDelegate

Custom delegate for displaying and editing datetime values in table views.

This delegate provides a QDateTimeEdit widget for editing datetime cells, formatted as DD/MM/YYYY HH:MM:SS.mmm (day/month/year with milliseconds).

Contains:

Methods:

  • createEditor: Create and return a QDateTimeEdit widget for editing datetimes.

DATETIME_FORMAT = 'dd/MM/yyyy hh:mm:ss.zzz'
__init__(parent=None)[source]

Initialize the datetime delegate.

Parameters:

parent – Optional parent QWidget. Defaults to None.

createEditor(parent, option, index)[source]

Create and configure a datetime editor widget.

Parameters:
  • parent – Parent widget for the editor.

  • option – Style options for the item.

  • index – Model index of the item being edited.

Returns:

(QDateTimeEdit) Configured datetime editor widget.

class populse_mia.user_interface.data_browser.data_browser.NumberFormatDelegate(parent=None)[source]

Bases: QItemDelegate

Delegate for handling numeric input in table cells.

The number of decimal places is automatically inferred from the existing cell value, ensuring consistent formatting of numeric inputs.

Contains:

Methods:

  • createEditor: Create and return a QDoubleSpinBox widget for editing numbers.

__init__(parent=None)[source]

Initialize the NumberFormatDelegate.

Parameters:

parent – (QWidget) The parent widget. Defaults to None.

createEditor(parent, option, index)[source]

Create and configure a QDoubleSpinBox editor for numeric input.

The number of decimal places is determined by examining the current cell value.

Parameters:
  • parent – Parent widget for the editor.

  • option – Style options for the item.

Paramindex:

Model index of the item being edited.

Returns:

(QDoubleSpinBox) A spin box editor configured with the appropriate decimal precision.

class populse_mia.user_interface.data_browser.data_browser.TableDataBrowser(project, data_browser, tags_to_display, update_values, activate_selection, link_viewer=True)[source]

Bases: QTableWidget

Table widget that displays the documents contained in the database and their associated tags.

Contains:

Methods:

  • add_column: Add a column to the table.

  • add_columns: Add columns to the table.

  • add_path: Call a pop-up to add any document to the project.

  • add_rows: Insert rows if they are not already in the table.

  • batch_update: Context manager for efficient batch updates.

  • clear_cell: Clear the selected cells.

  • context_menu_table: Create the context menu of the table.

  • delete_from_brick: Delete a document from its brick id.

  • display_file: Tries to display a file in the user’s preferred application.

  • display_unreset_values: Display an error message when trying to reset user tags.

  • edit_table_data_values: Change values in DataBrowser.

  • fill_cells_update_table: Initialize and fills the cells of the table.

  • fill_headers: Initialize and fill the headers of the table.

  • get_current_filter: Get the current data browser selection.

  • get_index_insertion: Get index insertion of a new column.

  • get_scan_row: Return the row index of the scan.

  • get_tag_column: Return the column index of the tag.

  • mouseReleaseEvent: Called when clicking released on cells.

  • multiple_sort_infos: Sort the table according to the tags specify in list_tags.

  • multiple_sort_pop_up: Display the multiple sort pop-up.

  • on_cell_changed: Changes the background color and the value of cells when edited by the user.

  • remove_scan: Remove documents from table and project.

  • reset_cell: Reset the selected cells to their original values.

  • reset_column: Reset the selected columns to their original values.

  • reset_row: Reset the selected rows to their original values.

  • section_moved: Called when the columns of the data_browser are moved.

  • select_all_column: Called when single clicking on the column header to select the whole column.

  • select_all_columns: Called from context menu to select the columns.

  • selection_changed: Called when the selection is changed.

  • show_brick_history: Show brick history pop-up.

  • sort_column: Sort the current column.

  • sort_updated: Called when the button advanced search is called.

  • update_colors: Update the background of all the cells.

  • update_selection: Called after searches to update the selection.

  • update_table: Fill the table with the project’s data.

  • update_visualized_columns: Update the visualized tags.

  • update_visualized_rows: Update the list of documents (scans) in the table.

  • visualized_tags_pop_up: Display the visualized tags pop-up.

__init__(project, data_browser, tags_to_display, update_values, activate_selection, link_viewer=True)[source]

Initialize the data table widget with project data and browser context.

Parameters:
  • project – (Project) The current project instance containing data and configuration.

  • data_browser – (DataBrowser) Parent DataBrowser widget that contains this table.

  • tags_to_display – (list[str]) List of metadata tags to show as table columns.

  • update_values – (bool) If True, enables cell editing; if False, table is read-only.

  • activate_selection – (bool) True to enable the selection feature, False otherwise.

  • link_viewer(bool) – If True, links table selection to external viewer widget. Defaults to True.

Note

  • Column sorting and reordering are enabled by default (except first column).

  • Extended selection mode is used unless activate_selection is falsy.

  • A custom context menu is available only when both activate_selection and link_viewer are True.

add_column(column, tag)[source]

Add a new column to the table with the specified tag.

Inserts a column at the given index, configures its header with metadata from the database, sets the appropriate delegate based on field type, and populates cells with current values from the database.

Parameters:
  • column – (int) Zero-based index where the column should be inserted.

  • tag – (str) Tag name identifying the field to add from the database.

Note

Temporarily disconnects item change signals during insertion to prevent unwanted event triggers, then reconnects them after completion.

add_columns()[source]

Add and update table columns based on database fields.

This method synchronizes the table’s columns with the current database schema by:

  • Adding columns for new database fields that don’t exist in the table.

  • Populating new columns with values from the database.

  • Removing columns that no longer exist in the database.

  • Applying appropriate formatting delegates based on field types.

  • Maintaining column visibility settings.

The method temporarily disconnects item change signals during operation to prevent unwanted events, then reconnects them after completion.

Note

  • The TAG_FILENAME column is always placed first.

  • Columns are sorted alphabetically (except TAG_FILENAME).

  • System tags (TAG_CHECKSUM, TAG_HISTORY) are excluded.

  • Undefined values are displayed in italic bold text.

add_path()[source]

Open a dialog to add documents to the current project.

Creates and displays a PopUpAddPath dialog that allows users to select and add document paths to the project’s data browser.

add_rows(rows)[source]

Insert rows into the table if they don’t already exist.

This method adds new scans to the table, populating each column with data from the database. It displays a progress dialog during the operation and handles special cases like the TAG_BRICKS column with custom widgets.

Parameters:

rows – An iterable of scan identifiers to be added to the table.

Note

  • Duplicate scans (already present in the table) are automatically skipped.

  • Sorting is temporarily disabled during the insertion process.

  • The first column (name) is set as non-editable.

  • TAG_BRICKS columns receive custom button widgets for interaction.

batch_update(*, disable_sorting=True)[source]

Context manager for efficient batch updates.

This manager temporarily disables repainting, signal emission, and optionally sorting, allowing multiple modifications to the table without triggering unnecessary redraws or signal handling. All previous widget states are restored upon exit, even if an exception occurs.

Parameters:

disable_sorting – (bool) If True (default), temporarily disables sorting during the batch update to prevent rearrangements.

clear_cell()[source]

Clear values from selected cells in the table.

This method removes data from the currently selected cells in the database and updates the UI to reflect the cleared state. The operation is recorded in the project’s undo history for potential reversal.

The method performs the following actions for each selected cell:
  • Retrieves the current value from the database.

  • Removes the value from the database.

  • Updates the cell’s visual appearance (italic + bold).

  • Records the change for undo/redo functionality.

Side Effects:
  • Modifies database values in COLLECTION_CURRENT.

  • Updates table cell formatting.

  • Appends operation to project.undos.

  • Clears project.redos.

context_menu_table(position)[source]

Create and display the context menu for the table, and perform the corresponding action based on the user’s selection.

Parameters:

position – (QPoint) The mouse cursor position relative to the widget.

Contains:

Inner functions:

  • _confirm_action: Display a warning message box with an OK/Cancel choice and connect the OK button to a callback function.

  • _do_add_document: Safely add a new document to the table.

delete_from_brick(brick_id)[source]

Delete a brick and its associated documents from the database.

This method cleans up the database when a pipeline (composed of multiple bricks) is initialized but not executed before another pipeline is started or the software is closed. It removes the brick and any orphaned output documents that are not used as inputs elsewhere.

Parameters:

brick_id – (str) The unique identifier of the brick to be deleted.

Contains:

Inner functions:

  • extract_document_ids: Extracts all string values from a nested dictionary structure.

display_file()[source]

Open the selected file(s) in the user’s default application.

Iterates over all selected items in the view, resolves their absolute paths, and opens each file using the platform’s default application.

Supported platforms: Linux, macOS, and Windows.

display_unreset_values()[source]

Displays a warning dialog listing values that cannot be reset.

This method shows a QMessageBox warning when certain values (such as user tags, FileName, or undefined cells) cannot be reset because they lack a raw value. The dialog includes a descriptive message and an OK button for dismissal.

edit_table_data_values()[source]

Edit and update selected cell values in the DataBrowser table.

This method handles the selection of cells, validation of list lengths, and updating of values in both the table and the database. It supports list-type fields and ensures data consistency across selections.

Steps:
  1. Collects selected cells and their metadata (coordinates, types, lengths, etc.).

  2. Validates list lengths for compatibility.

  3. Opens a dialog for value modification if valid.

  4. Updates the table and database, and records changes for undo/redo history.

Note

  • Exits early if the selected tag is ‘TAG_BRICKS’ or if the field type is not a list.

  • Disconnects and reconnects the itemChanged signal to prevent recursive updates.

fill_cells_update_table()[source]

Initialize and populate table cells with scan data from the database.

This method performs the following operations:
  1. Creates a progress dialog to track cell population.

  2. Retrieves scan documents matching scans_to_visualize from the database.

  3. Populates each cell with appropriate data based on column type.

  4. Handles special cases (name column, bricks column).

  5. Applies saved sorting preferences.

  6. Resizes rows and columns to fit content.

Special column handling:
  • Column 0 (name): Read-only, always displays as string.

  • Bricks column: Displays clickable buttons for brick history.

  • Other columns: Editable, type-specific formatting.

Note

  • Displays a modal progress dialog during population.

  • Temporarily hides the table during updates for performance.

  • Connects cell change signals after population completes.

fill_headers(take_tags_to_update=False)[source]

Initialize and populate table headers with field metadata.

Sets up table columns based on database fields, configuring each with:
  • Appropriate tooltips showing description, unit, and type.

  • Specialized delegates for numeric and temporal data types.

  • Visibility based on display settings or field attributes.

Parameters:

take_tags_to_update – If True, use tags_to_display for visibility. If False, use field visibility attributes. Defaults to False.

get_current_filter()[source]

Get the current data browser selection.

Returns the list of selected scan paths if a selection is active, otherwise returns all visible scan paths in the data browser.

Returns:

(list) List of scan paths from either the current selection or all visible scans in the data browser.

get_index_insertion(to_insert)[source]

Find the insertion index for a new column to maintain alphabetical order.

Uses binary search to efficiently locate the correct position for inserting a column header while preserving the existing alphabetical sort order.

Parameters:

to_insert – (str) The column header text to insert.

Returns:

(int) The column index where the new column should be inserted. Returns columnCount() if it should be appended at the end.

Note

Assumes that column 0 is reserved (TAG_FILENAME must always be the first tag on the left) and start the search from column 1.

get_scan_row(scan)[source]

Find the row index for a given scan filename.

Parameters:

scan – The scan filename to search for.

Returns:

(int) The zero-based row index if the scan is found, None otherwise.

get_tag_column(tag)[source]

Find the column index for a given tag name.

Searches through the table’s horizontal headers to locate the column corresponding to the specified tag.

Parameters:

tag – (str) The name of the tag to search for.

Returns:

(int) The zero-based column index if the tag is found, None otherwise.

mouseReleaseEvent(event)[source]

Handle mouse release event and update table data.

This method is called when a mouse button is released over the widget. It delegates to the parent class handler and then updates the table data values.

Parameters:

event – (QMouseEvent) The mouse event containing information about the button released, position, and modifiers.

multiple_sort_infos(list_tags, order)[source]

Sort table rows by multiple tag values.

Sorts the visualized scans based on the values of specified tags, then reorganizes the table rows to reflect the new order. Handles both regular items and special brick widgets during the reordering.

Parameters:
  • list_tags – (list) List of tag names to sort by (primary to secondary).

  • order – (str) Sort direction, either “Ascending” or “Descending”.

Note

Temporarily disables item change signals during sorting to prevent triggering update handlers. The sort is stable and preserves the relative order of items with equal sort keys.

Contains:

Inner functions:

  • _clear_cell: clears the specified cell.

  • _create_brick_widget: Create and set a brick widget for the specified table cell.

multiple_sort_pop_up()[source]

Display the multiple sort configuration dialog.

Creates and shows a modal dialog that allows users to configure multiple sorting criteria for the current project data.

Note

The dialog instance is stored in self.pop_up.

on_cell_changed(item_origin)[source]

Update cell values and appearance when edited by the user.

This method handles both single and multi-cell selection, validating type compatibility across all selected cells before applying changes.

It performs the following operations:
  1. Validates that all selected cells have compatible types.

  2. Verifies the new value matches the expected type(s).

  3. Updates the database with validated values.

  4. Maintains undo/redo history for all modifications.

  5. Refreshes cell colors and formatting.

Special handling:
  • PatientName: Removes spaces (used for subfolder naming in calculations).

  • TAG_BRICKS/TAG_FILENAME: Read-only fields, changes are rejected.

  • List types: Prevents mixed type selections but allows homogeneous lists.

Parameters:

item_origin – QTableWidgetItem from which the edit originated.

Side effects:
  • Modifies database values for selected cells.

  • Updates cell appearance (colors, fonts).

  • Adds entry to project undo history.

  • Clears redo history.

  • Resizes columns to fit content.

remove_scan()[source]

Remove selected scans from the database and file system.

This method handles the removal of scan documents from both the current and initial collections in the project database. It performs the following:

  • Prompts user for confirmation if scans are in the active scan list.

  • Preserves modification history for removed scan values.

  • Deletes associated files (.nii and .json) from the file system.

  • Updates the UI table to reflect removals.

The removal process can be cancelled by the user when prompted. If multiple scans are selected, the user can choose to apply their decision to all remaining scans.

Side effects:
  • Modifies database by removing documents from COLLECTION_CURRENT and COLLECTION_INITIAL.

  • Deletes scan files from the project folder.

  • Updates UI table rows and marks project as having unsaved modifications.

reset_cell()[source]

Reset selected cells to their original values from the initial collection.

This method restores the values of all selected cells to their original state by retrieving values from COLLECTION_INITIAL and updating COLLECTION_CURRENT. If any cells lack initial values (e.g., user-created tags), a warning is displayed. The operation is recorded in the project history for undo/redo functionality.

Side effects:
  • Updates database values in COLLECTION_CURRENT.

  • Updates table cell display values.

  • Appends operation to project.undos.

  • Clears project.redos.

  • May display a warning dialog for unreset values.

  • Resizes table columns to fit content.

reset_column()[source]

Reset selected columns to their original values.

Restores values in selected cells to their initial state from the database. If a cell’s initial value doesn’t exist (e.g., user-added tags), it cannot be reset and a warning will be displayed. The operation is recorded in the project’s undo history. Any existing redo history is cleared after this operation.

Side effects:
  • Updates database values in COLLECTION_CURRENT.

  • Updates table cell displays.

  • Appends to project.undos.

  • Clears project.redos.

  • Resizes columns to fit content.

  • May display warning dialog for unreset values.

reset_row()[source]

Reset selected cells to their original values from the initial collection.

Restores the values of all cells in selected rows to their initial state by copying values from COLLECTION_INITIAL to COLLECTION_CURRENT. Only cells with available initial values are reset. User-defined tags without initial values are skipped and trigger a warning dialog.

The operation is recorded in the project’s undo/redo history, allowing users to revert the reset if needed. After resetting, columns are automatically resized to fit their contents.

Side Effects:
  • Updates database values in COLLECTION_CURRENT.

  • Updates table cell display values.

  • Appends operation to project.undos.

  • Clears project.redos.

  • Shows warning dialog if any values couldn’t be reset.

  • Resizes table columns.

section_moved(logical_index, old_index, new_index)[source]

Handle section movement to keep the FileName column fixed at position 0.

This slot is triggered when a user attempts to reorder table columns. It ensures the FileName column (logical index 0) always remains at the leftmost visual position, regardless of user drag-and-drop actions.

Parameters:
  • logical_index – The logical index of the moved column (unused).

  • old_index – The previous visual position of the column (unused).

  • new_index – The new visual position of the column (unused).

Note

Parameters are required by the Qt signal signature but not used in the implementation. Uses a guard flag to prevent recursive calls when programmatically repositioning the FileName column.

select_all_column(col)[source]

Select all cells in a column when its header is double-clicked.

This method clears any existing selection before selecting the entire column, ensuring only the specified column is highlighted.

Parameters:

col – (int) The zero-based index of the column to select.

select_all_columns()[source]

Select all columns containing currently selected cells.

Expands the current cell selection to include entire columns. If cells from multiple columns are selected, all corresponding columns will be selected. This method is typically invoked from the context menu.

Note

Temporarily switches selection mode to MultiSelection during operation, then restores ExtendedSelection mode.

selection_changed()[source]

Update the tab view when the table selection changes.

Rebuilds the internal scans list based on currently selected items, grouping tag names by scan name. If link_viewer is enabled, updates the connected mini viewer display.

Side effects:
  • Clears and repopulates self.scans with [scan_name, [tag_names]] pairs.

  • Calls data_browser.connect_mini_viewer() if self.link_viewer is True.

show_brick_history(scan)[source]

Display a popup window showing the history of a brick.

This method retrieves the brick UUID associated with the triggering sender, creates a history popup dialog, and displays it to the user.

Parameters:

scan – The scan data to display in the history popup.

Note

The sender (typically a UI widget) must be registered in self.bricks to retrieve the corresponding brick UUID.

sort_column(order)[source]

Sort the currently selected column.

Parameters:

order

(Qt.SortOrder or int) Sort order to apply:

  • Qt.AscendingOrder (0): Sort from lowest to highest.

  • Qt.DescendingOrder (1): Sort from highest to lowest.

Note

Temporarily disconnects signals during sorting to prevent unwanted side effects, then reconnects them afterward.

sort_updated(column, order)[source]

Update project state and apply sorting to the table.

Temporarily disconnects signals, updates the project’s sort configuration, applies the sort to table items, refreshes visual elements, and reconnects signals.

Parameters:
  • column – The column index to sort by. Use -1 to indicate no sorting.

  • order – The sort order (Qt.AscendingOrder or Qt.DescendingOrder).

Note

This method is a no-op when column is -1, allowing safe calls with invalid column indices.

update_colors()[source]

Update cell background colors based on data state and visibility.

Colors indicate:
  • White/Grey: Unmodified builtin tags (alternating for visible rows).

  • Cyan/Blue: Modified builtin tags (alternating for visible rows).

  • Pink/Red: User-defined tags or null values (alternating for visible rows).

Note

This method assumes the itemChanged signal is disconnected. Automatically saves modifications if auto-save is enabled.

update_selection()[source]

Update table selection based on current scan results.

Clears existing selection and selects cells corresponding to tags found in the current scan results. For each scan, selects the cells at the intersection of the scan’s row and its associated tag columns.

update_table(take_tags_to_update=False)[source]

Refresh the table with current project data.

Completely resets and repopulates the table when switching projects. This involves clearing selections, fetching current scan documents, refilling headers and cells, resizing columns/rows, and updating the visual appearance.

Parameters:

take_tags_to_update – If True, updates tags during the header fill operation. Defaults to False.

Side Effects:
  • Clears current table selection.

  • Resets scans_to_visualize and scans_to_search attributes.

  • Clears selected scans list if selection is active.

  • Disconnects and reconnects table signals.

  • Modifies table dimensions and visual styling.

update_visualized_columns(old_tags, showed)[source]

Update column visibility based on tag selection changes.

Synchronizes the table’s visible columns with the provided tag list by:
  • Hiding columns for tags that are no longer displayed.

  • Showing columns for newly displayed tags.

  • Updating advanced search dropdowns if the search panel is open.

  • Refreshing column sizing and colors.

Parameters:
  • old_tags – (list) Previously visualized tags.

  • showed – (list) Tags to currently display in the table.

update_visualized_rows(old_scans)[source]

Update table row visibility based on current scan visualization state.

Temporarily disconnects selection signals, hides rows for scans no longer in the visualization list, shows rows for newly visualized scans, and updates the table appearance.

Parameters:

old_scans – Collection of scans from the previous state, used to determine which rows need to be hidden.

visualized_tags_pop_up()[source]

Display a modal dialog for configuring visualized tag columns.

Opens a properties popup showing currently visible tags and allowing the user to modify which tags are displayed in the data browser. The popup is sized to 50% of screen width and 80% of screen height.

class populse_mia.user_interface.data_browser.data_browser.TimeFormatDelegate(parent=None)[source]

Bases: QItemDelegate

Delegate for handling time data display and editing in table views.

This delegate creates a QTimeEdit widget with millisecond precision (hh:mm:ss.zzz format) for editing time values in a TableDataBrowser.

Contains:

Methods:

  • createEditor: Create and return a QDateEdit widget for editing times.

__init__(parent=None)[source]

Initialize the time format delegate.

Parameters:

parent – Parent QWidget, if any. Defaults to None.

createEditor(parent, option, index)[source]

Create and configure the editor widget for time values.

Parameters:
  • parent – Parent widget for the editor.

  • option – Style options for the item (unused, required by Qt API).

  • index – Model index of the item being edited (unused, required by Qt API).

Returns:

(QTimeEdit) Configured time editor widget with hh:mm:ss.zzz format.