aiidalab / aiidalab-widgets-base

Reusable widgets for AiiDAlab applications
MIT License
7 stars 17 forks source link

Avoid black sphere in structure viewer #637

Closed superstar54 closed 1 month ago

superstar54 commented 1 month ago

Fix #633 . In the case of a structure with only one atom, the structure viewer shows a black sphere. As shown below: Screenshot from 2024-10-08 13-35-31

This could be because of the overlap between the atoms and the control of the viewer. This PR implements a quick solution by shifting the center of the control in z direction by 1. Now the viewer shows: Screenshot from 2024-10-08 13-32-03

superstar54 commented 1 month ago

The failed test is related to the query of the Crystallography Open Database, thus it is not related to this PR.

danielhollas commented 1 month ago

Just wondering, is this a bug that should be reported upstream? I.e. is this an nglview problem?

superstar54 commented 1 month ago

Just wondering, is this a bug that should be reported upstream? I.e. is this an nglview problem?

I am not sure if it is a bug or not. The problem is that we call the center method after drawing the atoms and bonds. If we use the default setting, the nglview shows the correct atoms, but the view is not centered. Anyway, I opened an issue and waited for other's options.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.43%. Comparing base (152c2bb) to head (3ee8fcb). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
aiidalab_widgets_base/viewers.py 25.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #637 +/- ## ========================================== - Coverage 83.50% 83.43% -0.07% ========================================== Files 17 17 Lines 3546 3550 +4 ========================================== + Hits 2961 2962 +1 - Misses 585 588 +3 ``` | [Flag](https://app.codecov.io/gh/aiidalab/aiidalab-widgets-base/pull/637/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidalab) | Coverage Δ | | |---|---|---| | [python-3.11](https://app.codecov.io/gh/aiidalab/aiidalab-widgets-base/pull/637/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidalab) | `83.43% <25.00%> (-0.07%)` | :arrow_down: | | [python-3.9](https://app.codecov.io/gh/aiidalab/aiidalab-widgets-base/pull/637/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidalab) | `83.47% <25.00%> (-0.07%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidalab#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.