Skip to content

Keep user curve styles; convert legacy automatic styles when loading DataLab <= 1.3 files - #464

Merged
PierreRaybaut merged 1 commit into
developfrom
fix/legacy-curve-styles-on-load
Oct 30, 2026
Merged

PierreRaybaut merged 1 commit into
developfrom
fix/legacy-curve-styles-on-load

Conversation

@PierreRaybaut

Copy link
Copy Markdown
Contributor

Fix of an unreleased change of #454 (curve readability). Depends on DataLab-Platform/SigimaX#37, on the same branch name, which is cloned by the CI.

Problem

Since #454, SigimaX ignored stored curve styles at display time when they matched the automatic style cycle of DataLab 1.3 or earlier (tab10 colors with one of 4 line styles). A style chosen by the user among these 40 combinations, for example #1f77b4 with a solid line, was therefore:

  • lost when reloading a workspace;
  • removed from the metadata at the next save.

Change

SigimaX now always restores stored styles (DataLab-Platform/SigimaX#37). The automatic styles stored by older versions are therefore converted once, when DataLab loads their files.

Native HDF5 reader

  • NativeH5Reader.saved_version: version that saved the file, decoded once whether it is stored as a string or as bytes. H5InputOutput now uses it, instead of its own private method.
  • NativeH5Reader.has_legacy_curve_styles, based on is_legacy_style_version:
    • the file is considered legacy when its release number is lower than 1.4 (compared with packaging), so pre-releases of 1.4 are not legacy;
    • a missing or invalid version keeps the stored styles.

Signal loading

  • SignalPanel.deserialize_object_from_hdf5 removes color and style when the file is legacy and the pair belongs to the old automatic cycle. The conversion happens before the plot items are created.
  • This single point covers opening and appending workspaces, the headless mode, and .dlhist files, both when loaded into an empty workspace and when imported into a workspace in use.

Documentation

  • View menu (Reset curve styles) and 1.4.0 release notes:
    • styles chosen with DataLab 1.3 that are identical to an automatic style of that version are also removed;
    • metadata imported from a file are applied as they are.
  • French translations.

Tests

  • curve_styles_unit_test.py:
    • a workspace whose DataLab_Version is rewritten to 1.3.0 is converted, while a legacy color with DotLine is kept;
    • the same file with the current version keeps its styles;
    • a .dlhist file dated 1.3 is converted when imported into a workspace in use;
    • #1f77b4 with SolidLine chosen by the user survives two HDF5 cycles;
    • version parsing (1.4.0rc1, 1.4.0.dev0, 1.10.0, invalid values, None).
  • New native_reader_unit_test.py: saved_version stored as a string, as bytes, or invalid.
  • test_open_file_headless_refreshes_reference_displays: its reader test double now provides saved_version, as the reader does.
  • Without the conversion added to SignalPanel, both legacy loading tests fail.
  • Local runs of the signal, hdf5, common, backbone, image, plugins and control suites: 1103 passed, 3 skipped.

…files

Since SigimaX always restores stored curve styles, the automatic styles
that DataLab 1.3 and earlier stored in signal metadata are now removed
when loading native HDF5 files (workspaces, history files) saved by these
versions, so that their curves get the current automatic styles. Styles
stored by later versions are always kept, including user styles identical
to an automatic style of earlier versions (e.g. #1f77b4 with a solid
line), which were lost when reloading a workspace.

- `NativeH5Reader.saved_version` (decoded once) and
  `NativeH5Reader.has_legacy_curve_styles`, based on
  `is_legacy_style_version` (release < 1.4; missing or invalid versions
  keep stored styles); `H5InputOutput` uses `saved_version`
- `SignalPanel.deserialize_object_from_hdf5` removes `color` and `style`
  when the file is legacy and the pair is a legacy automatic style
- Tests: legacy workspace and history file converted, current files kept,
  user style from the legacy cycle kept over two round trips, version
  parsing; headless reader test double updated to the reader contract
- Documentation, release notes and French translations

Assisted-by: Claude Opus 5.5
@PierreRaybaut
PierreRaybaut merged commit 0258fe6 into develop Oct 30, 2026
6 checks passed
@PierreRaybaut
PierreRaybaut deleted the fix/legacy-curve-styles-on-load branch October 30, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant