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

Napari windows resizes out of screen in case layer.features contains many columns #5417

Closed
haesleinhuepf opened this issue Dec 17, 2022 · 6 comments · Fixed by #5451
Closed
Labels
bug Something isn't working

Comments

@haesleinhuepf
Copy link
Contributor

haesleinhuepf commented Dec 17, 2022

🐛 Bug

When layer.features contains a wide table and a user hovers over the labels layer, the Napari window resizes out of screen. I presume it has something to do with the status text field on the bottom of the window showing label properties.

To Reproduce

Steps to reproduce the behavior:

  1. Run this code:
import numpy as np
import napari
import pandas

viewer = napari.Viewer()

viewer.add_image(np.asarray([[1,2],[2,2]]))
labels_layer = viewer.add_labels(np.asarray([[1,2],[3,3]]))

labels_layer.features = {
    "label": [1, 2, 3],
    "very_wide_column_name_1": [1/3, 1/3, 1/3],
    "very_wide_column_name_2": [1/3, 1/3, 1/3],
    "very_wide_column_name_3": [1/3, 1/3, 1/3],
    "very_wide_column_name_4": [1/3, 1/3, 1/3],
    "very_wide_column_name_5": [1/3, 1/3, 1/3],
    "very_wide_column_name_6": [1/3, 1/3, 1/3],
    "very_wide_column_name_7": [1/3, 1/3, 1/3],
    "very_wide_column_name_8": [1/3, 1/3, 1/3],
    "very_wide_column_name_9": [1/3, 1/3, 1/3],
}
  1. Afterwards, hover with your mouse over a label in the image.
  2. Napari's screen window size will become very wide and the image jumps out of screen:
haase-17-12-2022-18-25-10.mp4

Expected behavior

Napari's window size does not change when the user hovers with their mouse over the label image.

Environment

  • Please copy and paste the information at napari info option in help menubar here:
napari: 0.4.17
Platform: Windows-10-10.0.19045-SP0
Python: 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:41:22) [MSC v.1929 64 bit (AMD64)]
Qt: 5.15.6
PyQt5: 5.15.7
NumPy: 1.23.5
SciPy: 1.9.3
Dask: 2022.12.1
VisPy: 0.11.0
magicgui: 0.6.1
superqt: unknown
in-n-out: 0.1.6
app-model: 0.1.1
npe2: 0.6.1

OpenGL:
- GL version: 4.6.14802 Compatibility Profile Context 21.40.18.19 30.0.14018.19001
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1920x1200, scale 1.0

  • Any other relevant information:

I'm running on Windows 10

Workaround:

mamba install napari=0.4.15 -c conda-forge
@haesleinhuepf haesleinhuepf added the bug Something isn't working label Dec 17, 2022
@haesleinhuepf
Copy link
Contributor Author

Addendum: Sometimes, this warning is printed out confirming that a resize event is the issue here:

WARNING: QWindowsWindow::setGeometry: Unable to set geometry 2654x698+1309+366 (frame: 2670x737+1301+335) on QWidgetWindow/"_QtMainWindowClassWindow" on "\.\DISPLAY1". Resulting geometry: 1924x698+1309+366 (frame: 1940x737+1301+335) margins: 8, 31, 8, 8 minimum size: 374x557 MINMAXINFO maxSize=0,0 maxpos=0,0 mintrack=390,596 maxtrack=0,0)

@haesleinhuepf
Copy link
Contributor Author

One more workaround using napari-skimage-regionprops 0.5.7:

from napari_skimage_regionprops import add_table
add_table(labels_layer, viewer)

@Czaki
Copy link
Collaborator

Czaki commented Dec 18, 2022

@haesleinhuepf It looks like there is a problem with the outdated superqt version. Could you install the latest superqt and check if the error is still present?

@haesleinhuepf
Copy link
Contributor Author

The latest version of superqt appears to be 0.4.1 which I have installed.

@brisvag
Copy link
Contributor

brisvag commented Dec 20, 2022

Duplicate of #5177.

@Czaki
Copy link
Collaborator

Czaki commented Dec 21, 2022

The latest version of superqt appears to be 0.4.1 which I have installed.

You are right. The issue is here pyapp-kit/superqt#148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants