Repository: napari/napari

Issue:
Plugin dialog fail to open in bundle app
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

## To Reproduce

Steps to reproduce the behavior:

1. install the last available bundle from the release page https://github.com/napari/napari/releases/tag/v0.4.16
2. try to open the plugin dialog

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior
```
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/.local/napari-0.4.16rc7/envs/napari-0.4.16rc7/lib/python3.9/site-packages/napari/_qt/menus/plugins_menu.py in _show_plugin_install_dialog(self=<napari._qt.menus.plugins_menu.PluginsMenu(0x55bb36bd0520)>)
    108     def _show_plugin_install_dialog(self):
    109         """Show dialog that allows users to sort the call order of plugins."""
--> 110         QtPluginDialog(self._win._qt_window).exec_()
        global QtPluginDialog = <class 'napari._qt.dialogs.qt_plugin_dialog.QtPluginDialog'>
        self._win._qt_window.exec_ = undefined
    111 
    112     def _show_plugin_err_reporter(self):

~/.local/napari-0.4.16rc7/envs/napari-0.4.16rc7/lib/python3.9/site-packages/napari/_qt/dialogs/qt_plugin_dialog.py in __init__(self=<napari._qt.dialogs.qt_plugin_dialog.QtPluginDialog(0x55bb3514d6d0)>, parent=<napari._qt.qt_main_window._QtMainWindow(0x55bb34b0ac10)>)
    733         self.installer.started.connect(self._on_installer_start)
    734         self.installer.finished.connect(self._on_installer_done)
--> 735         self.refresh()
        self.refresh = <bound method QtPluginDialog.refresh of <napari._qt.dialogs.qt_plugin_dialog.QtPluginDialog(0x55bb3514d6d0) at 0x7f1bce989a80>>
    736 
    737     def _on_installer_start(self):

~/.local/napari-0.4.16rc7/envs/napari-0.4.16rc7/lib/python3.9/site-packages/napari/_qt/dialogs/qt_plugin_dialog.py in refresh(self=<napari._qt.dialogs.qt_plugin_dialog.QtPluginDialog(0x55bb3514d6d0)>)
    809                 continue
    810             enabled = not pm2.is_disabled(manifest.name)
--> 811             _add_to_installed(distname, enabled, npe_version=2)
        _add_to_installed = <function QtPluginDialog.refresh.<locals>._add_to_installed at 0x7f1bd1a96700>
        distname = 'napari-svg'
        enabled = True
        global npe_version = undefined
    812 
    813         for (

~/.local/napari-0.4.16rc7/envs/napari-0.4.16rc7/lib/python3.9/site-packages/napari/_qt/dialogs/qt_plugin_dialog.py in _add_to_installed(distname='napari-svg', enabled=True, npe_version=2)
    788                 meta = {}
    789 
--> 790             self.installed_list.addItem(
        global self.installed_list.addItem = undefined
        global PackageMetadata = <class 'npe2.manifest._package_metadata.PackageMetadata'>
        global metadata_version = undefined
        global name = undefined
        norm_name = 'napari-svg'
        global version = undefined
        meta.get = <bound method Message.get of <setuptools._vendor.importlib_metadata._adapters.Message object at 0x7f1bce968df0>>
        global summary = undefined
        global home_page = undefined
        global author = undefined
        global license = undefined
        global installed = undefined
        enabled = True
        npe_version = 2
    791                 PackageMetadata(
    792                     metadata_version="1.0",

~/.local/napari-0.4.16rc7/envs/napari-0.4.16rc7/lib/python3.9/site-packages/napari/_qt/dialogs/qt_plugin_dialog.py in addItem(self=<napari._qt.dialogs.qt_plugin_dialog.QPluginList(0x55bb35182e40)>, project_info=PackageMetadata(metadata_version='1.0', name='na...ra=None, provides_dist=None, obsoletes_dist=None), installed=True, plugin_name=None, enabled=True, npe_version=2)
    568         # including summary here for sake of filtering below.
    569         searchable_text = pkg_name + " " + project_info.summary
--> 570         item = QListWidgetItem(searchable_text, parent=self)
        global item = undefined
        global QListWidgetItem = <class 'PySide2.QtWidgets.QListWidgetItem'>
        searchable_text = 'napari-svg A plugin for reading and writing svg files with napari'
        global parent = undefined
        self = <napari._qt.dialogs.qt_plugin_dialog.QPluginList(0x55bb35182e40) at 0x7f1bce989d80>
    571         item.version = project_info.version
    572         super().addItem(item)

AttributeError: PySide2.QtWidgets.QListWidgetItem.__init__(): unsupported keyword 'parent'
```
<!-- A clear and concise description of what you expected to happen. -->

## Environment

napari: 0.4.16rc7
Platform: Linux-5.13.0-48-generic-x86_64-with-glibc2.34
System: Ubuntu 21.10
Python: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:56:21) [GCC 10.3.0]
Qt: 5.15.3
PySide2: 5.15.4
NumPy: 1.22.4
SciPy: 1.8.1
Dask: 2022.05.2
VisPy: 0.9.6

OpenGL:
- GL version: 4.6.0 NVIDIA 510.73.05
- MAX_TEXTURE_SIZE: 32768

Screens:
- screen 1: resolution 2560x1440, scale 1.0
- screen 2: resolution 1920x1080, scale 1.0
- screen 3: resolution 1920x1080, scale 1.0

Plugins:
- console: 0.0.4
- napari-svg: 0.1.6
- scikit-image: 0.4.16rc7

## Additional context

<!-- Add any other context about the problem here. -->

first reported here https://napari.zulipchat.com/#narrow/stream/212875-general/topic/Plugin.20install.20in.20the.20bundled.20app/near/285525233





Discussion:

Resolving patch:
diff --git a/napari/_qt/dialogs/qt_plugin_dialog.py b/napari/_qt/dialogs/qt_plugin_dialog.py
--- a/napari/_qt/dialogs/qt_plugin_dialog.py
+++ b/napari/_qt/dialogs/qt_plugin_dialog.py
@@ -566,8 +566,8 @@ def addItem(
             return
 
         # including summary here for sake of filtering below.
-        searchable_text = pkg_name + " " + project_info.summary
-        item = QListWidgetItem(searchable_text, parent=self)
+        searchable_text = f"{pkg_name} {project_info.summary}"
+        item = QListWidgetItem(searchable_text, self)
         item.version = project_info.version
         super().addItem(item)
         widg = PluginListItem(
diff --git a/napari/_qt/widgets/qt_plugin_sorter.py b/napari/_qt/widgets/qt_plugin_sorter.py
--- a/napari/_qt/widgets/qt_plugin_sorter.py
+++ b/napari/_qt/widgets/qt_plugin_sorter.py
@@ -207,7 +207,7 @@ def append_hook_implementation(
         hook_implementation : HookImplementation
             The hook implementation object to add to the list.
         """
-        item = QListWidgetItem(parent=self)
+        item = QListWidgetItem(self)
         item.hook_implementation = hook_implementation
         self.addItem(item)
         widg = ImplementationListItem(item, parent=self)


Test patch: