biolab / orange3-imageanalytics

🍊 :rice_scene: Orange3 add-on for dealing with image related tasks
GNU General Public License v3.0
32 stars 42 forks source link

Image Viewer context is corrupted after encountering data without suitable attributes #243

Closed janezd closed 1 month ago

janezd commented 6 months ago

230 causes crashes. I believe that problems start when data contains no suitable meta attributes, in which case self.image_attr is set to None - although combo does not have this option. This image_attr is nevertheless saved as context. Such context then matches any context and overrides the heuristics. As result, the combo that controsl image_attr shows the first item, while image_attr is actually None. Reselecting the attribute shows images ...

Except that the widget crashes even earlier. https://github.com/biolab/orange3-imageanalytics/pull/230/files#diff-f1387607314e9d4d0902ec7b8bf2987bf2faa37970f60d834865538719c3957bR353 calls column_data_as_qurl which returns []if image_attr is None, which breaks assert len(self.data) == len(urls).

Once image_attr == None is saved in context, the widget will crash on any new data.

While fixing this, we should probably fix the corresponding model: the model takes only meta attribute, but the code that sets the default searches among all attributes. We should decide whether to use metas or all attributes. In the former case, we need to include @markotoplak's fixes for context handlers.