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 layers control section to resize to contents #5474

Merged
merged 4 commits into from
Jan 23, 2023

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented Jan 12, 2023

Description

Set min-height and min-width to the empty widget used by the layers controls container widget instead of the widget itself to allow it to resize dependending on the controls being shown

Preview

resize2

Type of change

  • Bug-fix (non-breaking change which fixes an issue)

References

closes #2337
closes #5472

How has this been tested?

  • all tests pass with my change
  • I check if my changes works with both PySide and PyQt backends
    as there are small differences between the two Qt bindings.

Final checklist:

  • My PR is the minimum possible work for the desired functionality

@dalthviz dalthviz self-assigned this Jan 12, 2023
@github-actions github-actions bot added design Design discussion qt Relates to qt labels Jan 12, 2023
@codecov
Copy link

codecov bot commented Jan 12, 2023

Codecov Report

Merging #5474 (6010cff) into main (54c1dbf) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #5474      +/-   ##
==========================================
- Coverage   89.30%   89.29%   -0.01%     
==========================================
  Files         600      600              
  Lines       51030    51039       +9     
==========================================
+ Hits        45570    45576       +6     
- Misses       5460     5463       +3     
Impacted Files Coverage Δ
napari/_qt/_tests/test_qt_notifications.py 96.02% <100.00%> (+0.02%) ⬆️
napari/_qt/_tests/test_qt_provide_theme.py 100.00% <100.00%> (ø)
napari/_qt/_tests/test_qt_viewer.py 94.60% <100.00%> (+0.02%) ⬆️
.../_qt/layer_controls/qt_layer_controls_container.py 100.00% <100.00%> (ø)
...rs/image/experimental/_tests/test_octree_import.py 100.00% <100.00%> (ø)
napari/_qt/qt_event_loop.py 80.95% <0.00%> (-1.37%) ⬇️
napari/_qt/widgets/qt_viewer_status_bar.py 81.57% <0.00%> (-1.32%) ⬇️
napari/conftest.py 87.74% <0.00%> (-1.14%) ⬇️
napari/_qt/qt_main_window.py 74.56% <0.00%> (-0.18%) ⬇️
napari/_qt/widgets/qt_dims_slider.py 94.21% <0.00%> (+0.01%) ⬆️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@psobolewskiPhD psobolewskiPhD left a comment

Choose a reason for hiding this comment

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

😍
Outstanding, so clever! I couldn't figure out how to make it work, was going to make PR to just increase the min-height to 325.
I love it, works great with all the layers I've tested (points, shapes, labels, image, surface)

napari/_qt/qt_resources/styles/02_custom.qss Outdated Show resolved Hide resolved
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
@psobolewskiPhD
Copy link
Member

Not sure what's up with Windows CI, but I've re-run it twice and it's the same, so I think it's not random?
https://github.com/napari/napari/actions/runs/3905492648/jobs/6674079073#step:8:221

napari\_qt\_tests\test_qt_viewer.py .........................ss......... [ 80%]
  ss...Windows fatal exception: access violation

Copy link
Contributor

@brisvag brisvag left a comment

Choose a reason for hiding this comment

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

Awesome! This seems like the "correct" solution :)

Not sure what's up with Windows CI, but I've re-run it twice and it's the same, so I think it's not random?

This looks familiar... I was stuck due to a bunch of these failures in #5312, and I had to ultimately disable some tests on windows CI. Not sure if it's the same here...

@psobolewskiPhD
Copy link
Member

I tried bumping windows CI to python 3.9 (maybe we should do that anyways, since that's the version we suggest in installation?) but it didn't help.
https://github.com/psobolewskiPhD/napari/actions/runs/3919686014/jobs/6700847765

Can we assume from the 3 dots after skip:
image

That the last 3 tests completed, so it's the first of the next test file?
I'ma try that that in my branch.

@Czaki
Copy link
Collaborator

Czaki commented Jan 14, 2023

could you try to run a verbose test (to find failing job).

It will be also nice to try to run only napari\_qt\tests\test_qt_viewer.py to check if fils are related only to these tests.

@psobolewskiPhD
Copy link
Member

psobolewskiPhD commented Jan 14, 2023

I got pyqt to pass with +1 skip def test_surface_mixed_dim(make_napari_viewer):
https://github.com/psobolewskiPhD/napari/actions/runs/3920033829/jobs/6701406395
But now pyside is still cranky 😡

Edit: also I was not reading the s and dots right 🤣

Edit: it's like whack-a-mole, the viewer tests pass (with skips) but now octree fails:
https://github.com/psobolewskiPhD/napari/actions/runs/3920145076/jobs/6701589988
😡

@psobolewskiPhD
Copy link
Member

Ok, I ended up having to skip 3 tests plus the octree.
https://github.com/psobolewskiPhD/napari/actions/runs/3920450156/jobs/6702331229

The octree one fails and gives a similar error from the subprocess, so I think it's related, but 🤷‍♂️

@dalthviz
Copy link
Member Author

Should I try checking if reverting the min-height change in the qss file helps with the failing checks?

@psobolewskiPhD
Copy link
Member

psobolewskiPhD commented Jan 17, 2023

Should I try checking if reverting the min-height change in the qss file helps with the failing checks?

I guess? hard to imagine that being the culprit, but your commit before mu suggestion seems to have flown by. However, my fork branch is using the 295 value and still shows the same CI issues.
Edit: Wait, my branch is py39, I will revert to 3.8 🤷‍♂️
Edit2: Reverted, commented out the skips and we're back to crashing on CI:
https://github.com/psobolewskiPhD/napari/actions/runs/3940733794/jobs/6742228661
It is curious that it somehow passed 5 days ago. maybe something changed on CI? 🤷‍♂️

@brisvag
Copy link
Contributor

brisvag commented Jan 17, 2023

We also have some flaky tests that w're slowly gettin grid of, so some failures are unfortunately fake :/

@github-actions github-actions bot added the tests Something related to our tests label Jan 17, 2023
@github-actions github-actions bot removed the tests Something related to our tests label Jan 18, 2023
@github-actions github-actions bot added task tests Something related to our tests labels Jan 18, 2023
@dalthviz dalthviz marked this pull request as draft January 18, 2023 16:18
@github-actions github-actions bot removed the task label Jan 19, 2023
@dalthviz dalthviz marked this pull request as ready for review January 19, 2023 16:46
@dalthviz
Copy link
Member Author

dalthviz commented Jan 19, 2023

Note: seems like the skipped tests are failing due to an access violation error on Windows when Vispy code is creating/managing the OpenGL related context/objects?

Some tracebacks/info from the errors/failures on skipped tests:

  • napari\layers\image\experimental_tests\test_octree_import.py:
  stdout = b'\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94... _make_viewer_then\r\n  "napari\\view_layers.py", line 179, in view_image\r\n  "<string>", line 4, in <module>\r\n\r\n'
  stderr = b'',
  retcode = 3221225477
  • napari\napari\napari_qt_tests\test_qt_viewer.py
 Current thread 0x00000e48 (most recent call first):
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\gloo\gl\_gl2.py", line 414 in glDrawArrays
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\gloo\glir.py", line 1357 in draw
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\gloo\glir.py", line 786 in _parse
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\gloo\glir.py", line 824 in parse
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\gloo\glir.py", line 506 in flush
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\gloo\glir.py", line 584 in flush
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\gloo\context.py", line 172 in flush_commands
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\gloo\program.py", line 543 in draw
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\visuals\shaders\program.py", line 102 in draw
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\visuals\visual.py", line 451 in draw
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\scene\visuals.py", line 103 in draw
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\visuals\visual.py", line 605 in draw
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\scene\visuals.py", line 103 in draw
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\scene\canvas.py", line 315 in draw_visual
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\scene\canvas.py", line 277 in _draw_scene
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\scene\canvas.py", line 218 in on_draw
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\util\event.py", line 469 in _invoke_callback
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\util\event.py", line 453 in __call__
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\app\backends\_qt.py", line 903 in paintGL
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\app\backends\_qt.py", line 567 in event
    File "D:\tmp\.tox\py38-windows-pyqt5\lib\site-packages\vispy\app\backends\_qt.py", line 567 in event
    File "D:\a\napari\napari\napari\_qt\layer_controls\qt_layer_controls_container.py", line 126 in _display
    File "D:\a\napari\napari\napari\utils\events\event.py", line 783 in _invoke_callback
    File "D:\a\napari\napari\napari\utils\events\event.py", line 757 in __call__
    File "D:\a\napari\napari\napari\utils\events\containers\_selection.py", line 104 in active
    File "D:\a\napari\napari\napari\utils\events\containers\_selectable_list.py", line 69 in insert
    File "D:\a\napari\napari\napari\components\layerlist.py", line 167 in insert
    File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\_collections_abc.py", line 962 in append
    File "D:\a\napari\napari\napari\components\viewer_model.py", line 826 in add_image
    File "D:\a\napari\napari\napari\utils\migrations.py", line 44 in _update_from_dict
    File "D:\a\napari\napari\napari\_qt\_tests\test_qt_viewer.py", line 522 in test_leaks_image
  • napari_qt_tests\test_qt_notifications.py
  Current thread 0x00000c58 (most recent call first):
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\app\backends\_qt.py", line 823 in _init_specific
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\app\backends\_qt.py", line 372 in __init__
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\app\canvas.py", line 228 in create_native
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\app\canvas.py", line 211 in __init__
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\scene\canvas.py", line 135 in __init__
    File "D:\a\napari\napari\napari\_vispy\canvas.py", line 33 in __init__
    File "D:\a\napari\napari\napari\_qt\qt_viewer.py", line 410 in _create_canvas
    File "D:\a\napari\napari\napari\_qt\qt_viewer.py", line 224 in __init__
    File "D:\a\napari\napari\napari\_qt\qt_main_window.py", line 112 in __init__
    File "D:\a\napari\napari\napari\_qt\qt_main_window.py", line 565 in __init__
    File "D:\a\napari\napari\napari\viewer.py", line 67 in __init__
    File "D:\a\napari\napari\napari\utils\_testsupport.py", line 242 in actual_factory
    File "D:\a\napari\napari\napari\_qt\_tests\test_qt_notifications.py", line 280 in test_notifications_error_with_threading
  • napari_qt_tests\test_qt_provide_theme.py
Current thread 0x000016a8 (most recent call first):
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\app\backends\_qt.py", line 823 in _init_specific
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\app\backends\_qt.py", line 372 in __init__
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\app\canvas.py", line 228 in create_native
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\app\canvas.py", line 211 in __init__
    File "D:\tmp\.tox\py38-windows-pyside2\lib\site-packages\vispy\scene\canvas.py", line 135 in __init__
    File "D:\a\napari\napari\napari\_vispy\canvas.py", line 33 in __init__
    File "D:\a\napari\napari\napari\_qt\qt_viewer.py", line 410 in _create_canvas
    File "D:\a\napari\napari\napari\_qt\qt_viewer.py", line 224 in __init__
    File "D:\a\napari\napari\napari\_qt\qt_main_window.py", line 112 in __init__
    File "D:\a\napari\napari\napari\_qt\qt_main_window.py", line 565 in __init__
    File "D:\a\napari\napari\napari\viewer.py", line 67 in __init__
    File "D:\a\napari\napari\napari\utils\_testsupport.py", line 242 in actual_factory
    File "D:\a\napari\napari\napari\_qt\_tests\test_qt_provide_theme.py", line 86 in make_napari_viewer_with_plugin_theme
    File "D:\a\napari\napari\napari\_qt\_tests\test_qt_provide_theme.py", line 22 in test_provide_theme_hook_registered_correctly

Checked trying to reproduce the test suite failing locally on Windows setting NAPARI_POPUP_TEST=1 but the test suite pass for me:

================= 3457 passed, 41 skipped, 2 xfailed, 9 warnings in 720.14s (0:12:00) =================

Also, checking the CI and local test suite final message seems like an error message from atexit._run_exitfuncs is being printed like 5 times:

Error in atexit._run_exitfuncs:
  PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmp1eehamo7-napari-constraints.txt'
  • Locally:
Error in atexit._run_exitfuncs:
PermissionError: [WinError 32] El proceso no tiene acceso al archivo porque está siendo utilizado por otro proceso: 'C:\\Users\\dalth\\AppData\\Local\\Temp\\tmpm3tu6gaq-napari-constraints.txt'

@dalthviz
Copy link
Member Author

Note: Re-runs of the bundle workflow jobs for failures to upload artifacts probably due to GitHub Actions degradation status. See actions/upload-artifact#383 and https://www.githubstatus.com/incidents/n18j5g7wpg0s

@brisvag
Copy link
Contributor

brisvag commented Jan 20, 2023

Note: seems like the skipped tests are failing due to an access violation error on Windows when Vispy code is creating/managing the OpenGL related context/objects?

Yeah those failures are familiar... Very annoying, sorry about that :/

@brisvag
Copy link
Contributor

brisvag commented Jan 20, 2023

Before merging, how do others feel about these skipped tests? Should we be more responsible and try to solve the problem instead of shoving it under the rug, or are we happy like this? @Czaki @andy-sweet tagging you since the three of us particularly have fought with these flaky tests before...

@Czaki
Copy link
Collaborator

Czaki commented Jan 20, 2023

I do not understand how these changes may reuires so many changes in tests.

@andy-sweet
Copy link
Member

I do not understand how these changes may reuires so many changes in tests.

My assumption is that the skipped tests have underlying issues that are independent of the implementation changes in this PR that mean they fail sometimes. The implementation changes here affect the layout, which in turn affects drawing the widgets, which is something that could be relatively slow on CI runners. My other more speculative guess is that the Windows runners might be a bit slower in this regard and that's the reason we often skip on Windows CI only rather than there being an actual Windows issue.

We already have quite a lot of skips, so I have no issue with the ones added here, especially given the fix is simple and desirable.

@brisvag
Copy link
Contributor

brisvag commented Jan 23, 2023

Ok, I guess I'll merge then. Let's hope that as these issues keep showing up, we can figure out exactly how to prevent them :)

@brisvag brisvag merged commit 465c281 into napari:main Jan 23, 2023
@Czaki Czaki mentioned this pull request Jun 7, 2023
@Czaki Czaki added this to the 0.4.18 milestone Jun 13, 2023
@Czaki Czaki added the triaged-0.4.18 To mark PR that is triaged in 0.4.18 release process label Jun 13, 2023
Czaki pushed a commit that referenced this pull request Jun 16, 2023
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
closes #2337
closes #5472
Czaki pushed a commit that referenced this pull request Jun 17, 2023
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
closes #2337
closes #5472
Czaki pushed a commit that referenced this pull request Jun 18, 2023
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
closes #2337
closes #5472
Czaki pushed a commit that referenced this pull request Jun 19, 2023
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
closes #2337
closes #5472
Czaki pushed a commit that referenced this pull request Jun 21, 2023
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
closes #2337
closes #5472
Czaki pushed a commit that referenced this pull request Jun 21, 2023
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
closes #2337
closes #5472
Czaki pushed a commit that referenced this pull request Jun 21, 2023
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
closes #2337
closes #5472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design discussion enhancement qt Relates to qt tests Something related to our tests triaged-0.4.18 To mark PR that is triaged in 0.4.18 release process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visual Bug: Labels Layer Controls get squished when toggling 3D Text overflow in Labels Layer on Linux
5 participants