populse_mia.user_interface.data_browser.modify_table¶
Database cell editor module for list-type values.
This module provides dialog interfaces for editing complex data type in the Mia data browser. It specifically handles the editing of list-type values such as arrays of numbers, strings, or dates.
The ModifyTable dialog creates an interactive table representation of lists, allowing users to add, edit, or remove items while ensuring type safety and database consistency.
Classes
|
Dialog to modify cell contents containing lists in the data browser tab. |
- class populse_mia.user_interface.data_browser.modify_table.ModifyTable(project, value, types, scans, tags)[source]¶
Bases:
QDialogDialog to modify cell contents containing lists in the data browser tab.
This dialog provides a user interface to edit cells that contain list values. It displays the list elements in a table and allows users to add or remove elements.
Contains:
Methods:
_convert_value: Convert a text value to the appropriate type.
_show_error_message: Display an error message.
add_item: Add one more element to self.value.
fill_table: Fill the table.
rem_last_item: Remove last element of self.value.
update_table_values: Update the table in the database.
- __init__(project, value, types, scans, tags)[source]¶
Initialize the ModifyTable dialog.
- Parameters:
project – Instance of the current project.
value – List of values in the cell to be modified.
types – Allowed value types for validation.
scans – Scan identifiers corresponding to rows.
tags – Tag identifiers corresponding to columns.
- _convert_value(text, field_type)[source]¶
Convert a text value to the appropriate type based on field_type.
- Parameters:
text – String value to convert.
field_type – Database field type constant.
- Returns:
The converted value in the appropriate type.
- _show_error_message(value, type_problem)[source]¶
Display an error message for invalid values.
- Parameters:
value – The invalid value.
type_problem – The specific type that failed validation.
- fill_table()[source]¶
Populate the table with the current list elements.
Configures the table dimensions, populates cells with values, and adjusts table size to fit content within reasonable bounds.