Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow register different viewers for different WorkChain. #541

Merged
merged 10 commits into from
Apr 23, 2024
8 changes: 6 additions & 2 deletions aiidalab_widgets_base/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ def viewer(obj, **kwargs):
)
return obj

if obj.node_type in AIIDA_VIEWER_MAPPING:
_viewer = AIIDA_VIEWER_MAPPING[obj.node_type]
_viewer = AIIDA_VIEWER_MAPPING.get(obj.node_type)
if isinstance(obj, orm.ProcessNode):
# Allow to register specific viewers based on obj.process_type
_viewer = AIIDA_VIEWER_MAPPING.get(obj.process_type, _viewer)

if _viewer:
return _viewer(obj, **kwargs)
else:
# No viewer registered for this type, return object itself
Expand Down