andy-sweet / napari-metadata

A napari plugin to view and edit metadata
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

Store original attributes and allow restoring them from the widget #20

Closed andy-sweet closed 1 year ago

andy-sweet commented 1 year ago

This stores the original values of attributes shown in the widget in the data model of this plugin, then also adds a button that causes those to be restore to their original/default values.

A natural place to populate those original values is at read time, so we do that in our reader contribution. For layers that were read by other plugins, things become harder. Currently, we populate the extra and original metadata attributes only when a layer is selected and our widget is active, so these might not be the values when the layer was read. Alternatively, we could populate those when a layer is added and our widget is active, though that still relies on our widget being active.

Closes #13.

codecov-commenter commented 1 year ago

Codecov Report

Merging #20 (010266d) into main (201758d) will increase coverage by 0.52%. The diff coverage is 100.00%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #20      +/-   ##
==========================================
+ Coverage   91.30%   91.82%   +0.52%     
==========================================
  Files          15       15              
  Lines        1150     1199      +49     
==========================================
+ Hits         1050     1101      +51     
+ Misses        100       98       -2     
Impacted Files Coverage Δ
src/napari_metadata/_model.py 88.28% <100.00%> (+0.78%) :arrow_up:
src/napari_metadata/_reader.py 67.17% <100.00%> (+1.30%) :arrow_up:
src/napari_metadata/_tests/test_widget.py 99.60% <100.00%> (+0.02%) :arrow_up:
src/napari_metadata/_widget.py 93.63% <100.00%> (+2.45%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.