This uses coerce_extra_metadata instead of extra_metadata in the widgets, so that it is always present. This change handles a few cases that would previously result in bugs or strange behavior due to missing extras.
1. Layer.metadata is assigned to an entirely new dictionary. When coming back to the widget, the extras are missing which causes an error.
2. Units were selected for the first selected layer. Then we selected a different layer, and both layers lost their units (because none is used instead).
Even after this PR, (1) will cause the previous metadata to be lost and we'll just repopulate it with the defaults. We could try to fix this by connecting a callback to Layer.events.metadata, but I don't think that's worth the associated trouble and is not a complete fix anyway.
This uses
coerce_extra_metadata
instead ofextra_metadata
in the widgets, so that it is always present. This change handles a few cases that would previously result in bugs or strange behavior due to missing extras.1.
Layer.metadata
is assigned to an entirely new dictionary. When coming back to the widget, the extras are missing which causes an error. 2. Units were selected for the first selected layer. Then we selected a different layer, and both layers lost their units (because none is used instead).Even after this PR, (1) will cause the previous metadata to be lost and we'll just repopulate it with the defaults. We could try to fix this by connecting a callback to
Layer.events.metadata
, but I don't think that's worth the associated trouble and is not a complete fix anyway.Closes #40