Repository: napari/napari

Issue:
Add tooltip to npe2 plugin enable/disable checkboxes
## 🧰 Task
Currently it's not clear why some plugins' enable/disable button is greyed out because there's nothing telling the user it's an npe2 plugin. It would be great if we could add a tooltip on checkbox hover that tells the user "This plugin cannot be disabled as it's an npe2 plugin" or something like that.

This depends on how long we think it'll take us to get the enable/disable functionality sorted. Pinging @tlambert03 @nclack and @ppwadhwa.



Discussion:
I like the tooltip idea.

I also wonder if there should be an npe2 badge or something displayed on those plugins. It would be nice to have some visual indicator especially for plugin developers who are migrating their plugins.
Yes,  I like the tooltip and the badge!

On Wed, Dec 8, 2021, 3:06 PM Nathan Clack ***@***.***> wrote:

> I like the tooltip idea.
>
> I also wonder if there should be an npe2 badge or something displayed on
> those plugins. It would be nice to have some visual indicator especially
> for plugin developers who are migrating their plugins.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/napari/napari/issues/3780#issuecomment-989195419>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AM6EO6NCQOFDPJ4JW4SKMNTUP7CE7ANCNFSM5JUVAJSQ>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
>

> I also wonder if there should be an npe2 badge or something 

maybe 😎 ?

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
@@ -46,6 +46,7 @@
 from ...utils._appdirs import user_plugin_dir, user_site_packages
 from ...utils.misc import parse_version, running_as_bundled_app
 from ...utils.translations import trans
+from ..qt_resources import QColoredSVGIcon
 from ..qthreading import create_worker
 from ..widgets.qt_message_popup import WarnPopup
 
@@ -325,7 +326,7 @@ def __init__(
         self.help_button.setText(trans._("Website"))
         self.help_button.setObjectName("help_button")
         if npe_version != 1:
-            self.enabled_checkbox.setEnabled(False)
+            self._handle_npe2_plugin()
 
         if installed:
             self.enabled_checkbox.show()
@@ -336,6 +337,17 @@ def __init__(
             self.action_button.setText(trans._("install"))
             self.action_button.setObjectName("install_button")
 
+    def _handle_npe2_plugin(self):
+        npe2_icon = QLabel(self)
+        icon = QColoredSVGIcon.from_resources('logo_silhouette')
+        npe2_icon.setPixmap(icon.colored(color='#33F0FF').pixmap(20, 20))
+        self.row1.insertWidget(2, QLabel('npe2'))
+        self.row1.insertWidget(2, npe2_icon)
+        self.enabled_checkbox.setEnabled(False)
+        self.enabled_checkbox.setToolTip(
+            'This is a npe2 plugin and cannot be enabled/disabled at this time.'
+        )
+
     def _get_dialog(self) -> QDialog:
         p = self.parent()
         while not isinstance(p, QDialog) and p.parent():


Test patch: