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

Improvement/bandswidget sizewarning #839

Merged
merged 10 commits into from
Oct 4, 2024

Conversation

AndresOrtegaGuerrero
Copy link
Member

@AndresOrtegaGuerrero AndresOrtegaGuerrero commented Oct 3, 2024

This PR address #820

The idea I have is to include a javascript that just check if the width and display a message if the size is too narrow.

image

I am not well knowledgable in JavaScript ( I got a lot of help on this one from ChatGPT) Please let me know any suggestions or ideas you might have in mind to address this issue ?

@edan-bainglass @superstar54

Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.87%. Comparing base (73f2534) to head (23b01a0).
Report is 88 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #839      +/-   ##
==========================================
+ Coverage   67.84%   67.87%   +0.02%     
==========================================
  Files          50       50              
  Lines        4503     4507       +4     
==========================================
+ Hits         3055     3059       +4     
  Misses       1448     1448              
Flag Coverage Δ
python-3.11 67.87% <100.00%> (+0.02%) ⬆️
python-3.9 67.90% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@edan-bainglass
Copy link
Member

Using CSS, you could modify the overflow-x property of the plot's container. This will add a horizontal scroll bar when the full container does not fit the screen.

@AndresOrtegaGuerrero
Copy link
Member Author

@edan-bainglass Something like this ?

image

Now the question is showing the scrolling horizontal bar is enough , or if there is the need of the warning displayed as well.

@cpignedoli

@edan-bainglass
Copy link
Member

Looks good. Enough in my option.

@AndresOrtegaGuerrero AndresOrtegaGuerrero marked this pull request as draft October 4, 2024 08:55
@AndresOrtegaGuerrero AndresOrtegaGuerrero marked this pull request as ready for review October 4, 2024 09:23
@AndresOrtegaGuerrero
Copy link
Member Author

Now the question , is should we do it only for electronic structure , or include PDOS tab as well ?

@superstar54
Copy link
Member

Now the question , is should we do it only for electronic structure , or include PDOS tab as well ?

If possible, it would be good for all the widgets to have a scroll bar on a small screen.

Comment on lines 42 to 58

plot_container = ipw.HTML(
"""
<div style='overflow-x: auto; width: 80%; max-width: 80%;'>
<!-- Placeholder for the Plotly plot widget -->
</div>
"""
)
_bands_dos_widget.layout = ipw.Layout(width="1000px")
self.children = [
ipw.VBox(
[
plot_container, # The scrollable container
_bands_dos_widget, # The actual Plotly widget
]
)
]
Copy link
Member

Choose a reason for hiding this comment

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

Add a layout with a fixed width should already add the scroll bar on a small screen.

Suggested change
plot_container = ipw.HTML(
"""
<div style='overflow-x: auto; width: 80%; max-width: 80%;'>
<!-- Placeholder for the Plotly plot widget -->
</div>
"""
)
_bands_dos_widget.layout = ipw.Layout(width="1000px")
self.children = [
ipw.VBox(
[
plot_container, # The scrollable container
_bands_dos_widget, # The actual Plotly widget
]
)
]
_bands_dos_widget.layout = ipw.Layout(width="1000px")
self.children = [
_bands_dos_widget, # The actual Plotly widget
]

Copy link
Member Author

Choose a reason for hiding this comment

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

But then the bar is enough , or do we want a warning too ?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, the plot_container is used for the warning message. Sorry, I misunderstood it.

I think the bar is enough.

Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

Thanks for the work! LGTM!

@AndresOrtegaGuerrero AndresOrtegaGuerrero merged commit 9503aed into main Oct 4, 2024
12 checks passed
@AndresOrtegaGuerrero AndresOrtegaGuerrero deleted the improvement/bandswidget_sizewarning branch October 4, 2024 13:31
edan-bainglass pushed a commit to edan-bainglass/aiidalab-qe that referenced this pull request Oct 24, 2024
* Include an ipywidget Layout to the BandsPdosWidget to set an horizontal scroll bar
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.

legend is not visible or only partially visible in narrow windows
3 participants