[FIX] Saving of multiple selections in ScatterPlot#2598
[FIX] Saving of multiple selections in ScatterPlot#2598astaric merged 2 commits intobiolab:masterfrom
Conversation
|
Potential problem: the save files are incompatible with older versions. As far as I tested there is no mechanism that would notify users that they are trying to open a file that is too new for their Orange installation. |
|
How to properly test saving of schema_only settings? test_points_selection in test_owscatterplot only tests loading of settings - and that is why we did not catch this earlier. |
|
|
||
| @classmethod | ||
| def migrate_settings(cls, settings, version): | ||
| if "selection" in settings \ |
|
For testing saving of settings, you can use something like this: Current widget settings can be packed and restored to a new setting instance The new widget gets the settings if would get if the first widget was saved to a file. |
|
As for the compatibility with older version, you could use a new setting name. This way, when opening a workflow with an old version of Orange, the selection would be lost, but there would be no crash. |
Codecov Report
@@ Coverage Diff @@
## master #2598 +/- ##
==========================================
+ Coverage 75.08% 75.08% +<.01%
==========================================
Files 327 327
Lines 57725 57741 +16
==========================================
+ Hits 43341 43356 +15
- Misses 14384 14385 +1 |
Rename setting selection into selection_group so that older version would not crash with new schemas.
6ab1214 to
0353aea
Compare
|
I added saving tests to the first commit and also renamed the setting. |
|
|
||
| @classmethod | ||
| def migrate_settings(cls, settings, version): | ||
| if version < 2 and "selection" in settings and settings["selection"]: |
There was a problem hiding this comment.
if version < 2 and settings.get(selection):
Issue
Selection saving did not work.
Description of changes
Selection saving needed only a small fix. To also save different selection groups I changed the format of saved selections.
Includes