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

register viewer widget with customized key and allow fallback support #430

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

unkcpz
Copy link
Member

@unkcpz unkcpz commented Feb 10, 2023

No description provided.

@@ -71,7 +74,12 @@ def viewer(obj, downloadable=True, **kwargs):
return obj

try:
_viewer = AIIDA_VIEWER_MAPPING[obj.node_type]
try:
_viewer = AIIDA_VIEWER_MAPPING[(obj.node_type, obj.process_label)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering, to make this more general we could use the obj.label instead of obj.process_label. I am just not sure if that would be a backwards compatible change for QeApp.

Copy link
Member Author

@unkcpz unkcpz Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at this. I made this a draft since I did not decided if using process_label is a good design. I was thinking to introduce a rule that stores some standard metadata to extra attributes for use here.
You mentioned in the meeting yesterday that there is a new field that can be used for mapping the process name in TreeNodeWidget, what is that? Is it specific for process or for more general data node?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's just a hook for renaming the process_label, see

https://github.com/ispg-group/aiidalab-ispg/blob/7895ed6ce9aa869e1c3a0803064a22a2d2a83fec/workflows/aiidalab_atmospec_workchain/__init__.py#L109

Implemented here:

aiidateam/aiida-core#5713

It would definitely help to make the node tree more user friendly, but is not needed for this particular feature.

unkcpz added a commit to aiidalab/aiidalab-qe that referenced this pull request Feb 20, 2023
…Workchain (#348)

fixes #344

The register_viewer_widget decorator registers the viewer by class and the new viewer for QeAppWorkchain specifically also become the viewer of other WorkChain. It will raise the KeyError and raised which is not expected.
Instead of raising the exception, nothing is returned. This is a workaround since ideally if there is no new specific viewer defined for a specific work chain, it needs to fall back to the native one of AWB. As tried in aiidalab/aiidalab-widgets-base#430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants