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

Update lists without refreshing and other fixes #45

Merged
merged 45 commits into from
Jul 18, 2024

Conversation

goanpeca
Copy link
Contributor

@goanpeca goanpeca commented Jun 4, 2024

Fixes #29
Fixes #61

  • Adds a Refresh button and tooltip that clears cache, requerys npe2api and repopulates the lists
    image

  • Performs actions in place, adding or removing items between lists instead of refreshing them

napari-dialog

  • If the plugin manager is performing a process, and the user closes it, then notifications will inform when processes have finished. Example:
Screenshot 2024-06-06 at 8 48 54 PM
  • It looks like the direct entry dialog has been broken for some time, I added a fix, but currently is only using PIP as install tool. We could add aadd a toolbutton, those that when leaving pressed, display some options (PIP CONDA), and if clicked would function as a normal button and install. Thoughts @jaimergp ?

@goanpeca goanpeca self-assigned this Jun 4, 2024
Copy link

codecov bot commented Jun 6, 2024

Codecov Report

Attention: Patch coverage is 89.17836% with 54 lines in your changes missing coverage. Please review.

Project coverage is 91.91%. Comparing base (5027417) to head (14d0c8a).

Files Patch % Lines
napari_plugin_manager/qt_plugin_dialog.py 85.27% 38 Missing ⚠️
...ri_plugin_manager/_tests/test_installer_process.py 90.62% 6 Missing ⚠️
...ari_plugin_manager/_tests/test_qt_plugin_dialog.py 94.79% 5 Missing ⚠️
napari_plugin_manager/_tests/conftest.py 78.94% 4 Missing ⚠️
napari_plugin_manager/qt_package_installer.py 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
+ Coverage   87.11%   91.91%   +4.79%     
==========================================
  Files           9       10       +1     
  Lines        1366     1669     +303     
==========================================
+ Hits         1190     1534     +344     
+ Misses        176      135      -41     

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

@goanpeca goanpeca marked this pull request as ready for review June 7, 2024 02:01
@goanpeca goanpeca force-pushed the enh/remove-instead-of-refresh branch from be697d2 to 301194d Compare June 7, 2024 02:35
@goanpeca goanpeca changed the title Update lists without refreshing Update lists without refreshing and other fixes Jun 7, 2024
@goanpeca
Copy link
Contributor Author

goanpeca commented Jun 7, 2024

@psobolewskiPhD I tried to use the qdebounce from superqt but it does not exactly work as it is needed.

@psobolewskiPhD
Copy link
Member

psobolewskiPhD commented Jun 8, 2024

Works well. I think the tooltip is too long and technical?
No user has any idea what npe2api is or whatever.
How about just Refresh plugin listings? or something like that? Honestly, refresh alone is probably clear enough.

Also, off topic: oh, pip 🙄 :

ERROR: Cannot install zarpaint==0.3.1 because these package versions have conflicting dependencies.


The conflict is caused by:
    zarpaint 0.3.1 depends on napari>=0.4.11.dev80
    The user requested (constraint) napari==0.5.0a2.dev720+gb00d7381b

Edit: I see now that Jaime requested this. 😬 I think it's just too much of an implementation detail... 🤷

@goanpeca
Copy link
Contributor Author

@jaimergp what do you think. Maybe we could simplify the message a bit :) ?

Copy link
Contributor

@Czaki Czaki left a comment

Choose a reason for hiding this comment

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

Initial review. I would prefer to see much better test coverage, as it will be not often tested maually by core devs.

I also found setUpdatesEnabled method of QWidget https://doc.qt.io/qt-6/qwidget.html#updatesEnabled-prop that may allow increasing batch size so speedup loading plugins.

napari_plugin_manager/qt_package_installer.py Show resolved Hide resolved
napari_plugin_manager/qt_plugin_dialog.py Outdated Show resolved Hide resolved
napari_plugin_manager/qt_plugin_dialog.py Outdated Show resolved Hide resolved
napari_plugin_manager/qt_plugin_dialog.py Outdated Show resolved Hide resolved
napari_plugin_manager/qt_plugin_dialog.py Outdated Show resolved Hide resolved
@goanpeca
Copy link
Contributor Author

Hi @Czaki thanks for the review. Will fixe your suggestions and try to increase coverage!

@goanpeca goanpeca force-pushed the enh/remove-instead-of-refresh branch 3 times, most recently from 725bd36 to 4a9aa84 Compare June 18, 2024 03:37
@goanpeca goanpeca requested review from jaimergp and Czaki June 18, 2024 03:50
@goanpeca
Copy link
Contributor Author

@Czaki added more testing as requested. I think we are in much better shape now :)

@jaimergp
Copy link
Contributor

@jaimergp what do you think. Maybe we could simplify the message a bit :) ?

Yep, no strong feelings. Go ahead.

@dalthviz
Copy link
Member

Hi there, gave this a check and seems like after installing a plugin the only way for it to show up over the installed list is to hit Refresh a couple of times:

install_plugin_refresh

Maybe something in my setup is causing that (checking this on Windows) 🤔

@goanpeca
Copy link
Contributor Author

Hi @dalthviz thanks for checking. Is this something that happens consistently every time or only some of the time? I have seen it sometimes on my end and I am trying to see what can be done.

@dalthviz
Copy link
Member

Is this something that happens consistently every time or only some of the time?

I checked just a couple of times (launched napari, installed a plugin, saw the behavior, uninstalled the plugin and then relaunched napari to check again to record the GIF), so not sure if I can call that being able to reproduce consistenly 😅, but I will check again and define more detailed steps to reproduce 👍

@psobolewskiPhD
Copy link
Member

I also get the issue Daniel posted.
Fresh napari dev install (python 3.12), installed this branch.
Launch napari, open manager.
Filter and install napari-threedee.
Success, but doesn't show:
image

Clicking refresh once briefly showed all installed plugins, then blank again.
Clicking refresh again shows the correct result of the filter:
image

@dalthviz
Copy link
Member

Gave this another check and I would say I can reproduce the issue consistently:

Steps/Behavior

  • Launch napari
  • Open plugins dialog Plugins > Install/Uninstall Plugins...
  • Try to install a plugin (i.e affinder)
    • Plugin item over Available Plugins section shows that is currently installing
  • Plugin item that was being installed disappears from the Available Plugins section but doesn't show over the Installed Plugins section
    • Available Plugins section shows over the item count (415/416)
  • Click Refresh once, it shows a popup related with some info about the need to restart napari after install np2 plugins to update UI related things (not totally sure if related to the work here but, thinking about it, shouldn't the popup be positioned inside the dialog? 🤔 ):
    imagen
  • Close the popup (its a modal popup)
  • Click Refresh again, now the Installed Plugins section is updated and shows the new installed plugin item

Setup info

  • napari info:
napari: 0.5.0a2.dev761+g1a5362af
Platform: Windows-10-10.0.19045-SP0
Python: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:40:08) [MSC v.1938 64 bit (AMD64)]
Qt: 5.15.2
PyQt5: 5.15.10
NumPy: 1.26.4
SciPy: 1.13.1
Dask: 2024.6.1
VisPy: 0.14.3
magicgui: 0.8.3
superqt: 0.6.7
in-n-out: 0.2.1
app-model: 0.2.7
npe2: 0.7.5

OpenGL:
- GL version: 4.5.0 - Build 25.20.100.6444
- MAX_TEXTURE_SIZE: 16384
- GL_MAX_3D_TEXTURE_SIZE: 2048

Screens:
- screen 1: resolution 1366x768, scale 1.0
- screen 2: resolution 1920x1080, scale 1.0

Optional:
- numba: 0.60.0
- triangle not installed

Settings path:
- C:\Users\dalth\AppData\Local\napari\napari-dev_4454fdbf170edefe23827a4bf512389a6806af69\settings.yaml
  • conda list
# packages in environment at C:\Users\dalth\anaconda3\envs\napari-dev:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.16                   pypi_0    pypi
annotated-types           0.7.0                    pypi_0    pypi
anyio                     4.4.0                    pypi_0    pypi
app-model                 0.2.7                    pypi_0    pypi
appdirs                   1.4.4                    pypi_0    pypi
argon2-cffi               23.1.0                   pypi_0    pypi
argon2-cffi-bindings      21.2.0                   pypi_0    pypi
arrow                     1.3.0                    pypi_0    pypi
asciitree                 0.3.3                    pypi_0    pypi
asttokens                 2.4.1                    pypi_0    pypi
async-lru                 2.0.4                    pypi_0    pypi
attrs                     23.2.0                   pypi_0    pypi
babel                     2.15.0                   pypi_0    pypi
beautifulsoup4            4.12.3                   pypi_0    pypi
bleach                    6.1.0                    pypi_0    pypi
build                     1.2.1                    pypi_0    pypi
bzip2                     1.0.8                hcfcfb64_5    conda-forge
ca-certificates           2024.6.2             h56e8100_0    conda-forge
cachey                    0.2.1                    pypi_0    pypi
certifi                   2024.6.2                 pypi_0    pypi
cffi                      1.16.0                   pypi_0    pypi
cfgv                      3.4.0                    pypi_0    pypi
charset-normalizer        3.3.2                    pypi_0    pypi
check-manifest            0.49                     pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
cloudpickle               3.0.0                    pypi_0    pypi
colorama                  0.4.6                    pypi_0    pypi
comm                      0.2.2                    pypi_0    pypi
contourpy                 1.2.1                    pypi_0    pypi
coverage                  7.5.3                    pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
dask                      2024.6.1                 pypi_0    pypi
debugpy                   1.8.1                    pypi_0    pypi
decorator                 5.1.1                    pypi_0    pypi
defusedxml                0.7.1                    pypi_0    pypi
distlib                   0.3.8                    pypi_0    pypi
docstring-parser          0.16                     pypi_0    pypi
docutils                  0.21.2                   pypi_0    pypi
exceptiongroup            1.2.1                    pypi_0    pypi
executing                 2.0.1                    pypi_0    pypi
fasteners                 0.19                     pypi_0    pypi
fastjsonschema            2.20.0                   pypi_0    pypi
filelock                  3.15.3                   pypi_0    pypi
fire                      0.6.0                    pypi_0    pypi
flexcache                 0.3                      pypi_0    pypi
flexparser                0.3.1                    pypi_0    pypi
fonttools                 4.53.0                   pypi_0    pypi
fqdn                      1.5.1                    pypi_0    pypi
freetype-py               2.4.0                    pypi_0    pypi
fsspec                    2024.6.0                 pypi_0    pypi
h11                       0.14.0                   pypi_0    pypi
heapdict                  1.0.1                    pypi_0    pypi
hsluv                     5.0.4                    pypi_0    pypi
httpcore                  1.0.5                    pypi_0    pypi
httpx                     0.27.0                   pypi_0    pypi
humanize                  4.9.0                    pypi_0    pypi
hypothesis                6.103.2                  pypi_0    pypi
identify                  2.5.36                   pypi_0    pypi
idna                      3.7                      pypi_0    pypi
imageio                   2.34.1                   pypi_0    pypi
imagesize                 1.4.1                    pypi_0    pypi
importlib-metadata        7.1.0                    pypi_0    pypi
in-n-out                  0.2.1                    pypi_0    pypi
iniconfig                 2.0.0                    pypi_0    pypi
ipykernel                 6.29.4                   pypi_0    pypi
ipython                   8.25.0                   pypi_0    pypi
isoduration               20.11.0                  pypi_0    pypi
jedi                      0.19.1                   pypi_0    pypi
jinja2                    3.1.4                    pypi_0    pypi
json5                     0.9.25                   pypi_0    pypi
jsonpointer               3.0.0                    pypi_0    pypi
jsonschema                4.22.0                   pypi_0    pypi
jsonschema-specifications 2023.12.1                pypi_0    pypi
jupyter-client            8.6.2                    pypi_0    pypi
jupyter-core              5.7.2                    pypi_0    pypi
jupyter-events            0.10.0                   pypi_0    pypi
jupyter-lsp               2.2.5                    pypi_0    pypi
jupyter-server            2.14.1                   pypi_0    pypi
jupyter-server-terminals  0.5.3                    pypi_0    pypi
jupyterlab                4.2.2                    pypi_0    pypi
jupyterlab-pygments       0.3.0                    pypi_0    pypi
jupyterlab-server         2.27.2                   pypi_0    pypi
kiwisolver                1.4.5                    pypi_0    pypi
lazy-loader               0.4                      pypi_0    pypi
libffi                    3.4.2                h8ffe710_5    conda-forge
libsqlite                 3.46.0               h2466b09_0    conda-forge
libzlib                   1.3.1                h2466b09_1    conda-forge
llvmlite                  0.43.0                   pypi_0    pypi
locket                    1.0.0                    pypi_0    pypi
lxml                      5.2.2                    pypi_0    pypi
lxml-html-clean           0.1.1                    pypi_0    pypi
magicgui                  0.8.3                    pypi_0    pypi
markdown-it-py            3.0.0                    pypi_0    pypi
markupsafe                2.1.5                    pypi_0    pypi
matplotlib                3.9.0                    pypi_0    pypi
matplotlib-inline         0.1.7                    pypi_0    pypi
mdurl                     0.1.2                    pypi_0    pypi
mistune                   3.0.2                    pypi_0    pypi
ml-dtypes                 0.4.0                    pypi_0    pypi
mouseinfo                 0.1.3                    pypi_0    pypi
napari                    0.5.0a2.dev761+g1a5362af          pypi_0    pypi
napari-console            0.0.9                    pypi_0    pypi
napari-plugin-engine      0.2.0                    pypi_0    pypi
napari-plugin-manager     0.1.dev212+g4a9aa84          pypi_0    pypi
napari-svg                0.1.10                   pypi_0    pypi
nbclient                  0.10.0                   pypi_0    pypi
nbconvert                 7.16.4                   pypi_0    pypi
nbformat                  5.10.4                   pypi_0    pypi
nd2                       0.10.1                   pypi_0    pypi
nest-asyncio              1.6.0                    pypi_0    pypi
networkx                  3.3                      pypi_0    pypi
nodeenv                   1.9.1                    pypi_0    pypi
notebook-shim             0.2.4                    pypi_0    pypi
npe2                      0.7.5                    pypi_0    pypi
numba                     0.60.0                   pypi_0    pypi
numcodecs                 0.12.1                   pypi_0    pypi
numpy                     1.26.4                   pypi_0    pypi
numpydoc                  1.7.0                    pypi_0    pypi
ome-types                 0.5.1.post1              pypi_0    pypi
openssl                   3.3.1                h2466b09_0    conda-forge
overrides                 7.7.0                    pypi_0    pypi
packaging                 24.1                     pypi_0    pypi
pandas                    2.2.2                    pypi_0    pypi
pandocfilters             1.5.1                    pypi_0    pypi
parso                     0.8.4                    pypi_0    pypi
partd                     1.4.2                    pypi_0    pypi
pillow                    10.3.0                   pypi_0    pypi
pint                      0.24                     pypi_0    pypi
pip                       24.0               pyhd8ed1ab_0    conda-forge
platformdirs              4.2.2                    pypi_0    pypi
pluggy                    1.5.0                    pypi_0    pypi
pooch                     1.8.2                    pypi_0    pypi
pre-commit                3.7.1                    pypi_0    pypi
pretend                   1.0.9                    pypi_0    pypi
prometheus-client         0.20.0                   pypi_0    pypi
prompt-toolkit            3.0.47                   pypi_0    pypi
psutil                    6.0.0                    pypi_0    pypi
psygnal                   0.11.1                   pypi_0    pypi
pure-eval                 0.2.2                    pypi_0    pypi
pyautogui                 0.9.54                   pypi_0    pypi
pyconify                  0.1.6                    pypi_0    pypi
pycparser                 2.22                     pypi_0    pypi
pydantic                  1.10.17                  pypi_0    pypi
pydantic-compat           0.1.2                    pypi_0    pypi
pydantic-core             2.18.4                   pypi_0    pypi
pygetwindow               0.0.9                    pypi_0    pypi
pygments                  2.18.0                   pypi_0    pypi
pymsgbox                  1.0.9                    pypi_0    pypi
pyopengl                  3.1.7                    pypi_0    pypi
pyparsing                 3.1.2                    pypi_0    pypi
pyperclip                 1.9.0                    pypi_0    pypi
pyproject-hooks           1.1.0                    pypi_0    pypi
pyqt5                     5.15.10                  pypi_0    pypi
pyqt5-qt5                 5.15.2                   pypi_0    pypi
pyqt5-sip                 12.13.0                  pypi_0    pypi
pyqt6                     6.7.0                    pypi_0    pypi
pyqt6-qt6                 6.7.2                    pypi_0    pypi
pyqt6-sip                 13.6.0                   pypi_0    pypi
pyrect                    0.2.0                    pypi_0    pypi
pyscreeze                 0.1.30                   pypi_0    pypi
pytest                    8.2.2                    pypi_0    pypi
pytest-pretty             1.2.0                    pypi_0    pypi
pytest-qt                 4.4.0                    pypi_0    pypi
python                    3.10.14         h4de0772_0_cpython    conda-forge
python-dateutil           2.9.0.post0              pypi_0    pypi
python-json-logger        2.0.7                    pypi_0    pypi
pytweening                1.2.0                    pypi_0    pypi
pytz                      2024.1                   pypi_0    pypi
pywin32                   306                      pypi_0    pypi
pywinpty                  2.0.13                   pypi_0    pypi
pyyaml                    6.0.1                    pypi_0    pypi
pyzmq                     26.0.3                   pypi_0    pypi
qtconsole                 5.5.2                    pypi_0    pypi
qtpy                      2.4.1                    pypi_0    pypi
referencing               0.35.1                   pypi_0    pypi
requests                  2.32.3                   pypi_0    pypi
resource-backed-dask-array 0.1.0                    pypi_0    pypi
rfc3339-validator         0.1.4                    pypi_0    pypi
rfc3986-validator         0.1.1                    pypi_0    pypi
rich                      13.7.1                   pypi_0    pypi
rpds-py                   0.18.1                   pypi_0    pypi
ruff                      0.4.9                    pypi_0    pypi
scikit-image              0.24.0                   pypi_0    pypi
scipy                     1.13.1                   pypi_0    pypi
seaborn                   0.13.2                   pypi_0    pypi
send2trash                1.8.3                    pypi_0    pypi
setuptools                70.1.0             pyhd8ed1ab_0    conda-forge
shellingham               1.5.4                    pypi_0    pypi
six                       1.16.0                   pypi_0    pypi
sniffio                   1.3.1                    pypi_0    pypi
snowballstemmer           2.2.0                    pypi_0    pypi
sortedcontainers          2.4.0                    pypi_0    pypi
soupsieve                 2.5                      pypi_0    pypi
sphinx                    7.3.7                    pypi_0    pypi
sphinxcontrib-applehelp   1.0.8                    pypi_0    pypi
sphinxcontrib-devhelp     1.0.6                    pypi_0    pypi
sphinxcontrib-htmlhelp    2.0.5                    pypi_0    pypi
sphinxcontrib-jsmath      1.0.1                    pypi_0    pypi
sphinxcontrib-qthelp      1.0.7                    pypi_0    pypi
sphinxcontrib-serializinghtml 1.1.10                   pypi_0    pypi
stack-data                0.6.3                    pypi_0    pypi
superqt                   0.6.7                    pypi_0    pypi
tabulate                  0.9.0                    pypi_0    pypi
tensorstore               0.1.62                   pypi_0    pypi
termcolor                 2.4.0                    pypi_0    pypi
terminado                 0.18.1                   pypi_0    pypi
tifffile                  2024.6.18                pypi_0    pypi
tinycss2                  1.3.0                    pypi_0    pypi
tk                        8.6.13               h5226925_1    conda-forge
tomli                     2.0.1                    pypi_0    pypi
tomli-w                   1.0.0                    pypi_0    pypi
toolz                     0.12.1                   pypi_0    pypi
tornado                   6.4.1                    pypi_0    pypi
tqdm                      4.66.4                   pypi_0    pypi
traitlets                 5.14.3                   pypi_0    pypi
typer                     0.12.3                   pypi_0    pypi
types-python-dateutil     2.9.0.20240316           pypi_0    pypi
typing-extensions         4.12.2                   pypi_0    pypi
tzdata                    2024.1                   pypi_0    pypi
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
uri-template              1.3.0                    pypi_0    pypi
urllib3                   2.2.2                    pypi_0    pypi
vc                        14.3                h8a93ad2_20    conda-forge
vc14_runtime              14.40.33810         ha82c5b3_20    conda-forge
virtualenv                20.26.2                  pypi_0    pypi
vispy                     0.14.3                   pypi_0    pypi
vs2015_runtime            14.40.33810         h3bf8584_20    conda-forge
wcwidth                   0.2.13                   pypi_0    pypi
webcolors                 24.6.0                   pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
websocket-client          1.8.0                    pypi_0    pypi
wget                      3.2                      pypi_0    pypi
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
wrapt                     1.16.0                   pypi_0    pypi
xarray                    2024.6.0                 pypi_0    pypi
xsdata                    24.3.1                   pypi_0    pypi
xz                        5.2.6                h8d14728_0    conda-forge
zarr                      2.18.2                   pypi_0    pypi
zarr-tools                0.4.5                    pypi_0    pypi
zenodo-get                1.6.1                    pypi_0    pypi
zipp                      3.19.2                   pypi_0    pypi

@goanpeca
Copy link
Contributor Author

So it seems that the latest napari dev is using numpy 2 for py 3.11 and above and that is causing problems here. I added numpy<2 in the package dependencies just to check...and tests are not segfaulting anymore.

What do you think we should do @jaimergp ?

@jaimergp
Copy link
Contributor

Hm, that's interesting. AFAIK we are not using numpy ourselves, are we? Maybe @Czaki or @jni know more about this tricky pyside x numpy interaction 😬

@goanpeca
Copy link
Contributor Author

This message was appearing when running the tests

pytest -v --color=yes --cov=napari_plugin_manager --cov-report=xml [tox/tox_env/api.py:426]
  
  A module that was compiled using NumPy 1.x cannot be run in
  NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
  versions of NumPy, modules must be compiled with NumPy 2.0.
  Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
  
  If you are a user of the module, the easiest solution will be to
  downgrade to 'numpy<2' or try to upgrade the affected module.
  We expect that some modules will need time to support NumPy 2.

@goanpeca
Copy link
Contributor Author

Created #72 to track the problem, in the meantime this can be merged as soon as all tests pass!

Thanks everyone for your comments

@psobolewskiPhD
Copy link
Member

Maybe we should use constraints files from napari/napari for the test env?
Here's how it's used in napari/docs
https://github.com/napari/docs/blob/9dabb9e6598d286851cd97abf12a9cb858f8b65b/.github/workflows/build_and_deploy.yml#L54-L59

@psobolewskiPhD
Copy link
Member

I'd like to avoid the numpy <2 pin. I think the issue can be resolved with the PySide6 pin.
napari/PySide6 is both experimental and rather broken, so I'd not have that be driving stuff like numpy version.

@psobolewskiPhD
Copy link
Member

@goanpeca
Copy link
Contributor Author

Hi @psobolewskiPhD thanks for the info, let me push something with what you suggest to check.

However there is a problem with numpy>2 at the moment as displayed by the error message

@psobolewskiPhD
Copy link
Member

psobolewskiPhD commented Jul 17, 2024

Yeah, I saw that. But napari tests do pass with the constraints. So unless it's something specific the manager uses, I think the constraints should get this to pass too?
Looked promising here: #75

@goanpeca goanpeca force-pushed the enh/remove-instead-of-refresh branch from 04c0b0c to 38276d0 Compare July 17, 2024 03:37
@goanpeca
Copy link
Contributor Author

goanpeca commented Jul 17, 2024

Since we are skipping tests for py3.9 on the github workflow anyway I only added

PySide6: PySide6 != 6.4.3, !=6.5.0, !=6.5.1, !=6.5.1.1, !=6.5.2, != 6.5.3, != 6.6.0, != 6.6.1, != 6.6.2 ; python_version >= '3.10' and python_version < '3.12'

Seems to be working fine now :) thanks for the help @psobolewskiPhD

Merging after tests pass, fingers crossed 🤞🏼

@goanpeca
Copy link
Contributor Author

@dalthviz could you check that the modal pop on install and uninstall is working as expected. I think that was the only missing part (besides the pyside6 shenanigans)

@dalthviz
Copy link
Member

Gave this another check and seems like now the popup for install and uninstall are being placed along side the item 👍

imagen

However, using the action to show the dialog shows the following traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File ~\anaconda3\envs\napari-dev\lib\site-packages\app_model\backends\qt\_qaction.py:55, in QCommandAction._on_triggered(self=QMenuItemAction(MenuItem(when=Expr.parse('True')...tle=None, toggled=None), alt=None), app='napari'), checked=False)
     51 def _on_triggered(self, checked: bool) -> None:
     52     # execute_command returns a Future, for the sake of eventually being
     53     # asynchronous without breaking the API.  For now, we call result()
     54     # to raise any exceptions.
---> 55     self._app.commands.execute_command(self._command_id).result()
        self._command_id = 'napari.window.plugins.plugin_install_dialog'
        self = QMenuItemAction(MenuItem(when=Expr.parse('True'), group='1_plugins', order=1.0, command=CommandRule(id='napari.window.plugins.plugin_install_dialog', title='Install/Uninstall Plugins...', category=None, tooltip=None, status_tip=None, icon=None, icon_visible_in_menu=True, enablement=None, short_title=None, toggled=None), alt=None), app='napari')
        self._app = Application('napari')

File ~\anaconda3\envs\napari-dev\lib\site-packages\app_model\registries\_commands_reg.py:245, in CommandsRegistry.execute_command(self=<CommandsRegistry at 0x1a952ccb910 (148 commands)>, id='napari.window.plugins.plugin_install_dialog', execute_asynchronously=False, *args=(), **kwargs={})
    241 except Exception as e:
    242     if self._raise_synchronous_exceptions:
    243         # note, the caller of this function can also achieve this by
    244         # calling `future.result()` on the returned future object.
--> 245         raise e
    246     future.set_exception(e)
    248 return future

File ~\anaconda3\envs\napari-dev\lib\site-packages\app_model\registries\_commands_reg.py:240, in CommandsRegistry.execute_command(self=<CommandsRegistry at 0x1a952ccb910 (148 commands)>, id='napari.window.plugins.plugin_install_dialog', execute_asynchronously=False, *args=(), **kwargs={})
    238 future: Future = Future()
    239 try:
--> 240     future.set_result(cmd(*args, **kwargs))
        future = <Future at 0x1a9626881f0 state=pending>
        cmd = <function _show_plugin_install_dialog at 0x000001A95DB9A170>
        args = ()
        kwargs = {}
    241 except Exception as e:
    242     if self._raise_synchronous_exceptions:
    243         # note, the caller of this function can also achieve this by
    244         # calling `future.result()` on the returned future object.

File ~\anaconda3\envs\napari-dev\lib\site-packages\in_n_out\_store.py:934, in Store.inject_processors.<locals>._deco.<locals>._exec(*args=(), **kwargs={})
    932 @wraps(func)
    933 def _exec(*args: P.args, **kwargs: P.kwargs) -> R:
--> 934     result = func(*args, **kwargs)
        func = <function _show_plugin_install_dialog at 0x000001A95DB9BD00>
        args = ()
        kwargs = {}
    935     if result is not None:
    936         self.process(
    937             result,
    938             type_hint=type_hint,
   (...)
    941             _funcname=getattr(func, "__qualname__", str(func)),
    942         )

File ~\anaconda3\envs\napari-dev\lib\site-packages\in_n_out\_store.py:804, in Store.inject.<locals>._inner.<locals>._exec(*args=(), **kwargs={})
    797 logger.debug(
    798     "  Calling %s with %r (injected %r)",
    799     _fname,
    800     bound.arguments,
    801     _injected_names,
    802 )
    803 try:
--> 804     result = func(**bound.arguments)
        bound = <BoundArguments (window=<napari._qt.qt_main_window.Window object at 0x000001A952D1E800>)>
        func = <function _show_plugin_install_dialog at 0x000001A95AD94280>
        bound.arguments = {'window': <napari._qt.qt_main_window.Window object at 0x000001A952D1E800>}
    805 except TypeError as e:
    806     if "missing" not in e.args[0]:

File E:\Acer\Documentos\Quansight\Napari\napari\napari\_qt\_qapp_model\qactions\_plugins.py:35, in _show_plugin_install_dialog(window=<napari._qt.qt_main_window.Window object>)
     30 # TODO: Once menu contributions supported, `napari_plugin_manager` should be
     31 # amended to be a napari plugin and simply add this menu item itself.
     32 # This callback is only used when this package is available, thus we do not check
     33 from napari_plugin_manager.qt_plugin_dialog import QtPluginDialog
---> 35 QtPluginDialog(window._qt_window).exec_()
        QtPluginDialog = <class 'napari_plugin_manager.qt_plugin_dialog.QtPluginDialog'>
        window._qt_window = <napari._qt.qt_main_window._QtMainWindow object at 0x000001A954209C60>
        window = <napari._qt.qt_main_window.Window object at 0x000001A952D1E800>

File E:\Acer\Documentos\Quansight\Napari\napari otros\gonzalo\napari-plugin-manager\napari_plugin_manager\qt_plugin_dialog.py:1326, in QtPluginDialog.exec_(self=<napari_plugin_manager.qt_plugin_dialog.QtPluginDialog object>)
   1323 plugin_dialog.setModal(True)
   1324 plugin_dialog.show()
-> 1326 if self._first_open:
        self = <napari_plugin_manager.qt_plugin_dialog.QtPluginDialog object at 0x000001A962694280>
   1327     stylesheet = get_current_stylesheet([STYLES_PATH])
   1328     self.setStyleSheet(stylesheet)

AttributeError: 'QtPluginDialog' object has no attribute '_first_open'
INFO: Plugin Manager: process completed

Maybe there is a need to initialize the _first_open attribute early?

@dalthviz
Copy link
Member

Another thing I noticed now is that since is possible to close the plugin dialog with in progress tasks, you can end up showing the pop up after installation when the dialog is closed, so you can see something like:

plugin_install_uninstall_popup_dialog_closed

Checking, this behavior is also present with latest main, but maybe could be worthy to take care of that here too? Something like oviating the pop up logic in that case and instead just show with the napari notification the info about the need to restart napari for UI changes to take effect along side the process completed message? 🤔

@goanpeca
Copy link
Contributor Author

goanpeca commented Jul 17, 2024

Checking, this behavior is also present with latest main, but maybe could be worthy to take care of that here too? Something like oviating the pop up logic in that case and instead just show with the napari notification the info about the need to restart napari for UI changes to take effect along side the process completed message? 🤔

Great suggestion @dalthviz I had not thought about that but yes! Will push a fix


Also fixing the bug you found!

@goanpeca
Copy link
Contributor Author

I think the errors are now fixed @dalthviz , next round :)

napari

@dalthviz
Copy link
Member

Gave this another check and seems like things are working as expected 🎉

@goanpeca
Copy link
Contributor Author

Merging! Thanks for the reviews

@goanpeca goanpeca merged commit 7f90aa8 into napari:main Jul 18, 2024
12 checks passed
@goanpeca goanpeca added the enhancement New feature or request label Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
5 participants