Example #1
0
def __update_existing_dataset_field(field: Dataset, new_ui_field: FieldWidget):
    new_ui_field.name = field.name
    new_ui_field.dtype = ValueTypes.STRING if not field.type else field.type
    new_ui_field.value = field.values  # type: ignore
    new_ui_field.attrs = field
    units = field.attributes.get_attribute_value(CommonAttrs.UNITS)
    new_ui_field.units = units
Example #2
0
def update_existing_array_field(field: h5py.Dataset, new_ui_field: FieldWidget):
    """
    Fill in a UI array field for an existing array field in the component group
    :param value: The array dataset's value to copy to the UI fields list model
    :param new_ui_field: The new UI field to fill in with existing data
    """
    new_ui_field.field_type = FieldType.array_dataset.value
    new_ui_field.dtype = field.dtype
    new_ui_field.value = field[()]
Example #3
0
def update_existing_scalar_field(field: h5py.Dataset, new_ui_field: FieldWidget):
    """
    Fill in a UI scalar field for an existing scalar field in the component group
    :param field: The dataset to copy into the value line edit
    :param new_ui_field: The new UI field to fill in with existing data
    """
    new_ui_field.field_type = FieldType.scalar_dataset.value
    dtype = field.dtype
    if "S" in str(dtype):
        dtype = h5py.special_dtype(vlen=str)
        new_ui_field.value = field[()]
    else:
        new_ui_field.value = field[()]
    new_ui_field.dtype = dtype