Make sure we pass plugin through if opening file as stack
@@ -907,9 +907,22 @@ class ViewerModel(KeymapProvider, MousemapProvider, EventedModel):
A list of any layers that were added to the viewer.
"""
- paths = [path] if isinstance(path, (Path, str)) else path
+ paths: List[str | Path] = (
+ [os.fspath(path)]
+ if isinstance(path, (Path, str))
+ else [os.fspath(p) for p in path]
+ )
if stack:
+ if plugin:
+ layers = self._add_layers_with_plugins(
+ paths,
+ kwargs=kwargs,
+ plugin=plugin,
+ layer_type=layer_type,
+ stack=stack,
+ )
+ else:
layers = self._open_or_raise_error(
paths, kwargs, layer_type, stack
)
@@ -1116,6 +1129,8 @@ class ViewerModel(KeymapProvider, MousemapProvider, EventedModel):
assert stack is not None
assert isinstance(paths, list)
assert not isinstance(paths, str)
+ for p in paths:
+ assert isinstance(p, str)
if stack:
layer_data, hookimpl = read_data_with_plugins(
