From fe11a0cdc06bd11086ae58ce64757f87168269e0 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 1 May 2020 18:58:39 -0400 Subject: [PATCH] no-remote-plugins: Update for picard 2.3.1 Recent versions of Picard split out the PluginManager type from the "picard.plugin" module to the "picard.pluginmanager" module. So update the import location accordingly, with a fallback to maintain support for older versions. --- no-remote-plugins.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/no-remote-plugins.py b/no-remote-plugins.py index 9f7908b..67f4ccc 100644 --- a/no-remote-plugins.py +++ b/no-remote-plugins.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright © 2018-2019 Nick Bowler +# Copyright © 2018-2020 Nick Bowler # # License GPLv3+: GNU General Public License version 3 or any later version. # This is free software: you are free to change and redistribute it. @@ -12,12 +12,17 @@ PLUGIN_DESCRIPTION = u'''

This plugin disables querying the MusicBrainz server for plugins. This avoids network activity at startup and prevents the options dialog from suggesting non-free plugins for installation.

''' -PLUGIN_VERSION = "1.1" +PLUGIN_VERSION = "2" PLUGIN_API_VERSIONS = ["1.0", "2.0"] PLUGIN_LICENSE = "GPL-3.0-or-later" from picard import (config, log, plugin) +try: + from picard.pluginmanager import PluginManager +except ImportError: + PluginManager = plugin.PluginManager + try: from PyQt5 import QtCore except (RuntimeError, ImportError): @@ -34,7 +39,7 @@ def repl_query(self, callback=None): tagger = QtCore.QObject.tagger def install_hooks(): tagger.pluginmanager.query_available_plugins = \ - types.MethodType(repl_query, plugin.PluginManager) + types.MethodType(repl_query, PluginManager) log.info("%s activated" % (modulename())) if modulename() in config.setting["enabled_plugins"]: -- 2.43.2