]> git.draconx.ca Git - picard-plugins.git/blobdiff - no-remote-plugins.py
tweak-filename-filter: Update for picard 2.3.1
[picard-plugins.git] / no-remote-plugins.py
index 68c384be8bc76fff096197461d3d60261837bacc..67f4ccc176c01ce8a5e6567588a857c25a029c6e 100644 (file)
@@ -1,5 +1,7 @@
 # -*- coding: utf-8 -*-
 #
+# 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.
 # There is NO WARRANTY, to the extent permitted by law.
@@ -10,28 +12,37 @@ PLUGIN_DESCRIPTION = u'''<p>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.</p>
 '''
-PLUGIN_VERSION = "0"
-PLUGIN_API_VERSIONS = ["1.0"]
+PLUGIN_VERSION = "2"
+PLUGIN_API_VERSIONS = ["1.0", "2.0"]
 PLUGIN_LICENSE = "GPL-3.0-or-later"
 
 from picard import (config, log, plugin)
-from PyQt4 import QtCore
+
+try:
+    from picard.pluginmanager import PluginManager
+except ImportError:
+    PluginManager = plugin.PluginManager
+
+try:
+    from PyQt5 import QtCore
+except (RuntimeError, ImportError):
+    from PyQt4 import QtCore
+
 import types
 
 def modulename():
     return modulename.__module__[len("picard.plugins."):]
 
-# class ReplPluginManager(plugin.PluginManager):
 def repl_query(self, callback=None):
     pass
 
 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"]:
     install_hooks()
 else:
-    log.debug("%s disabled in configuration" % (modulename()));
+    log.debug("%s disabled in configuration" % (modulename()))